MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / HttpUrl_EncodeUrl

Function HttpUrl_EncodeUrl

src/Http_Worker.c:70–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68};
69
70static void HttpUrl_EncodeUrl(cc_string* dst, const cc_string* src) {
71 cc_uint8 data[4];
72 int i, len;
73 char c;
74
75 for (i = 0; i < src->length; i++) {
76 c = src->buffer[i];
77 len = Convert_CP437ToUtf8(c, data);
78
79 /* URL path/query must not be URL encoded (it normally would be) */
80 if (c == '/' || c == '?' || c == '=' || c == '&') {
81 String_Append(dst, c);
82 } else {
83 Http_UrlEncode(dst, data, len);
84 }
85 }
86}
87
88static const cc_string url_rewrite_srcs[] = {
89 #define URL_REMAP_FUNC(src_base, src_host, dst_base, dst_host) String_FromConst(src_host),

Callers 2

HttpUrl_ParseFunction · 0.85
HttpUrl_ResolveRedirectFunction · 0.85

Calls 3

Convert_CP437ToUtf8Function · 0.85
String_AppendFunction · 0.85
Http_UrlEncodeFunction · 0.85

Tested by

no test coverage detected