Be nice to a server that returns its URL without a trailing slash

Attached is a patch that resolved an issue I found with a server that
gave its device description URI without a trailing slash (e.g.
`http://127.0.0.1:5555`).
This commit is contained in:
Edwin Stearns 2012-02-18 11:35:21 -02:00 committed by Marcelo Roberto Jimenez
parent 537581d8ad
commit a9c24fc7f3
2 changed files with 13 additions and 5 deletions

View File

@ -2,6 +2,12 @@
Version 1.6.16 Version 1.6.16
******************************************************************************* *******************************************************************************
2012-02-07 Edwin Stearns <edwin(at)vtilt.com>
Attached is a patch that resolved an issue I found with a server that
gave its device description URI without a trailing slash (e.g.
`http://127.0.0.1:5555`).
2012-01-04 Fabrice Fontaine <fabrice.fontaine(at)orange.com> 2012-01-04 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Bug fix for IPv4-mapped IPv6 addresses. Bug fix for IPv4-mapped IPv6 addresses.

View File

@ -641,11 +641,13 @@ int http_Download( IN const char *url_str,
return UPNP_E_INVALID_URL; return UPNP_E_INVALID_URL;
hoststr += 2; hoststr += 2;
temp = strchr(hoststr, '/'); temp = strchr(hoststr, '/');
if (temp == NULL) if (temp) {
return UPNP_E_INVALID_URL;
*temp = '\0'; *temp = '\0';
hostlen = strlen(hoststr); hostlen = strlen(hoststr);
*temp = '/'; *temp = '/';
} else {
hostlen = strlen(hoststr);
}
UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__, UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__,
"HOSTNAME : %s Length : %" PRIzu "\n", hoststr, hostlen); "HOSTNAME : %s Length : %" PRIzu "\n", hoststr, hostlen);
ret_code = http_MakeMessage(&request, 1, 1, ret_code = http_MakeMessage(&request, 1, 1,