cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Infinite loop using libcurl with NTLM

From: Paras S <livetestid_at_live.in>
Date: Wed, 26 Sep 2012 18:46:30 +0530

>> I am using libcurl 7.24, with OpenSSL 1.0.0g.

> Did you check if the problem persists in 7.27.0?

Yes, the problem persists in 7.27.0.

>> curl gets stuck in this loop, and does not honor the timeout set
>> for CURLOPT_TIMEOUT.

> Ouch. Assuming this bug is still present, we should convert your test scenario
> into a curl test case so that we can repeat it and then fix it. Any chance you
> can give it a shot?

I have run the program in verbose mode, here is the output:

> POST --- HTTP/1.1
Host: ---
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml; charset=utf-8
Content-Length: 5894
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Cache-Control: private, max-age=0
< Content-Type: text/xml; charset=utf-8
< Content-Encoding: gzip
< Vary: Accept-Encoding
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Wed, 26 Sep 2012 12:39:31 GMT
< Content-Length: 865
<
* Connection #0 to host (nil) left intact
* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (---) port 443 (#0)
* Server auth using NTLM with user '---'
> POST --- HTTP/1.1
Host: ---
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml; charset=utf-8
User-Agent: CloudMagic/2.1
Content-Length: 4856
Expect: 100-continue

< HTTP/1.1 100 Continue

(After about 2 minutes...)

< HTTP/1.1 302 Found
< Cache-Control: private, max-age=0
< Content-Length: 187
< Content-Type: text/xml; charset=utf-8
< Location: ---
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Wed, 26 Sep 2012 12:41:29 GMT
* HTTP error before end of send, stop sending
<
* Closing connection #0
* Issue another request to this URL: 'https://------'
* Violate RFC 2616/10.3.3 and switch from POST to GET
* About to connect() to --- port 443 (#0)
* Trying ---...
* connected
* Connected to --- (---) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using AES128-SHA
* Server certificate:
* subject: C=US; ST=Colorado; L=Colorado Springs; O=Perimeter eSecurity; CN=---
* start date: 2012-08
* expire date: 2014-08
* issuer: C=US; O
* SSL certificate verify ok.
> GET --- HTTP/1.1
Host: ---
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml; charset=utf-8
Content-Length: 4856

< HTTP/1.1 401 Unauthorized
< Server: Microsoft-IIS/7.5
< WWW-Authenticate: Negotiate
< WWW-Authenticate: NTLM
< X-Powered-By: ASP.NET
< Date: Wed, 26 Sep 2012 12:41:30 GMT
< Content-Length: 0
<
* Connection #0 to host --- left intact
* Issue another request to this URL: '---'
* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (---) port 443 (#0)
* Server auth using NTLM with user '---'
> GET --- HTTP/1.1
Authorization: NTLM ---
Host: ---
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml; charset=utf-8
Content-Length: 4856

The following happens in an infinite loop. Each loop lasts for about 2 minutes.

* SSL read: error:00000000:lib(0):func(0):reason(0), errno 104
* Connection died, retrying a fresh connect
* Closing connection #0
* Issue another request to this URL: '---'
* About to connect() to --- port 443 (#0)
* Trying ---...
* connected
* Connected to --- (---) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using AES128-SHA
* Server certificate:
* subject: C=US; ST=Colorado; L=Colorado Springs; O=Perimeter eSecurity; CN=---
* start date: 2012-08
* expire date: 2014-08
* issuer: C=US; O
* SSL certificate verify ok.
* Server auth using NTLM with user '---'
> GET --- HTTP/1.1
Authorization: NTLM ---
Host: ---
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml; charset=utf-8
Content-Length: 4856

< HTTP/1.1 401 Unauthorized
< Server: Microsoft-IIS/7.5
< WWW-Authenticate: NTLM ---
< WWW-Authenticate: Negotiate
< X-Powered-By: ASP.NET
< Date: Wed, 26 Sep 2012 12:43:40 GMT
< Content-Length: 0
<
* Connection #0 to host --- left intact
* Issue another request to this URL: '---'
* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (---) port 443 (#0)
* Server auth using NTLM with user '---'
> GET --- HTTP/1.1
Authorization: NTLM ---
Host: ---
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml; charset=utf-8
Content-Length: 4856

May be the issue is with SSL read: error:00000000:lib(0):func(0):reason(0), errno 104
Shouldn't curl return with error CURLE_RECV_ERROR here?
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-26