cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Incomplete HTTP post body

From: Sean Miller via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 5 Aug 2016 18:59:36 +0000 (UTC)

On Friday, August 5, 2016 12:49 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> Please don't top-post.

I can't remember the last time I used e-mail like this. Two decades, maybe. It's cool. Have to do it manually, though.

>> For a large request (>64 KiB) with a timeout of 5 sec, I see libcurl
>> requesting up to 4 buffers worth of data from my READFUNC, with one call
>> to TIMERFUNC with timeout_ms=198. After the 4th chunk, libcurl calls
>> TIMERFUNC with timeout_ms=4800, which consumes all the remaining time until
>> the timeout. I don't understand why libcurl wants to wait so long when I
>> haven't told it that I'm done providing data.

> libcurl will wait for the socket to become writable until it asks for data
> from you, so that it knows it can send at least parts of the data you give it.
> libcurl avoids to buffer data by itself. So, until the socket signals
> "writable", your read callback won't get called. And then it won't ask for
> more data from you again until it has managed to send the data you gave it in
> the previous callback call.

This led me to the solution. The asiohiper example misled me into believing libcurl would wait for me, but it doesn't. Unlike libev and libevent, asio doesn't install wait loops; the user must loop manually after each wait. Thus, I wrote some async loops over the io_service, and I was able to tell libcurl when to write again.
Once I have some free time, I'd like to fix your example.
Regards,Sean M.

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-08-05