cURL / Mailing Lists / curl-library / Single Mail


Re: Does CURL_OPT_URL copy its data?

From: Dan Fandrich <>
Date: Thu, 24 Mar 2011 22:20:46 -0700

On Fri, Mar 25, 2011 at 12:26:22AM -0400, wrote:
> When setting the URL with:
> CURLcode res = curl_easy_setopt (h->curlhandle, CURLOPT_URL,
> szloginurl);
> Is it necessary that szloginurl be in scope when curl_easy_perform()
> is run?

This is documented in the curl_easy_setopt man page:

       Strings passed to libcurl as 'char *' arguments, are
       copied by the library; thus the string storage associated
       to the pointer argument may be overwritten after
       curl_easy_setopt() returns. Exceptions to this rule are
       described in the option details below.

       Before version 7.17.0, strings were not copied. Instead
       the user was forced keep them available until libcurl no
       longer needed them.

>>> Dan
List admin:
Received on 2011-03-25