urlapi: return CURLUE_BAD_HOSTNAME if puny2idn encoding fails

And document it. Only return out of memory when it actually is a memory
problem.

Pointed-out-by: Jacob Mealey
Closes #11674
This commit is contained in:
Daniel Stenberg 2023-08-15 09:16:54 +02:00
parent 9ec764ee1f
commit a281057091
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 85 additions and 49 deletions

View file

@ -94,7 +94,8 @@ anything outside the ASCII range.
.IP CURLU_PUNY2IDN
If set and asked to retrieve the \fBCURLUPART_HOST\fP or \fBCURLUPART_URL\fP
parts, libcurl returns the host name in its IDN (International Domain Name)
UTF-8 version if it otherwise is a punycode version.
UTF-8 version if it otherwise is a punycode version. If the punycode cannot be
converted to IDN correct, libcurl returns \fICURLUE_BAD_HOSTNAME\fP.
If libcurl is built without IDN capabilities, using this bit will make
\fIcurl_url_get(3)\fP return \fICURLUE_LACKS_IDN\fP if the host name is using