Skip to content

Make Unix.{getaddrinfo,getnameinfo} Unicode-aware on Windows#1454

Closed
nojb wants to merge 3 commits intoocaml:trunkfrom
nojb:hostnames_unicode_windows
Closed

Make Unix.{getaddrinfo,getnameinfo} Unicode-aware on Windows#1454
nojb wants to merge 3 commits intoocaml:trunkfrom
nojb:hostnames_unicode_windows

Conversation

@nojb
Copy link
Copy Markdown
Contributor

@nojb nojb commented Oct 27, 2017

Unicode host names anyone?

@damiendoligez damiendoligez added this to the 4.07-or-later milestone Nov 2, 2017
Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks OK to me but I had a rather quick look at it, so it would be good to have a second pair of eyes.

Also, I am still not convinced that Internationalized domain names are a good idea, with all the spoofing they enable.

@hannesm
Copy link
Copy Markdown
Member

hannesm commented Nov 26, 2017

I'm a bit sceptical.

Portability: While GetAddrInfoW is supported on Windows, there is also an extension (via the AI_IDN flag and more flags) for GNU/Linux (but there is no POSIX extension for this - i.e. no way to do this (with libc only) on FreeBSD/OpenBSD/MacOSX). What C applications usually do is to link against libidn (which I do not suggest the OCaml runtime to do).

This means this PR will introduce divergent behaviour between platforms. I'd instead document that IDNs are not supported in the stdlib. There exists an (unreleased) library which does the punycode conversion in pure OCaml. Doing this depends on a unicode library, thus it is not suitable for the stdlib IIUC.

OTOH, if divergence between platforms is not an issue, surely this is ok.

@pmetzger
Copy link
Copy Markdown
Member

IDN stuff needs to be considered very, very carefully when it is integrated because of the security issues that have been mentioned.

I note that OCaml's own unicode support is not yet quite complete, which makes it harder to figure out a good solution that works for all of OCaml's platforms.

@nojb
Copy link
Copy Markdown
Contributor Author

nojb commented Nov 27, 2017

@hannesm I was not aware of the AI_IDN flag for GNU/Linux and the divergence this PR would introduce, thanks for bringing it to my attention.

Technically speaking the divergence is already there today, because it is possible to use Latin-1 (or local code page encoded) hostnames under Windows but only ASCII under Linux (if I understand correctly).

I do not have a strong argument for merging apart from coherence with the rest of the win32unix library which has been shifted from code page encoding to UTF-8. I do not understand all the security implications of merging this at the moment, so I will happily follow the lead of anyone who does.

@nojb
Copy link
Copy Markdown
Contributor Author

nojb commented Mar 16, 2018

There does not seem to be a consensus for merging this PR, so closing for now. Can always be reopened if needed.

@nojb nojb closed this Mar 16, 2018
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants