RFR: 8332020: jwebserver tool prints invalid URL in case of IPv6 address binding
Daniel Fuchs
dfuchs at openjdk.org
Fri May 10 10:19:41 UTC 2024
On Fri, 10 May 2024 10:05:07 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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?
Oh - I see... Hmmm - good question. I'd say it should be OK, since it's only a log message.
My concern here is potentially backporting this change - where we would need to make sure that all resource bundles in all possible languages that are supported are correctly updated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19173#discussion_r1596565247
More information about the net-dev
mailing list