cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem posting large data using libcurl

From: Heena Sirwani <heenasirwani_at_gmail.com>
Date: Tue, 20 Jan 2015 17:07:00 +0530

On Thu, Jan 15, 2015 at 4:01 PM, Heena Sirwani <heenasirwani_at_gmail.com>
wrote:

>
>
> On Thu, Jan 15, 2015 at 2:59 PM, Dan Fandrich <dan_at_coneharvesters.com>
> wrote:
>
>> On Thu, Jan 15, 2015 at 10:55:12AM +0530, Heena Sirwani wrote:
>> > I am using libcurl in C with the mutli socket interface along with
>> libuv. I add
>> > easy handles to the multi handle for each request and start the libuv
>> event
>> > loop together with adding sockets for polling for appropriate activity
>> to libuv
>> > poll interfaces.
>> >
>> > The problem is when I post data > 5k to the server. I don't seem to
>> get any
>>
>> libcurl starts doing 100 Continue at about that threshold, IIRC, and some
>> old
>> servers don't handle that well.
>>
> Yes I read about that.
>
>>
>> > response. When I check this at the server side, the server seems to be
>> sending
>> > a 408 response meaning it did not receive the request body within the
>> interval
>> > it was prepared to wait. I tried increasing the request time out value
>> to 100
>> > seconds (I guess that should suffice). But the problem persists. I also
>> don't
>> > get any response at the client side ( I assume that the client keeps
>> sending
>> > data event when the server has closed the connection and the server
>> sends the
>> > reset flag to clear the input buffers at the client side that contains
>> the
>> > unacknowledged responses and they are cleared even before the client
>> reads
>> > them). I have also reset the Expect: 100 continue header.
>>
>> Ah, that would have been my suggestion. But how did you do that? Forcing
>> a HTTP
>> 1.0 connection would guarantee it, and is another thing to try if you
>> haven't
>> already.
>>
> I reset it using headers = curl_slist_append(headers, "Expect:");
> I tried forcing the connection to http 1.0 but that also does not work.
>
>>
>> > Also when I do a post with the same amount of data using only easy
>> handles
>> > (blocking), I get the response within 3 seconds. The size of the data
>> after
>> > which I do not get any response also varies from machine to machine ( on
>> > another machine I do not get a response for data > 3k). I am assuming
>> that
>> > libcurl with libuv is slowing down the process of writing data to send
>> to the
>> > server. Also the event loop runs in a separate thread from where I
>> actually add
>> > handles to the multi interface.
>>
>> That's a no-no. libcurl is thread safe only if any given handle is
>> manipulated
>> strictly within a single thread. Read the thread safety sections of the
>> manual
>> again.
>>
> I did read about it and hence I have implemented thread synchronization
> when I add handles and when I perform action on the sockets i.e. when
> libcurl is traversing the handle tree.
>

It turns out that the requests work fine with http but fail with https. I
have curl version 7.39 and openssl1.0.1 and those are the latest. Also when
debugging I get SSL_write() returned SYSCALL, errno = 32. Curl returns
error code = 55 (failed sending data to the peer). What could be the
problem?

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

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-01-20