hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Hunsley <alex.huns...@blueyonder.co.uk>
Subject does HttpClient transparently send proxy auth after getting HTTP 403 code?
Date Thu, 27 May 2004 10:27:49 GMT
I hope this is an approriate list for this question, if not, please 
accept my apologies!


I'm running HttpClient 2.0 with j2sdk1.4.2_03.

I'm using HttpClient to access web pages via an http proxy server that 
needs basic proxy authorization (note: it's the *proxy* that needs auth, 
not the end-target web server. I add this because I have got confused 
myself sometimes over this!) I'm debugging my HttpClient-using code by 
pointing it at a local proxy (I'm running 'Charles') and from this I can 
see that my request is *not* providing proxy authorization information. 
If, however, I call:

   httpClient.getState().setAuthenticationPreemptive(true);

to enable pre-emptive authorization, my test proxy does receive the 
authorization. I had no idea that the preeptive authorization also 
applies to the proxy authorization as the docs don't make this clear 
(and if this is indeed the case, a clarification in the docs might be 
handy).

My main question is: if I don't call setAuthenticationPreemptive(true), 
and if HttpClient tries to use a proxy and receives an HTTP 403 (proxy 
auth required) message back, will it transparently then give the proxy 
auth that I have set, or will it just give me the 403 code it received? 
As far as I can see, it is just giving me the 403 code back, so I don't 
understand why it doesn't just always give the proxy auth up front as a 
matter of convenience!

I hope someone can clarify this and thanks for reading!

alex


p.s. I have had no luck at all finding a simple proxy that is runnable 
under cygwin or windows that will let me enable basic proxy 
authorization so I can test this. All I know that is my proxy 
authorization wasn't working in a client's office - I was getting HTTP 
403 - despite me setting the proxy auth in my request (but not putting 
.setAuthenticationPreemptive(true)).




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


Mime
View raw message