Re: [PATCH/RFC] daemon.c: replace inet_ntop with getnameinfo
From: Benjamin Kramer <hidden>
Date: 2016-06-15 22:46:43
Johannes Sixt schrieb:
I don't particularly care about git-daemon on Windows at this time because we don't build it anyway. But others have already had limited success, and they might care since getnameinfo() is not available. If we did have IPv6 support on Windows, we would indeed have troubles with those path names.
The getnameinfo(3) code is in a #ifndef NO_IPV6 block anyways, so it won't hurt non-ipv6 builds. afaik getnameinfo(3) is available when getaddrinfo(3) is and that seems to be the case on newer windows versions.
But even on non-Windows, a directory name with colons does not look kosher to me. Don't they look like PATH values? Or like remote addresses? Are IPv6 addresses used in this way by other software? Moreover, I think that since IPv6 addresses can have at most one '::' abbreviation, but not in an unambiguous way, users of path-interpolation of IPv6 addresses are at the mercy of whether and how getnameinfo() makes use of '::'.
I did a quick test with apache's VirtualDocumentRootIP and it looks like they are using :: only when it's unambigous. And yes, they use colons in the file name. ::1 stays ::1 2001:db8::abab:abab:0:abab:abab becomes 2001:db8:0:abab:abab:0:abab:abab I don't know if they also use colons on windows because I don't have a windows box with IPv6 to test. -->8-->8-- httpd.conf: VirtualDocumentRootIP /foo/bar/%0 now point your browser to http://[::1]/ and watch your logs.