From: Jacob Mealey Date: Thu, 15 May 2025 23:57:49 +0000 (-0400) Subject: urlapi: remove unneeded guards around PUNY2IDN X-Git-Tag: curl-8_14_0~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0f05bcf69158c6707203defe9e19f874ea2a97f;p=thirdparty%2Fcurl.git urlapi: remove unneeded guards around PUNY2IDN Add more IDN/punycode tests to 1560 Closes #17364 --- diff --git a/lib/urlapi.c b/lib/urlapi.c index 8cf174ff23..adebf1c414 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -1493,7 +1493,7 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what, } } else if(depunyfy) { - if(Curl_is_ASCII_name(u->host) && !strncmp("xn--", u->host, 4)) { + if(Curl_is_ASCII_name(u->host)) { #ifndef USE_IDN return CURLUE_LACKS_IDN; #else @@ -1592,7 +1592,7 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what, } } else if(depunyfy) { - if(Curl_is_ASCII_name(u->host) && !strncmp("xn--", u->host, 4)) { + if(Curl_is_ASCII_name(u->host)) { #ifndef USE_IDN return CURLUE_LACKS_IDN; #else diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index c9ae08fe0d..a0b9baa1bf 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -214,6 +214,12 @@ static const struct testcase get_parts_list[] ={ {"https://xn--rksmrgs-5wao1o.se", "https | [11] | [12] | [13] | r\xc3\xa4ksm\xc3\xb6rg\xc3\xa5s.se | " "[15] | / | [16] | [17]", 0, CURLU_PUNY2IDN, CURLUE_OK}, + {"https://www.xn--rksmrgs-5wao1o.se", + "https | [11] | [12] | [13] | www.r\xc3\xa4ksm\xc3\xb6rg\xc3\xa5s.se | " + "[15] | / | [16] | [17]", 0, CURLU_PUNY2IDN, CURLUE_OK}, + {"https://www.r\xc3\xa4ksm\xc3\xb6rg\xc3\xa5s.se", + "https | [11] | [12] | [13] | www.r\xc3\xa4ksm\xc3\xb6rg\xc3\xa5s.se | " + "[15] | / | [16] | [17]", 0, CURLU_PUNY2IDN, CURLUE_OK}, #else {"https://r\xc3\xa4ksm\xc3\xb6rg\xc3\xa5s.se", "https | [11] | [12] | [13] | [30] | [15] | / | [16] | [17]",