You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Matthew Beermann <ma...@nanonation.net> on 2004/08/13 23:45:17 UTC

[HttpClient] Problems with PUT and NTLM

I'm trying to do a PUT with NTLM turned on, and it fails on a 500 error from the server, which in turn causes the console to report a "Unbuffered entity enclosing request can not be repeated" error. Other commands though, like PROPFIND and MKCOL, go through the authentication steps and work perfectly. I've attached a log showing the client/server conversation.

OlegK suggested that I should activate the expect-continue handshake on the HttpClient, which might fix my problems, but I'm afraid I cannot figure out for the life of me how to do so. I should mention that I'm working with HttpClient through Slide, and as such, I'm not interfacing with HttpClient directly. (Which is to say, the Slide library is creating PutMethod instances, not me.)

--Matthew Beermann

Re: [HttpClient] Problems with PUT and NTLM

Posted by Oleg Kalnichevski <ol...@bluewin.ch>.
   client.getState().setAuthenticationPreemptive(false);
>    System.out.println(client.getState().isAuthenticationPreemptive());
> 
> ...and got back "true", which confuses me completely. Does this not work the 
> way I think it does? I'd really like to ditch the wasted Basic: attempts.

Matthew,

Certainly this is not the way it is meant to be

I am not sure if [Slide] uses a stock version of HttpClient or a forked
one, but I know for a fact that in the stock version the preemptive
authentication is disabled per default. When not explicitly turned on
the preemptive authentication is not used 

Moreover, here's the verbatim copy of the
HttpState#*AuthenticationPreemptive methods implementation. 

    public void setAuthenticationPreemptive(boolean value) {
        this.preemptive = value;
    }


    public boolean isAuthenticationPreemptive() {
        return this.preemptive;
    }

I just do not see how what you are saying is possible if the source code
has not been tampered with. 

Try replacing the jar that comes with [Slide] with the latest stable
release of HttpClient (version 2.0.1 as of writing) and see if that
makes any difference

Oleg


