MCPcopy Create free account
hub / github.com/assaultcube/AC / urlencode

Function urlencode

source/src/http.cpp:374–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374char *urlencode(const char *s, bool strict)
375{
376 vector<char> d;
377 while(*s)
378 {
379 if(isalnum(*s) || strchr("-_.~", *s) || (!strict && strchr(":/?#[]@!$&'()*+,;=", *s))) d.add(*s++); // see RFC 3986 2.2
380 else cvecprintf(d, "%%%02X", *s++);
381 }
382 d.add('\0');
383 return newstring(d.getbuf());
384}
385
386// parse URLs: scheme:[//[user:password@]domain[:port]][/]path[?query][#fragment]
387

Callers 1

retrieveserversFunction · 0.85

Calls 4

cvecprintfFunction · 0.85
newstringFunction · 0.85
addMethod · 0.45
getbufMethod · 0.45

Tested by

no test coverage detected