cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Cancel request in process

From: Oleksiy <patriot_of_ua_at_ukr.net>
Date: Tue, 13 Sep 2011 14:47:48 +0300
('binary' encoding is not supported, stored as-is) ('binary' encoding is not supported, stored as-is)    I find out that this is because I write the code in function. If I
   write all curl code in main - it works fine without errors. But when
   my code is in function in other cpp-file, when the progress_callback
   returns non-zero it crashes. When it return 0 everything is fine.

>

>

> --- Оригінальне повідомлення ---
   Від кого: " Oleksiy" <patriot_of_ua_at_ukr.net>
   Кому: " Alan Wolfe" <alan.wolfe_at_gmail.com>
   Дата: 13 вересня 2011, 11:20:19
   Тема: Re: Cancel request in process

>

   ultotal is never zero. When function is

>

>

>

   int ProgressShow(int (*fun)(double data), double dltotal, double
   dlnow, double ultotal, double ulnow)
> {
> printf("%f / %f (%g %%)\n", ulnow, ultotal, ulnow*100.0/ultotal);
> return 0;
> }
>

>

>

>

   everything works as it should be. The problem is when it returns
   non-zero value. In documentation it is said that it will cancel the
   request, and it dies so, but also program crashes.

>
> --- Оригінальне повідомлення ---
> Від кого: " Alan Wolfe" <alan.wolfe_at_gmail.com>
> Кому: " libcurl development" <curl-library_at_cool.haxx.se>
> Дата: 13 вересня 2011, 11:10:35
> Тема: Re: Cancel request in process
>
>
>
> >

   Is it a divide by zero crash? Look what happens in your code when
   utotal is 0.

>

     On Sep 13, 2011 1:06 AM, "Oleksiy" <patriot_of_ua_at_ukr.net> wrote:
>
>

     int ProgressShow(int (*fun)(double data), double dltotal, double
     dlnow, double ultotal, double ulnow)
> {
> printf("%f / %f (%g %%)\n", ulnow, ultotal,
     ulnow*100.0/ultotal);
> if(ulnow*100>50)
> return 1;
> return 0;
> }

>

>

>

     int main()

>

     {

>

     //to use this callback

>

     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);//must be to use
     progress cakkback
> curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
     ProgressShow);//callback function for displaying uploading
     progress
> curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, fun);//data sent to
     the progress callback as a first parameter
>

>

     }

>

> When ProgressShow just returns 0 everything works fine. With
     this program crashed, but I receive the right output to the
     Eclipse console after crash. I'm sending a file with post request.
>

>
> --- Оригінальне повідомлення ---
> Від кого: " Jeff Pohlmeyer" <yetanothergeek_at_gmail.com>
> Кому: " libcurl development" <curl-library_at_cool.haxx.se>
> Дата: 12 вересня 2011, 21:22:40
> Тема: Re: Cancel request in process

>
>
>
> >
> > 2011/9/12 Oleksiy <patriot_of_ua_at_ukr.net>:
> >
> > > When I return from curl_progress_callback n...

>
>
     -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

   -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
>

   -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

('binary' encoding is not supported, stored as-is) -------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-13