summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-01-10 15:35:48 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-01-11 00:21:28 +0100
commit229930762fbbeec14ec6544d180f12958c86f330 (patch)
tree76ada02e89eb00ebb20cc191408b3a0917f82077
parent16b27e06bd5589ff4acf80a55de976dbe56575c0 (diff)
downloadcurl-229930762fbbeec14ec6544d180f12958c86f330.tar.gz
url: if IDNA conversion fails, fallback to Transitional
This improves IDNA2003 compatiblity. Reported-by: Bubu on github Fixes #6423 Closes #6428
-rw-r--r--lib/url.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 60ba56dae..ab56760de 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -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 */