8328894: HttpResponse.body() returns null with https target and failed proxy authentication
Hyunsu Eun
ehs122100 at gmail.com
Sat Nov 8 13:08:59 UTC 2025
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