mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-18 15:31:48 +00:00
Strip trailing slashes from download server URL.
If the server sends us an URL with trailing slash we're generating URIs like http://example.com//maps/foo.bsp. While double // are perfectly valid they might me rejected by some servers. So let's play save.
This commit is contained in:
parent
e05f95e3fb
commit
5e67596d56
1 changed files with 12 additions and 1 deletions
|
@ -920,7 +920,18 @@ void CL_SetHTTPServer (const char *URL)
|
|||
abortDownloads = HTTPDL_ABORT_NONE;
|
||||
handleCount = pendingCount = 0;
|
||||
cls.downloadServerRetry[0] = 0;
|
||||
Q_strlcpy(cls.downloadServer, URL, sizeof(cls.downloadServer) - 1);
|
||||
|
||||
// Remove trailing / from URL if any.
|
||||
size_t urllen = strlen(URL);
|
||||
char *cleanURL = strdup(URL);
|
||||
|
||||
if (cleanURL[urllen - 1] == '/')
|
||||
{
|
||||
cleanURL[urllen - 1] = '\0';
|
||||
}
|
||||
|
||||
Q_strlcpy(cls.downloadServer, cleanURL, sizeof(cls.downloadServer) - 1);
|
||||
free(cleanURL);
|
||||
|
||||
// Initializes a new multihandle.
|
||||
if (multi)
|
||||
|
|
Loading…
Reference in a new issue