RFR: 8359709: java.net.HttpURLConnection sends unexpected "Host" request header in some cases after JDK-8344190 [v2]
Daniel Fuchs
dfuchs at openjdk.org
Tue Jun 17 14:14:29 UTC 2025
On Tue, 17 Jun 2025 13:49:28 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>>> So any unexpected requests from other processes would still allow this test to be unaffected by those requests.
>>
>> Yes, _this test_ will not be affected, but the other test _might_. Consider a test running in parallel, unexpectedly connecting to `HostHeaderTest`'s server, and it is
>>
>> 1. either not expecting a response at all
>> 2. or not expecting the response returned from the `HostHeaderTest`'s handler
>
> I've updated the PR to register the handler at a test specific context root. Having said that, I wasn't aware we were doing this in our tests.
We had some tests failing randmonly in the past because they got additional connections from other processes running on the same host (some time other tests). So now we tend to add a bit of salt in the path - it makes it easier to figure out that the strange things you see in the logs were not caused by a legit client. Also if you see 404 being returned and you know that your custom handler never returns 404 then it's easier to figure out that you somehow connected to some other server.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25844#discussion_r2152386282
More information about the net-dev
mailing list