From 229930762fbbeec14ec6544d180f12958c86f330 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 10 Jan 2021 15:35:48 +0100 Subject: [PATCH] url: if IDNA conversion fails, fallback to Transitional This improves IDNA2003 compatiblity. Reported-by: Bubu on github Fixes #6423 Closes #6428 --- lib/url.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/url.c b/lib/url.c index 60ba56dae6..ab56760de1 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 */