https://issues.apache.org/bugzilla/show_bug.cgi?id=56452

--- Comment #6 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to Konstantin Kolinko from comment #5)
> First, the above code has an error. The IPv4 address part can be longer by 4
> decimal digits than the one written above.

Aah, yes. Thanks for pointing that out.

> Second, I do not care on the actual implementation. I mentioned APR code as
> an example of their output.
> 
> The stackoverflow article mentioned INET6_ADDRSTRLEN constant, but I do not
> know whether that is portable.

On Linux, I can see them here:
$ grep 'INET\(6\)\?_ADDRSTRLEN' `find /usr/include -name "*.h"`
/usr/include/netinet/in.h:#define INET_ADDRSTRLEN 16
/usr/include/netinet/in.h:#define INET6_ADDRSTRLEN 46

Mac OS X has them in comparable locations:
$  grep 'INET\(6\)\?_ADDRSTRLEN' `find /usr/include -name "*.h"`
/usr/include/netinet/in.h:#define INET_ADDRSTRLEN                 16
/usr/include/netinet6/in6.h:#define    INET6_ADDRSTRLEN    46

The Linux mac page for inet_ntop mentions both INET_ADDRSTRLEN and
INET6_ADDRSTRLEN, and the "COMFORMING TO" section says POSIX.1-2001 with no
caveats about those constants. If we like POSIX.1-2001 then I think we're all
set.

I like the use of INET_ADDRSTRLEN better than the sizeof thing for some reason,
so I'll use that. Anyone with a problem can file a bug; it's easy to fix if
someone has an old system. I'll update the patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to