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

Function GetFinalUrl

src/webclient/Http_Web.c:66–80  ·  view source on GitHub ↗

Converts e.g. "http://dl.dropbox.com/xyZ" into "https://dl.dropboxusercontent.com/xyZ" */

Source from the content-addressed store, hash-verified

64
65/* Converts e.g. "http://dl.dropbox.com/xyZ" into "https://dl.dropboxusercontent.com/xyZ" */
66static void GetFinalUrl(struct HttpRequest* req, cc_string* dst) {
67 cc_string url = String_FromRawArray(req->url);
68 cc_string resource;
69 int i;
70
71 for (i = 0; i < Array_Elems(url_rewrite_srcs); i++)
72 {
73 if (!String_CaselessStarts(&url, &url_rewrite_srcs[i])) continue;
74
75 resource = String_UNSAFE_SubstringAt(&url, url_rewrite_srcs[i].length);
76 String_Format2(dst, "%c%s", url_rewrite_dsts[i], &resource);
77 return;
78 }
79 String_Copy(dst, &url);
80}
81
82#define HTTP_MAX_CONCURRENCY 6
83static void Http_StartNextDownload(void) {

Callers 1

Http_StartNextDownloadFunction · 0.85

Calls 4

String_CaselessStartsFunction · 0.85
String_Format2Function · 0.85
String_CopyFunction · 0.85

Tested by

no test coverage detected