commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <be...@u.washington.edu>
Subject Re: [HttpClient] - testing issues with proxies
Date Wed, 13 Aug 2003 23:38:08 GMT
Hi Peter,

Please see my responses below.

On Wednesday, August 13, 2003, at 03:18 PM, Peter wrote:

> I just got started with HttpClient yesterday.  I am using it so I can 
> add
> proxy support to my client application.
>
> I installed HttpClient and ezProxy on my machine and I am able to
> successfully send/recieve http through ezProxy using HttpClient.  
> Sweet!

Good, I'm glad it's working.

> However, I am anticipating the following problems:
>
> 1) I don't have an adequate environment to test the various proxies and
> thier configurations.  Are there any proxies online that can be used 
> for
> testing?  Wishful thinking I know, but just thought I'd ask. ezProxy 
> is not
> going to cut it.

There aren't any that I know of.  Most HTTP proxies should be pretty 
similar.  The area where most people have trouble seems to be with 
proxy authentication.  I would suggest testing with basic, digest and 
NTLM authentication if you will be seeing that "in the field".  There 
are a number of free proxies that you can test with.  Squid and Apache 
to name just a few.

> 2) My application will allow the user to define the proxy and port to 
> use,
> either socks or HTTP proxy.  I am not going to store the proxy
> userid/password.  I'll have the user enter the credentials if I get a 
> 407
> response and display my own userid/password dialog at that time.  This 
> seems
> fine, but when I read about the NTLM protocol it looks like I'm going 
> to a
> 407 twice from the proxy.  I guess I just ignore the second one, but 
> the
> lack of a testing environment puts the pressure on to get this exactly
> right.

Just to note, SOCKS proxies are handled natively by Java inside of 
java.net.Socket.  HttpClient only adds support for HTTP proxies.  
Setting a socks proxy via HostConfiguration.setProxy() will not work.  
Take a look at 
<http://java.sun.com/j2se/1.4.1/docs/guide/net/properties.html> for the 
System properties that are required for SOCKS support.

Even when using NTLM the 407 status should only be returned once.  The 
second request attempt will be handled internally by HttpClient.  The 
one big difference here is that NTLM authentication requires a 
different set of credentials, NTCredentials instead of 
UsernamePasswordCredentials.  I haven't tried, this but reportedly 
there are modules to add NTLM authentication to the Squid proxy.  This 
should provide you with a free avenue for testing.

> 3) What is the response code if the proxy authentication fails?

I believe you will continue to get 
SC_PROXY_AUTHENTICATION_REQUIRED(407).

Please take at look at the authentication guide 
<http://jakarta.apache.org/commons/httpclient/authentication.html> for 
more detail.  If you come across any areas that need enhancement or 
clarification we always appreciate documentation submissions :)

Thanks,

Mike


Mime
View raw message