Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idn: align AppleIDN behaviour with libidn2 #14431

Closed
wants to merge 2 commits into from

Conversation

Bo98
Copy link
Contributor

@Bo98 Bo98 commented Aug 7, 2024

  • 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

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
Copy link
Member

bagder commented Aug 7, 2024

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