Skip to content

idn: align AppleIDN behaviour with libidn2 - #14431

Closed
Bo98 wants to merge 2 commits into
curl:masterfrom
Bo98:appleidn-test-fixes
Closed

Bo98 wants to merge 2 commits into
curl:masterfrom
Bo98:appleidn-test-fixes

Conversation

@Bo98

@Bo98 Bo98 commented Aug 7, 2024 •

Copy link
Copy Markdown
Contributor
  • idn: support non-UTF-8 input under AppleIDN

The libcurl documentation states:

If libcurl is built with IDN support, the server name part of the URL can use an "international name" by using the current encoding (according to locale) or UTF-8 (when WinIDN is used; or a Windows Unicode build using libidn2).

https://curl.se/libcurl/c/CURLOPT_URL.html

AppleIDN was following the Windows behaviour of only using UTF-8. We can however use iconv here, which is shipped with macOS, to convert to UTF-8 and align the behaviour with libidn2.

This also in turn fixes test 1034 as the input is validated as a part of character encoding conversion.


  • idn: more strictly check AppleIDN errors

uidna_nameToASCII_UTF8 returns two error values. One largely covers fatal errors and other bad inputs, which we were currently checking. However there was a second error value that validates whether the output IDNA is valid to the spec.

Checking this better aligns the behaviour with that of libidn2 and fixes test 1035.


Ref: #14176

Bo98 added 2 commits August 7, 2024 03:22
This aligns the behaviour with libidn2 and the curl documentation.
UIDNA API returns two error values but we were only checking one.
Checking both better aligns the behaviour with that of libidn2.
@github-actions github-actions Bot added the tests label Aug 7, 2024
@vszakats vszakats added the appleOS specific to an Apple operating system label Aug 7, 2024
@bagder bagder closed this in a356878 Aug 7, 2024
bagder pushed a commit that referenced this pull request Aug 7, 2024
UIDNA API returns two error values but we were only checking one.
Checking both better aligns the behaviour with that of libidn2.

Closes #14431
@bagder

bagder commented Aug 7, 2024

Copy link
Copy Markdown
Member

Thanks!

@Bo98
Bo98 deleted the appleidn-test-fixes branch August 7, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appleOS specific to an Apple operating system tests

Development

Successfully merging this pull request may close these issues.

3 participants