TCP tunneling through authenticating HTTP proxy
Vasiliy Baranov
vasiliy.baranov at oracle.com
Thu Oct 25 07:38:46 PDT 2012
On 25.10.2012 17:53, Michael McMahon wrote:
> There is a JSR for websockets, and they are doing a reference
> implementation
> based on JDK 7 I believe.
Yes, we are aware of that effort, that is JSR 356, but we are unlikely
to be able to make use of the implementation. First, it looks like their
client side APIs are not going to be included in Java EE 7. Second, the
scope of JSR 356 is Java EE, whereas we JavaFX ship with the JDK. Third,
we don't need WebSocket implementation per se. The WebSocket protocol is
already implemented in WebKit - the web browser engine that backs
WebView - and that implementation is shared by all WebKit-based browsers
including Chrome and Safari, which means we will probably want to stick
with it for a while. For what it is worth, we already have WebSockets
implemented in WebView, except for tunneling through authenticating
proxies. Finally, the WebKit's architecture for WebSockets is not very
pluggable, so even if we had WebSockets in JDK, it would be a major
undertaking to hack WebKit to use them.
> As regards TCP sockets via Http proxies, JDK doesn't support that.
> The closest thing is probably SOCKS. Can you use that?
WebView needs to support both HTTP and SOCKS proxies.
Thank you,
-- Vasiliy
> On 25/10/12 14:32, Vasiliy Baranov wrote:
>> Greetings,
>>
>> And apologies if I am sending this to the wrong list...
>>
>> Suppose I want my code to talk to a TCP server via an HTTP proxy, by
>> setting up a proxy tunnel using the CONNECT method. By any chance, is
>> there a mechanism in the Java SE networking stack that would allow me
>> to do so? A mechanism that would handle proxy selection, tunneling,
>> and, most importantly, authentication identically to HttpURLconnection?
>>
>> If there is no such mechanism in JDK 7, could such a mechanism be
>> added in JDK 8?
>>
>> FWIW, proxy selection and tunneling through non-authenticating proxy
>> is not too difficult to implement with ProxySelector and plain
>> Sockets, using
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect as a
>> reference. My code does so already.
>>
>> Proxy authentication, however, is a totally different story. If I
>> parse JDK code correctly, client code that does not use
>> HttpURLConnection is unlikely to be able to integrate nicely with the
>> AuthCacheValue cache or handle complex authentication schemes, unless
>> it chooses to depend on some JDK-internal APIs and duplicate great
>> amount of JDK code. My code probably cannot afford the latter two,
>> that is why I am asking for help here on this list. Since I have proxy
>> selection and non-authenticated tunneling already implemented, in my
>> case it would actually be sufficient to only have some JDK support for
>> proper integration with the AuthCacheValue cache and the standard
>> authentication schemes. However, I gather a more universal HTTP
>> tunneling facility, something that works like HttpURLConnection but
>> skips the final HTTP handshake with the end server, is likely to be a
>> cleaner solution.
>>
>> If it matters, I am asking this in the context of adding support for
>> WebSockets to JavaFX WebView:
>> http://javafx-jira.kenai.com/browse/RT-14947
>>
>> Thank you in advance,
>> -- Vasiliy
>
More information about the net-dev
mailing list