On Mon, 2004-08-16 at 22:02, Matthew Beermann wrote:
> A full log is attached. Turning on the expect-continue handshake does indeed 
> solve the problem (as seen in log #2). However, I still have a question 
> after looking at the logs: I tried putting these two lines one right after 
> the other:
> 
>    client.getState().setAuthenticationPreemptive(false);
>    System.out.println(client.getState().isAuthenticationPreemptive());
> 
> ...and got back "true", which confuses me completely. Does this not work the 
> way I think it does? I'd really like to ditch the wasted Basic: attempts.
> 
> --Matthew Beermann
> 
> ----- Original Message ----- 
> From: "Oleg Kalnichevski" <ol...@bluewin.ch>
> To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
> Sent: Friday, August 13, 2004 5:11 PM
> Subject: Re: [HttpClient] Problems with PUT and NTLM
> 
> 
> > Matthew,
> >
> > I missed the fact that the server reported a 500 error, which actually
> > indicates an internal server error rather than an authentication error.
> > Still, the 'expect-continue' handshake may be worth a try
> >
> > If Slide exposes the underlying HTTP PUT method you can activate the
> > 'expect-continue' handshake by calling
> >
> > httpput.setUseExpectHeader(true);
> >
> > For details see
> >
> > http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/ExpectContinueMethod.html#setUseExpectHeader(boolean)
> >
> > You may also consider testing that HTTP PUT method using just plain
> > HttpClient with the wirelog turned on in order to get more details on
> > what is going on under the hood
> >
> > http://jakarta.apache.org/commons/httpclient/logging.html
> >
> > Hope this helps
> >
> > Oleg
> >
> >
> > On Fri, 2004-08-13 at 23:45, Matthew Beermann wrote:
> >> I'm trying to do a PUT with NTLM turned on, and it fails on a 500
> >> error from the server, which in turn causes the console to report a
> >> "Unbuffered entity enclosing request can not be repeated" error. Other
> >> commands though, like PROPFIND and MKCOL, go through the
> >> authentication steps and work perfectly. I've attached a log showing
> >> the client/server conversation.
> >>
> >> OlegK suggested that I should activate the expect-continue handshake
> >> on the HttpClient, which might fix my problems, but I'm afraid I
> >> cannot figure out for the life of me how to do so. I should mention
> >> that I'm working with HttpClient through Slide, and as such, I'm not
> >> interfacing with HttpClient directly. (Which is to say, the Slide
> >> library is creating PutMethod instances, not me.)
> >>
> >> --Matthew Beermann
> >>
> >> ______________________________________________________________________
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> > 
> 
> ______________________________________________________________________
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


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


Re: [HttpClient] Problems with PUT and NTLM

Posted by Matthew Beermann <ma...@nanonation.net>.
A full log is attached. Turning on the expect-continue handshake does indeed 
solve the problem (as seen in log #2). However, I still have a question 
after looking at the logs: I tried putting these two lines one right after 
the other:

   client.getState().setAuthenticationPreemptive(false);
   System.out.println(client.getState().isAuthenticationPreemptive());

...and got back "true", which confuses me completely. Does this not work the 
way I think it does? I'd really like to ditch the wasted Basic: attempts.

--Matthew Beermann

----- Original Message ----- 
From: "Oleg Kalnichevski" <ol...@bluewin.ch>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Friday, August 13, 2004 5:11 PM
Subject: Re: [HttpClient] Problems with PUT and NTLM


> Matthew,
>
> I missed the fact that the server reported a 500 error, which actually
> indicates an internal server error rather than an authentication error.
> Still, the 'expect-continue' handshake may be worth a try
>
> If Slide exposes the underlying HTTP PUT method you can activate the
> 'expect-continue' handshake by calling
>
> httpput.setUseExpectHeader(true);
>
> For details see
>
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/ExpectContinueMethod.html#setUseExpectHeader(boolean)
>
> You may also consider testing that HTTP PUT method using just plain
> HttpClient with the wirelog turned on in order to get more details on
> what is going on under the hood
>
> http://jakarta.apache.org/commons/httpclient/logging.html
>
> Hope this helps
>
> Oleg
>
>
> On Fri, 2004-08-13 at 23:45, Matthew Beermann wrote:
>> I'm trying to do a PUT with NTLM turned on, and it fails on a 500
>> error from the server, which in turn causes the console to report a
>> "Unbuffered entity enclosing request can not be repeated" error. Other
>> commands though, like PROPFIND and MKCOL, go through the
>> authentication steps and work perfectly. I've attached a log showing
>> the client/server conversation.
>>
>> OlegK suggested that I should activate the expect-continue handshake
>> on the HttpClient, which might fix my problems, but I'm afraid I
>> cannot figure out for the life of me how to do so. I should mention
>> that I'm working with HttpClient through Slide, and as such, I'm not
>> interfacing with HttpClient directly. (Which is to say, the Slide
>> library is creating PutMethod instances, not me.)
>>
>> --Matthew Beermann
>>
>> ______________________________________________________________________
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
> 

Re: [HttpClient] Problems with PUT and NTLM

Posted by Oleg Kalnichevski <ol...@bluewin.ch>.
Matthew,

I missed the fact that the server reported a 500 error, which actually
indicates an internal server error rather than an authentication error.
Still, the 'expect-continue' handshake may be worth a try

If Slide exposes the underlying HTTP PUT method you can activate the
'expect-continue' handshake by calling 

httpput.setUseExpectHeader(true);

For details see

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/ExpectContinueMethod.html#setUseExpectHeader(boolean)

You may also consider testing that HTTP PUT method using just plain
HttpClient with the wirelog turned on in order to get more details on
what is going on under the hood

http://jakarta.apache.org/commons/httpclient/logging.html

Hope this helps

Oleg


On Fri, 2004-08-13 at 23:45, Matthew Beermann wrote:
> I'm trying to do a PUT with NTLM turned on, and it fails on a 500
> error from the server, which in turn causes the console to report a
> "Unbuffered entity enclosing request can not be repeated" error. Other
> commands though, like PROPFIND and MKCOL, go through the
> authentication steps and work perfectly. I've attached a log showing
> the client/server conversation.
>  
> OlegK suggested that I should activate the expect-continue handshake
> on the HttpClient, which might fix my problems, but I'm afraid I
> cannot figure out for the life of me how to do so. I should mention
> that I'm working with HttpClient through Slide, and as such, I'm not
> interfacing with HttpClient directly. (Which is to say, the Slide
> library is creating PutMethod instances, not me.)
>  
> --Matthew Beermann
> 
> ______________________________________________________________________
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


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