1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-23 08:38:49 -05:00

url: if IDNA conversion fails, fallback to Transitional

This improves IDNA2003 compatiblity.

Reported-by: Bubu on github
Fixes #6423
Closes #6428
This commit is contained in:
Daniel Stenberg 2021-01-10 15:35:48 +01:00
parent 16b27e06bd
commit 229930762f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1541,6 +1541,11 @@ CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
int flags = IDN2_NFC_INPUT;
#endif
int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, flags);
if(rc != IDN2_OK)
/* fallback to TR46 Transitional mode for better IDNA2003
compatibility */
rc = idn2_lookup_ul((const char *)host->name, &ace_hostname,
IDN2_TRANSITIONAL);
if(rc == IDN2_OK) {
host->encalloc = (char *)ace_hostname;
/* change the name pointer to point to the encoded hostname */