curl-library
Re: Correct use of curl_easy_getinfo
Date: Mon, 5 Dec 2011 18:30:14 +0100
Daniel Stenberg (Mon, 05. 12. 2011, 16:14):
> On Mon, 5 Dec 2011, Till Elsner wrote:
>
> > 21 /* set url */
> > 22 curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &doc_info->url);
>
> Ah.
>
> CURLINFO_EFFECTIVE_URL returns a mere pointer to a buffer inside of the easy
> handle.
>
> When you reset that handle I would guess the pointer suddenly points to a
> either something blank or to memory that previously was allocated and now are
> freed.
So do I need to call curl_easy_init again on an easy handle that
I've resetted using curl_easy_reset? I thought the buffer for
the URL inside the handle would be allocated during
curl_easy_perform or something, maybe this is where I went
wrong.
>
> You probably need to clone the data that pointer points to before you reset or
> close the easy handle, then you can use that data to set the URL in the
> subsequent request!
By the time I call reset on the handle, I don't need the data
inside the handle any more. My only trouble is that a subsequent
call of curl_easy_perform on the same handle results in a
segmetation fault.
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-- Till Elsner [] till_at_0xAA55.org (Email & XMPP) [] irc.0xaa55.org #praty [][][] ############################## GPG ############################### # KeyID=0xFCFF4656 # # fingerprint: 1A1E 3B61 6956 07E3 2CB8 D0F8 791F 52F8 FCFF 4656 # ################################################################## () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- application/pgp-signature attachment: stored