cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Correct use of curl_easy_getinfo

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 5 Dec 2011 16:14:20 +0100 (CET)

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.

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!

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