MCPcopy Create free account
hub / github.com/SmingHub/Sming / parseQuery

Method parseQuery

Sming/Components/Network/src/Network/Http/HttpParams.cpp:21–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19static const unsigned MAX_PARAMS = 16;
20
21void HttpParams::parseQuery(char* query)
22{
23 clear();
24
25 if(query == nullptr) {
26 return;
27 }
28 // Accept query strings with or without '?' prefix
29 if(*query == '?') {
30 ++query;
31 }
32
33 struct yuarel_param params[MAX_PARAMS];
34 int paramCount = yuarel_parse_query(query, '&', params, MAX_PARAMS);
35 if(paramCount <= 0) {
36 return;
37 }
38
39 if(!allocate(paramCount)) {
40 return;
41 }
42
43 for(int i = 0; i < paramCount; ++i) {
44 String key = uri_unescape_inplace(params[i].key);
45 String value = uri_unescape_inplace(params[i].val);
46 operator[](key) = value;
47 }
48}
49
50String HttpParams::toString() const
51{

Callers 1

Url.cppFile · 0.80

Calls 1

uri_unescape_inplaceFunction · 0.85

Tested by

no test coverage detected