mirror of
https://github.com/curl/curl.git
synced 2026-06-02 00:44:15 +03:00
urlapi: accept 0X prefix in IPv4 address as well
Extend test 1560 accordingly Closes #21820
This commit is contained in:
parent
780ccb256e
commit
1b6724882c
2 changed files with 4 additions and 1 deletions
|
|
@ -520,7 +520,7 @@ UNITTEST int ipv4_normalize(struct dynbuf *host)
|
|||
int rc;
|
||||
curl_off_t l;
|
||||
if(*c == '0') {
|
||||
if(c[1] == 'x') {
|
||||
if(Curl_raw_tolower(c[1]) == 'x') {
|
||||
c += 2; /* skip the prefix */
|
||||
rc = curlx_str_hex(&c, &l, UINT_MAX);
|
||||
if(rc)
|
||||
|
|
|
|||
|
|
@ -706,6 +706,7 @@ static const struct urltestcase get_url_list[] = {
|
|||
{"https://0xffffffff", "https://255.255.255.255/", 0, 0, CURLUE_OK},
|
||||
{"https://1.0x1000000", "https://1.0x1000000/", 0, 0, CURLUE_OK},
|
||||
{"https://0x7f.1", "https://127.0.0.1/", 0, 0, CURLUE_OK},
|
||||
{"https://0X7F.1", "https://127.0.0.1/", 0, 0, CURLUE_OK},
|
||||
{"https://1.2.3.256.com", "https://1.2.3.256.com/", 0, 0, CURLUE_OK},
|
||||
{"https://10.com", "https://10.com/", 0, 0, CURLUE_OK},
|
||||
{"https://1.2.com", "https://1.2.com/", 0, 0, CURLUE_OK},
|
||||
|
|
@ -765,10 +766,12 @@ static const struct urltestcase get_url_list[] = {
|
|||
{"https://16843009", "https://1.1.1.1/", 0, 0, CURLUE_OK},
|
||||
{"https://0177.1", "https://127.0.0.1/", 0, 0, CURLUE_OK},
|
||||
{"https://0111.02.0x3", "https://73.2.0.3/", 0, 0, CURLUE_OK},
|
||||
{"https://0111.02.0X3", "https://73.2.0.3/", 0, 0, CURLUE_OK},
|
||||
{"https://0111.02.0x3.", "https://73.2.0.3/", 0, 0, CURLUE_OK},
|
||||
{"https://0111.02.030", "https://73.2.0.24/", 0, 0, CURLUE_OK},
|
||||
{"https://0111.02.030.", "https://73.2.0.24/", 0, 0, CURLUE_OK},
|
||||
{"https://0xff.0xff.0377.255", "https://255.255.255.255/", 0, 0, CURLUE_OK},
|
||||
{"https://0XFF.0XFF.0377.255", "https://255.255.255.255/", 0, 0, CURLUE_OK},
|
||||
{"https://1.0xffffff", "https://1.255.255.255/", 0, 0, CURLUE_OK},
|
||||
/* IPv4 numerical overflows or syntax errors will not normalize */
|
||||
{"https://a127.0.0.1", "https://a127.0.0.1/", 0, 0, CURLUE_OK},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue