hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Claassen <mclaas...@ocie.net>
Subject HttpClient, SOCKS proxy, and webstart
Date Fri, 19 Jan 2007 15:44:44 GMT
I have been having some trouble with HttpClient and the SOCKS proxy.  My
path to where I am now is a long and sorted tale, so here is my summary:

Webstart gets its proxy settings from the Windows default browser

Have IE 7 be the default browser and set the proxy manually for all
protocols (including SOCKS)
Run a webstart program that connects to anywhere ("http://java.sun.com" for
instance)

java.net.SocketException: Reply from SOCKS server has bad version
        at java.net.SocksSocketImpl.connectV4(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSo
cket(Unknown Source)

Now, in IE 7, check the box in the proxy settings to "Use same proxy for all
protocols"
This will actually cause IE to *clear* the SOCKS proxy box and the webstart
program will work.

Firefox, on the other hand, does not clear the SOCKS field when the
analogous check box is checked, cause HttpClient to fail to connect as
above.  This is the real problem and how I discovered it.  Since I use
Firefox, when I tested my Proxy, HttpClient failed...in a way it would not
have if I was using IE.  (I am assuming that most users will just check the
"Use same proxy for all protocols" in both browsers.)

I am not sure if this is a bug in Firefox, in the default SocketFactory, or
in HttpClient.  What I want to know is how to work around this.  I really
like HttpClient, but I am starting to get worried that as Firefox takes off
more and more, this is going to bite me.

P.S. 
HttpURLConnection seems to create its sockets from sun.net.NetworkClient and
not a SocketFactory, which apparently makes it immune to this problem


Thanks,
Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message