]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: remove unneeded guards around PUNY2IDN
authorJacob Mealey <jacobmealey.maine@gmail.com>
Thu, 15 May 2025 23:57:49 +0000 (19:57 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 16 May 2025 12:44:30 +0000 (14:44 +0200)
Add more IDN/punycode tests to 1560

Closes #17364

lib/urlapi.c
tests/libtest/lib1560.c

index 8cf174ff23421554c084d9116ce627d6f285d2b3..adebf1c41460bf3778b4dfeed7114b18eadbbec7 100644 (file)
@@ -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
index c9ae08fe0d00a12688cd2ec5eb72af7d2b85b3cf..a0b9baa1bfa62196270ef42afa7e92d60adaa5f4 100644 (file)
@@ -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]",