cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: 答复: cancel upload in curl

From: Fabian Frank <fabian.frank.de_at_gmail.com>
Date: Wed, 19 Mar 2014 00:09:11 -0700

On Tue, Mar 18, 2014 at 10:32 PM, jy_lizl_at_cn.fujitsu.com <
jy_lizl_at_cn.fujitsu.com> wrote:
>
> You mean return 0,it means the transfer is completed?
>

Please read
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION. It
says:
"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."

 If I want to cancel the upload immediately, I should return
> CURL_READFUNC_ABORT.
>
Yes.

> And I have a trouble that xmlhttprequest upload by cUrl ,it doestn’t call
> read callback although I register callback to curl handle.
>
> Do you have any idea?
>
Not without seeing the code that causes this problem. I am
using CURLOPT_READFUNCTION myself extensively, so I know it's generally
working fine. Are you setting up the form correctly using curl_formadd?
http://curl.haxx.se/libcurl/c/curl_formadd.html

Regards,
Fabian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-19