cURL / Mailing Lists / curl-library / Single Mail

curl-library

Multiple requests on Same CURL handle fails.

From: Prabu RM <prabu_at_vembu.com>
Date: Mon, 13 Feb 2012 13:49:28 +0530

Hi,

We used to transfer files to remote server using libcurl. All we know there
are methods like *PUT,POST,GET,HEAD,DELETE* in order to manipulate the
transfer file. Here is one major issue we are facing on libcurl.

*Issue:* Multiple request methods say HEAD & PUT in a single CURL reusing
handle fails and throws errors like below.

$$$$$$$$$$$$$$$$$$$$* SSL read:
error:00000000:lib(0):func(0):reason(0), errno 10054
* Connection died, retrying a fresh connect
* Issue another request to this URL:
'https://s3-rrs-monish.s3.amazonaws.com/wintest4%2F1%2Fwintest4client%2Ftest17%2F03%5F02%5F2012%5F1134%2F1%2D500%
Data results:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to
the server was not read from or written to within the timeout period.
Idle connec
tions will be closed.</Message><RequestId>41ECE453069ED950</RequestId><HostId>MCaoqw4KFlotvIlcldcUKkDJZAr+4MAqfibasmCTDVjZBFcyIOg9RJmCRIp6IVCB</HostId
></Error>
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to
the server was not read from or written to within the timeout period.
Idle connec
tions will be closed.</Message><RequestId>41ECE453069ED950</RequestId><HostId>MCaoqw4KFlotvIlcldcUKkDJZAr+4MAqfibasmCTDVjZBFcyIOg9RJmCRIp6IVCB</HostId
></Error>
*To Reproduce simply:*

*int k = 0;
CURL* curlPtr = curl_easy_init();
while(K<1000)
{
     Perform_Curl_Operation(curlPtr,FileName1,"HEAD");
     Perform_Curl_Operation(curlPtr,FileName2,"PUT");
     k++;
}
*
Attached herewith is the sample output file which contains the curl
verbose output.

We also for every call the curl_slist_free_all(headers); happens
without fail. Hence we believe there could be some memory CACHE which
has been duplicated on next request.

We could see when we use same CURL handle the Content-Length request
header added in HEAD request header followed by PUT request. See in
attached file. What brings requests headers mess up when using same
CURL handle.

We believe Reinitializing CURL handle at every request is not fair but
fixes this issue.
*
Our current fix:* If the request METHOD arrives is different from
previous request METHOD then the CURL handle will be Reinitialized.
This fix has been put application level and we would like expect this
from you if you have any other fix on this.

*Curl Version:*

Linux: curl-7.16(Openssl 0.9.8r)
Windows: curl-7.19(Openssl 0.9.8r)

Since this is crucial please reply as much as possible.

Awaiting your reply.

Regards,
Prabu RM.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2012-02-13