cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem posting large data using libcurl

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 15 Jan 2015 10:29:03 +0100

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.

> 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.

> 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.

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