cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problems with curl_easy_perform with call back function

From: Venkatesh Prabu Narayanan <venkateshprabu06_at_gmail.com>
Date: Sat, 25 May 2013 14:41:07 +0530

Daniel,

Further to my previous post, I have tried returning the option
'CURL_READFUNC_ABORT' and now the operation aborted as expected. Now I have
two questions,

1. Is it safe to set large content length as in my case ?. Does it affect
any other behavior ?

2. After sending last block of data (less than 16K), server sends a
handshake protocol (only 7 bytes in size) to the client. This protocol
wasn't received in the Write Call back function (you can see this in my
first post in this thread). In the server side, it says it has sent those
bytes without any error. Also I do wait for this protocol from server for
few minutes before aborting the Read Call back function. Is there any thing
else I need to check for this ? Also is there any minimum size need to be
filled in the socket so as to call the write call back function ?

Regards,
Venkatesh.

On Sat, May 25, 2013 at 11:34 AM, Venkatesh Prabu Narayanan <
venkateshprabu06_at_gmail.com> wrote:

> Daniel,
>
> So you want me to send the error code 'CURL_READFUNC_ABORT' from the read
> call back function (after my upload gets completed) to abort the process
> immediately. I will try this and let you know. Thanks for your response.
>
> Regards,
>
>
> On Sat, May 25, 2013 at 2:43 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>> On Fri, 24 May 2013, alpforce wrote:
>>
>> From what I understand (and I very well might be mistaken ;-) ) the
>>> write and read function callbacks should function in the manner similar to
>>> stdio's fwrite and fread functions... that means returning 0 is not enough
>>> , you also need to set the error to end-of-file (even though you are not
>>> actually working with files). I need to check my old code, I made something
>>> like that once or twice... AGAIN , I MIGHT BE MISTAKEN :) if so , I am
>>> sorry ;)
>>>
>>
>> CURLOPT_READFUNCTION
>>
>> 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.
>>
>> The read callback may return CURL_READFUNC_ABORT to stop the current
>> operation immediately, resulting in a CURLE_ABORTED_BY_CALLBACK error
>> code
>> from the transfer (Added in 7.12.1)
>>
>> quoted from:
>>
>> http://curl.haxx.se/libcurl/c/**curl_easy_setopt.html#**
>> CURLOPTREADFUNCTION<http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION>
>>
>> --
>>
>> / daniel.haxx.se
>>
>> ------------------------------**------------------------------**-------
>> List admin: http://cool.haxx.se/list/**listinfo/curl-library<http://cool.haxx.se/list/listinfo/curl-library>
>> Etiquette: http://curl.haxx.se/mail/**etiquette.html<http://curl.haxx.se/mail/etiquette.html>
>>
>
>
>
> --
> Thanks and Regards
>
> N.Venkatesh Prabu

-- 
Thanks and Regards
N.Venkatesh Prabu

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-05-25