Z_Free(di);
}
+/*
+====================
+CleanURL
+
+Returns a "cleaned up" URL for display (to strip login data)
+====================
+*/
+static const char *CleanURL(const char *url)
+{
+ static char urlbuf[1024];
+ const char *p, *q, *r;
+
+ // if URL is of form anything://foo-without-slash@rest, replace by anything://rest
+ p = strstr(url, "://");
+ if(p)
+ {
+ q = strchr(p + 3, '@');
+ if(q)
+ {
+ r = strchr(p + 3, '/');
+ if(!r || q < r)
+ {
+ dpsnprintf(urlbuf, sizeof(urlbuf), "%.*s%s", (int)(p - url + 3), url, q + 1);
+ return urlbuf;
+ }
+ }
+ }
+
+ return url;
+}
+
/*
====================
CheckPendingDownloads
{
if(!di->buffer)
{
- Con_Printf("Downloading %s -> %s", di->url, di->filename);
+ Con_Printf("Downloading %s -> %s", CleanURL(di->url), di->filename);
di->stream = FS_OpenRealFile(di->filename, "ab", false);
if(!di->stream)
}
else
{
- Con_DPrintf("Downloading %s -> memory\n", di->url);
+ Con_DPrintf("Downloading %s -> memory\n", CleanURL(di->url));
di->startpos = 0;
}
// 141.2.16.3 - - [17/Mar/2006:22:32:43 +0100] "GET /maps/tznex07.pk3 HTTP/1.1" 200 1077455 "dp://141.2.16.7:26000/" "Nexuiz Linux 22:07:43 Mar 17 2006"
if(!name)
- name = URL;
+ name = CleanURL(URL);
if(!buf)
{
downloadinfo *di = Curl_Find(fn);
if(di)
{
- Con_Printf("Can't download %s, already getting it from %s!\n", fn, di->url);
+ Con_Printf("Can't download %s, already getting it from %s!\n", fn, CleanURL(di->url));
// however, if it was not for this map yet...
if(forthismap && !di->forthismap)
for(di = downloads; di; di = di->next)
{
double speed, percent;
- Con_Printf(" %s -> %s ", di->url, di->filename);
+ Con_Printf(" %s -> %s ", CleanURL(di->url), di->filename);
percent = 100.0 * Curl_GetDownloadAmount(di);
speed = Curl_GetDownloadSpeed(di);
if(percent >= 0)
return;
}
- for(i = 0; i != Cmd_Argc(); ++i)
- Con_DPrintf("%s ", Cmd_Argv(i));
- Con_DPrint("\n");
-
if(Cmd_Argc() < 2)
{
Con_Print("usage:\ncurl --info, curl --cancel [filename], curl url\n");