mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-15 10:59:39 +00:00
OSSL_parse_url(): Improve handling of IPv6 addresses
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14630)
This commit is contained in:
parent
f7c4d86228
commit
2318379119
@ -87,11 +87,10 @@ int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,
|
|||||||
/* parse host name/address as far as needed here */
|
/* parse host name/address as far as needed here */
|
||||||
if (host[0] == '[') {
|
if (host[0] == '[') {
|
||||||
/* ipv6 literal, which may include ':' */
|
/* ipv6 literal, which may include ':' */
|
||||||
host++;
|
host_end = strchr(host + 1, ']');
|
||||||
host_end = strchr(host, ']');
|
|
||||||
if (host_end == NULL)
|
if (host_end == NULL)
|
||||||
goto parse_err;
|
goto parse_err;
|
||||||
p = host_end + 1;
|
p = ++host_end;
|
||||||
} else {
|
} else {
|
||||||
/* look for start of optional port, path, query, or fragment */
|
/* look for start of optional port, path, query, or fragment */
|
||||||
host_end = strchr(host, ':');
|
host_end = strchr(host, ':');
|
||||||
|
@ -204,7 +204,7 @@ static int test_http_url_ipv4(void)
|
|||||||
|
|
||||||
static int test_http_url_ipv6(void)
|
static int test_http_url_ipv6(void)
|
||||||
{
|
{
|
||||||
return test_http_url_ok("http://[FF01::101]:6", 0, "FF01::101", "6", "/");
|
return test_http_url_ok("http://[FF01::101]:6", 0, "[FF01::101]", "6", "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int test_http_url_invalid(const char *url)
|
static int test_http_url_invalid(const char *url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user