Unbreak parsing URLs that have a host part but no document part.
While we're here, fix a snprintf() usage warning.
This commit is contained in:
parent
966222f878
commit
5b2ad516e9
@ -307,7 +307,7 @@ fetchParseURL(const char *URL)
|
|||||||
|
|
||||||
/* scheme name */
|
/* scheme name */
|
||||||
if ((p = strstr(URL, ":/"))) {
|
if ((p = strstr(URL, ":/"))) {
|
||||||
snprintf(u->scheme, URL_SCHEMELEN+1, "%.*s", p - URL, URL);
|
snprintf(u->scheme, URL_SCHEMELEN+1, "%.*s", (int)(p - URL), URL);
|
||||||
URL = ++p;
|
URL = ++p;
|
||||||
/*
|
/*
|
||||||
* Only one slash: no host, leave slash as part of document
|
* Only one slash: no host, leave slash as part of document
|
||||||
@ -318,7 +318,8 @@ fetchParseURL(const char *URL)
|
|||||||
} else {
|
} else {
|
||||||
p = URL;
|
p = URL;
|
||||||
}
|
}
|
||||||
if (!*URL || *URL == '/' || *URL == '.' || strchr(URL, '/') == NULL)
|
if (!*URL || *URL == '/' || *URL == '.' ||
|
||||||
|
(u->scheme[0] == '\0' && strchr(URL, '/') == NULL))
|
||||||
goto nohost;
|
goto nohost;
|
||||||
|
|
||||||
p = strpbrk(URL, "/@");
|
p = strpbrk(URL, "/@");
|
||||||
|
Loading…
Reference in New Issue
Block a user