hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erxiang Liu <erxi...@us.ibm.com>
Subject quesiton for socks proxy and secure proxy support
Date Wed, 14 Mar 2007 19:25:11 GMT


we are looking at the proxy support in apache client and here is my
understanding of what the user client needs to do:

1. http/https proxy
client.getHostConfiguration().setProxy(hostName, port);

2. reverse proxy
nothing needs to do in the http client code since it is transparent.

3. socks proxy
nothing if according to what Roland mentioned below"SOCKS connections are
to HttpClient", then how do you know it is using socks proxy or a direct

4. secure proxy(basic auth)
client.getState().setProxyCredentials(new AuthScope(hostName,port), new
UsernamePasswordCredentials(user, password));

5. secure proxy(NTLM auth)
client.getState().setProxyCredentials(new AuthScope(hostName,port), new
NTCredentials(NTuser, NTpassword,hostName, domain));

The wield thing is if I do
client.getState().setProxyCredentials(new AuthScope(hostName,port), new
UsernamePasswordCredentials(NTUser, NTpassword));
client.getState().setProxyCredentials(new AuthScope(hostName,port), new
NTCredentials(user, password,hostName, domain));
they both work fine. why?

thanks  a lot,


             Roland Weber                                                  
             so.net>                                                    To 
                                       HttpClient User Discussion          
             11/21/2006 11:06          <httpclient-user@jakarta.apache.org 
             AM                        >                                   
             Please respond to                                     Subject 
             "HttpClient User          Re: Does Apache support socks proxy 
                Discussion"            and reverse proxy?                  

Hello Michelle,

> Seems  essentially we call the same API setProxy for both http proxy and
> socks proxy server
> (except  HTTP  take precedence over SOCKS settings, ie.  you call
> setProxy(httpServerHost, httpServerPort)
> when both http and socks proxy are there) . sounds right to you?

No, that is wrong. If you want to use a SOCKS proxy, you follow the
instructions in the JDK documentation. SOCKS connections are transparent
to HttpClient. If you want to use an HTTP proxy, you follow the
instructions in the HttpClient documentation, because HttpClient needs
to know about it. HTTP proxy connections are NOT transparent, the request
to an HTTP proxy looks slightly different from a direct request to a

hope that helps,

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

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message