Set username, password, host, port to empty if the URL is missing the authority
This commit is contained in:
@@ -357,7 +357,6 @@ int url_parse(char *src, int len, int *pcur, URL *out)
|
|||||||
if (cur < len && (is_userinfo(src[cur]) || src[cur] == ':')) {
|
if (cur < len && (is_userinfo(src[cur]) || src[cur] == ':')) {
|
||||||
|
|
||||||
int user_off = cur;
|
int user_off = cur;
|
||||||
cur++;
|
|
||||||
|
|
||||||
while (cur < len) {
|
while (cur < len) {
|
||||||
if (is_userinfo(src[cur]))
|
if (is_userinfo(src[cur]))
|
||||||
@@ -489,6 +488,13 @@ int url_parse(char *src, int len, int *pcur, URL *out)
|
|||||||
out->port = out->port * 10 + n;
|
out->port = out->port * 10 + n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
out->username = EMPTY;
|
||||||
|
out->password = EMPTY;
|
||||||
|
out->host_text = EMPTY;
|
||||||
|
out->host_type = URL_HOST_EMPTY;
|
||||||
|
out->port = 0;
|
||||||
|
out->no_port = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we parse the path. This is most difficult
|
// Now we parse the path. This is most difficult
|
||||||
|
|||||||
Reference in New Issue
Block a user