hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastiaan van Erk <sebs...@sebster.com>
Subject Re: httptunnel client 4.0 alpha 3 and preemtive authentication
Date Wed, 02 Apr 2008 19:04:52 GMT
Hi Oleg,

Thanks for the reply, I figured as much.

I prefer to use expect/continue, which I actually do when the proxy 
supports it, but in some cases unfortunately it doesn't and I must fall 
back to preemptive.

What does seem strange to me is that HttpClient *does* retry the request 
with the authentication header, as it seems to me that it is impossible 
if the entity is not repeatable and some data is already sent. An 
exception might be better?


Oleg Kalnichevski wrote:
> Sebastiaan van Erk wrote:
>> Hi,
>> I'm trying to use preemptive authentication because I have a 
>> non-repeatable (dyanimc) request entity. Currently when posting, this 
>> goes wrong because I get a 401 Unauthorized but it has already sent 
>> some of the data, and when it tries again with the basic 
>> authentication credentials the post fails... (I've implemented the 
>> writeTo(OutputStream) method on the Entity). I'm wondering by the way 
>> how it can even do the request again because isRepeatable on the 
>> entity returns false...
>> I construct my http client as follows:
>> final HttpParams httpParams = new BasicHttpParams();
>> HttpClientParams.setAuthenticationPreemptive(httpParams, true);
>> final DefaultHttpClient httpClient = new DefaultHttpClient(httpParams);
>> I searched the source for references to the 
>> ClientPNames.PREEMPTIVE_AUTHENTICATION constant, but I couldn't find 
>> any, so I'm wondering, is preemptive authentication implemented in 4.0 
>> alpha 3 yet? 
> Sebastiaan,
> There is no support for preemptive authentication at the moment. 
> Anyways, you'll be _much_ better off using the 'expect-continue' 
> handshake or making sure your entity is repeatable.
> Hope this helps
> Oleg
> Or am I doing something wrong?
>> Regards,
>> Sebastiaan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message