8328894: HttpResponse.body() returns null with https target and failed proxy authentication

Jaikiran Pai jaikiran.pai at oracle.com
Mon Nov 10 11:58:13 UTC 2025


Hello Hyunsu,

I haven't had a chance to take that one to completion. It looks like you 
have experimented with the issue as well as a fix. So yes, please go 
ahead and propose the PR (you'll have to sign the OCA first if you 
haven't already).

-Jaikiran

On 08/11/25 6:38 pm, Hyunsu Eun wrote:
> Hi,
>
> I noticed JDK-8328894 [1] has been open since March 2024 and would like
> to help if possible.
>
> I've analyzed the issue and created a potential fix that preserves the proxy
> response body for 407 authentication errors in HTTPS tunneling.
>
> The fix:
> - Changes CONNECT exchange from MultiExchange<Void> to MultiExchange<byte[]>
> - Caches the proxy response body and returns it through Exchange.readBodyAsync()
> - Adds a test case (ProxyAuthHttpsTest.java) to verify the behavior
>
> The root cause is that HTTPS uses CONNECT tunneling with a Void body type,
> and the 407 response body was being discarded via ignoreBody() instead of
> being preserved for the application.
>
> I've tested this locally and confirmed it addresses the issue:
> - Before: https:// with 407 returns null body
> - After: https:// with 407 returns body correctly (matching http:// behavior)
>
> I'd be happy to submit a PR or share more details about the approach if helpful.
>
> Thanks,
> Hyunsu Eun
>
> [1] https://bugs.openjdk.org/browse/JDK-8328894


More information about the net-dev mailing list