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

Function HttpUrl_ResolveRedirect

src/Http_Worker.c:128–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128static cc_result HttpUrl_ResolveRedirect(struct HttpUrl* parts, const cc_string* url) {
129 /* absolute URL */
130 if (String_IndexOfConst(url, "http://") == 0 || String_IndexOfConst(url, "https://") == 0) {
131 HttpUrl_Parse(url, parts);
132 return 0;
133 }
134
135 /* Root relative URL */
136 if (url->buffer[0] == '/' && (url->length == 1 || url->buffer[1] != '/')) {
137 parts->resource.length = 0;
138 HttpUrl_EncodeUrl(&parts->resource, url);
139 return 0;
140 }
141
142 /* TODO scheme relative or relative URL or invalid */
143 return HTTP_ERR_RELATIVE;
144}
145
146
147/*########################################################################################################################*

Callers 1

Calls 3

String_IndexOfConstFunction · 0.85
HttpUrl_ParseFunction · 0.85
HttpUrl_EncodeUrlFunction · 0.85

Tested by

no test coverage detected