← Commit list

1b6724882c

Daniel Stenberg
Daniel Stenberg
2026-05-31
SUCCESS Duration: 264s

Subject

urlapi: accept 0X prefix in IPv4 address as well

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/urlapi.c+1 -1
@@ -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)
tests/libtest/lib1560.c+3 -0
@@ -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},