cURL / Mailing Lists / curl-library / Single Mail

curl-library

(no subject)

From: David Strauss <david_at_davidstrauss.net>
Date: Mon, 27 May 2013 21:46:12 -0500

On Fri, May 24, 2013 at 7:28 AM, Venkatesh Prabu Narayanan
<venkateshprabu06_at_gmail.com> wrote:
> The problem I faced here is, after sending the final block of data, I return
> 0 to the call back function. But still curl_easy_perform() doesn't return
> instead it is still hanging in this function and leaves the socket
> connection open,
>
> select() call in the function Curl_socket_ready().
>
> While debugging the application, in server side, the application seems to be
> wait in the 'SSL_Read()' function.
>
> My understanding is whenever I return zero in the call back function, it
> should come out of call back function and in turn the curl_easy_perform().
> But that is not happening in my case. Is there any way to close the current
> libcurl call after sending all the data ?

What you're seeing is the documented behavior [1]:
If you stop the current transfer by returning 0 "pre-maturely" (i.e
before the server expected it, like when you've said you will upload N
bytes and you upload less than N bytes), you may experience that the
server "hangs" waiting for the rest of the data that won't come.

[1] http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION

--
David Strauss
   | david_at_davidstrauss.net
   | +1 512 577 5827 [mobile]
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-05-28