On Fri, 10 May 2024 10:00:57 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> Can I please get a review of this change which proposes to address >> https://bugs.openjdk.org/browse/JDK-8332020? >> >> `jwebserver` when it is launched prints a URL where the server is >> accessible. When launched using an IPv6 bind address, the printed URL >> doesn't enclose the IPv6 literal in `[` `]` thus rendering it in the form: >> >> URL http://0:0:0:0:0:0:0:1:8000/ >> >> This is an incorrect representation. As noted in RFC-2732 >> https://www.rfc-editor.org/rfc/rfc2732#section-2, the host literal is >> expected to be enclosed between `[` and `]`. >> >> The commit in this PR addresses that issues. A new jtreg test has been >> introduced to reproduce this issue and verify the fix. > > src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/SimpleFileServerImpl.java > line 185: > >> 183: >> writer.println(ResourceBundleHelper.getMessage("msg.start.anylocal", root, >> port, url)); >> 184: } else { >> 185: >> writer.println(ResourceBundleHelper.getMessage("msg.start.other", root, >> addr, port, url)); > > I would suggest simply adding '[' and ']' around the address in that case - > `addr = '[' + addr + ']';` which would allow to leave the resource bundle > unchanged. In addition to using that param value in the URL, that resource bundle message also uses it in another message: Serving /tmp/foo/ and subdirectories on 0:0:0:0:0:0:0:1 port 8000 If we change the `addr` being passed here to be `[` + addr + `]`, then this above message would be: Serving /tmp/foo/ and subdirectories on [0:0:0:0:0:0:0:1] port 8000 Is that fine? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19173#discussion_r1596556042