urlapi: remove unneeded guards around PUNY2IDN

Add more IDN/punycode tests to 1560

Closes #17364
This commit is contained in:
Jacob Mealey 2025-05-15 19:57:49 -04:00 committed by Daniel Stenberg
parent 73b8912580
commit e0f05bcf69
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 8 additions and 2 deletions

View 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

View 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]",