cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Connection getting closed on receiving 401 from server during POST

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 13 Jun 2014 23:54:55 +0200 (CEST)

On Thu, 12 Jun 2014, Vivek S wrote:

> When using libcurl to do POST, connection is closed by it when seeing 401
> from the server. Am seeing "HTTP error before end of send, stop sending"
> logs at these times.

Yes, it does this for all HTTP errors actually since when it knows it already
is failing it is only a waste of bandwidth to keep on sending data. (Unless it
is very little data left to send.)

The exception to this rule is for when it needs to keep the connection
alive...

> This is making NTLM handshakes to fail always as it needs single connection
> to work properly.

Yes, and that's why libcurl has NTLM implemented so that it can handle all the
funny weird exceptions to ordinary HTTP that NTLM requires. libcurl basically
does not really allow you do do NTLM externally.

> We are not using curl's NTLM option but doing it by adding Authorization
> headers ourselves for some reason. It works fine when using curl's NTLM
> option and setting user/password details.

So can you elaborate on why using libcurl's own NTLM powers isn't enough?

> Everything works fine with curl-7.20.1 which we used earlier.

I guess we added this "optimization" after that version then!

> I would like to know whether I need to set some flags to avoid this or this
> is some bug in libcurl.

Neither. To get back the old behavior you either have to remove this feature
or add another option. But first you need to convince us/me that there's truly
a need and good motivation for going down this road.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-13