RFR: 8368157: DefaultProxySelector should handle ws/wss protocol like the http/https protocol
EunHyunsu
duke at openjdk.org
Tue Feb 24 09:10:36 UTC 2026
On Mon, 23 Feb 2026 16:57:51 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> DefaultProxySelector.select() returns DIRECT for ws/wss URIs even when proxy properties are set. Since WebSocket tunnels over HTTP/HTTPS, ws/wss should use the same proxy settings.
>>
>> This normalizes ws to http and wss to https at the top of select(), matching what OpeningHandshake already does internally. Same fix applied to ProxySelector.of(). Javadoc and net-properties.html updated.
>
> Hi, I do not understand what problem this PR is trying to solve. The code that makes the underlying HTTP request to obtain a ws/wss connection should be responsible for obtaining an HTTP proxy for that request. That's what the java.net.http implementation of websocket does, and I do not see a need for modifying the default proxy selector.
Hi @dfuch ,
Thanks for the feedback. The issue was already filed so I assumed it was a valid problem to fix, but I didn't look closely enough at the existing code. After your comment I checked OpeningHandshake.proxyFor() and see that it already converts ws/wss to http/https before calling select().
Tomcat, Tyrus, OkHttp also all do the same conversion on the caller side.
so this is the intended pattern, not a gap. Should I close this?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29882#issuecomment-3950209493
More information about the net-dev
mailing list