On Tue, 2011-09-06 at 14:29 -0700, Patrick Lightbody wrote:
> I read the docs + examples for preemptive basic auth, but it still doesn't 
> look to be working. I started debugging the code and I'm actually not sure 
> how it could work. Please let me know if I'm misunderstanding how the 
> internals of HttpClient works, but here's what I observed:
> 
>  * RequestTargetAuthentication is responsible for adding the auth headers
>  * RequestTargetAuthentication looks for an AuthState object that has 
> non-null scheme & creds objects that are used for the header
>  * DefaultRequestDirector creates an empty AuthState object on each new 
> request (targetAuthState field)
>  * DefaultRequestDirector only updates the targetAuthState fields after it 
> makes an initial request that returns a 401
> 
> So what I'm finding in my debugging is that even though I've set up my 
> CredentialsProvider with the correct authScope + UsernamePasswordCredentials 
> and that I've set my HttpContext (global or local, doesn't matter) with the 
> proper AuthCache + BasicScheme, I still end up with two queries: 401 and then 
> finally a 200.  In other words, it doesn't seem to be preemptive.
> 
> Any idea what I might be doing wrong? Or maybe I'm just misunderstanding how 
> DefaultRequestDirector does it's loop inside execute()?
> 
> Patrick
> 


If you turn of context logging you should be able to see whether or not
the cached auth scheme is being re-used.

Oleg


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

Reply via email to