Thanks John!  So from this configuration it looks like there is no way to 
control socks proxy setting on a per request basis through HttpClient?  We have 
a scenario where we let users give proxy configuration information to our 
system, and we in turn make an HTTP request on their behalf, therefore we can't 
make a system-wide property setting since we don't know what proxies the user 
will provide.

Previously in the JDK implementation we were doing:

    Proxy.Type type;
    String scheme = # User input;
    if (scheme != null && scheme.equalsIgnoreCase("socks")) {
      type = Proxy.Type.SOCKS;
    } else {
      type = Proxy.Type.HTTP;
    }

    String host = # User input
    int port = # User input

    InetSocketAddress address = new InetSocketAddress(host, port);
    return new Proxy(type, address);

Then pass that proxy into the httpurlconnection for URI:

    URL u = new URL("http://www.somewhere.com/hidden";);
    HttpURLConnection ucon = (HttpURLConnection) u.openConnection(p);


Now it appears we don't have that option in HttpClient?

Thanks again for the help!

--Josh




________________________________
From: John Smith <[email protected]>
To: HttpClient User Discussion <[email protected]>
Sent: Tue, April 20, 2010 11:44:23 AM
Subject: Re: Fw: SOCKS proxy example??

"Transparent connections through SOCKS proxies (version 4 & 5) using
native Java socket support"

Please look at  this - http://hc.apache.org/httpclient-3.x/features.html

You should use something lake that -

System.setProperty("socksProxySet", "false");
System.setProperty("socksProxyHost", "localhost");
System.setProperty("socksProxyPort", "1080");

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to