You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As network doesn't encode to punycode it fail when trying to connect to a hostname that contains unicode character.
The main problem is using withCString which would truncate all unicode code point to 256 bits,
and peekCString when reading which would return a punycode encoded string to hostname. One crappy workaround is to encode/decode with a 3rd party library and have a Hostname -> Hostname function but we get no type safety, and it force everyone to know about the issue and deal with it in it own library.
Any opinion on the best way to fix this issue ? I would personally prefer Hostname to be a newtype and have everything available to be able to get the punycode decoder/encoder bytes available for libraries too.
The text was updated successfully, but these errors were encountered:
For the record, it takes a bit more than just a punycode encoder/decoder to do IDNA2008 correctly. I am curating a private version of the rather dated idna-hs package for some of my projects, it implements IDNA2003, which is obsolete, and IIRC I fixed one or two minor issues. That said, is getaddrinfo() actually expected to resolve U-labels? Mapping of user input to valid U-labels is a tricky business, and is perhaps best left to applications, that should hand A-label forms to the Network and TLS libraries (e.g. SNI in TLS and DNS-ID in certificates are in A-label form).
As network doesn't encode to punycode it fail when trying to connect to a hostname that contains unicode character.
The main problem is using withCString which would truncate all unicode code point to 256 bits,
and peekCString when reading which would return a punycode encoded string to hostname. One crappy workaround is to encode/decode with a 3rd party library and have a Hostname -> Hostname function but we get no type safety, and it force everyone to know about the issue and deal with it in it own library.
Any opinion on the best way to fix this issue ? I would personally prefer Hostname to be a newtype and have everything available to be able to get the punycode decoder/encoder bytes available for libraries too.
The text was updated successfully, but these errors were encountered: