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

network doesn't work with unicode hostname #126

Open
vincenthz opened this issue Apr 3, 2014 · 1 comment
Open

network doesn't work with unicode hostname #126

vincenthz opened this issue Apr 3, 2014 · 1 comment

Comments

@vincenthz
Copy link

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.

@vdukhovni
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants