idn: add native AppleIDN (icucore) support for macOS/iOS

I implemented the IDN functions for macOS and iOS using Unicode
libraries coming with macOS and iOS.

Builds and runs here on macOS 14.2.1. Also verified to load and
run on older macOS version 10.13.

Build requires macOS SDK 13 or equivalent.

Set `-DUSE_APPLE_IDN=ON` CMake option to enable it.
With autotools and other build tools, set these manual options:
```
CPPFLAGS=-DUSE_APPLE_IDN
LIBS=-licucore
```

Completes TODO 1.6.

TODO: add autotools option and feature-detection.

Refs: #5330 #5371
Co-authored-by: Viktor Szakats
Closes #13246
This commit is contained in:
MonkeybreadSoftware 2024-03-31 11:55:27 +02:00 committed by Viktor Szakats
parent 08d10d2a00
commit add22feeef
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 92 additions and 19 deletions

View file

@ -22,7 +22,6 @@
1.3 struct lifreq
1.4 Better and more sharing
1.5 get rid of PATH_MAX
1.6 native IDN support on macOS
1.8 CURLOPT_RESOLVE for any port number
1.9 Cache negative name resolves
1.10 auto-detect proxy
@ -251,16 +250,6 @@
there we need libssh2 to properly tell us when we pass in a too small buffer
and its current API (as of libssh2 1.2.7) does not.
1.6 native IDN support on macOS
On recent macOS versions, the getaddrinfo() function itself has built-in IDN
support. By setting the AI_CANONNAME flag, the function will return the
encoded name in the ai_canonname struct field in the returned information.
This could be used by curl on macOS when built without a separate IDN library
and an IDN host name is used in a URL.
See initial work in https://github.com/curl/curl/pull/5371
1.8 CURLOPT_RESOLVE for any port number
This option allows applications to set a replacement IP address for a given