cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl exception with bad url

From: Robert Navarro <robobzzoy_at_gmail.com>
Date: Tue, 23 Aug 2011 12:08:54 -0400

On Tue, Aug 23, 2011 at 11:11 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 23 Aug 2011, Robert Navarro wrote:
>
>> static size_t WriteMemoryCallback(void *ptr, size_t size, size_t
>> nmemb, void *data)
>> {
>>        size_t realsize = size * nmemb;
>>        struct MemoryStruct *mem = (struct MemoryStruct *)data;
>>        mem->memory = new char[mem->size + realsize + 1];
>
> This function leaks all the memory you allocated in the previous call...
>
>> Sorry for the confusion! When I say stop, I mean the windows service is
>> suddenly in the stopped state. There is no entry in the Event Viewer log to
>> indicate something happened.
>
> Can I suggest that when you debug your application, you just run it
> "normally" or with a debugger or something to properly figure out what
> happens!
>
>> So I guess the question is, why do I not get a timeout response with the
>> second path, when the same code gives it to me with the first?
>
> I don't know. My guess is that your application/callback somehow causes the
> problems, as quite a lot of people successfully use libcurl and we test it
> quite extensively all the time and we have never had this problem reported.
>
> If you can make a full source code that reproduces the example and show us
> that source it would be very interesting.
>
> --

Daniel,

It would seem that I "fixed" it by removing the

curl_easy_setopt(curl, CURLOPT_ERRORBUFFER);

option. I will admit I am not sure exactly what this does, but I
thought I needed it for information about why a connection failed.
With this line removed, I still get my timeout error text, but no
crashes/exceptions, and everything is happy, in all cases. Might it be
I was using the wrong callback for that?

Also, thanks for spotting that memory leak, and taking time to assist.
Dan as well.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-23