Can curl_slist_free_all be called right after installing CURLOPT_HTTPHEADER?

Can I do it?

curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_slist_free_all(headerlist);

      

That is, can I free the header list before sending the request? Does curl create a copy?

+3


source to share


1 answer


Not. In source, the setopt function just stores your pointer.



case CURLOPT_HTTPHEADER:
    /*
     * Set a list with HTTP headers to use (or replace internals with)
     */
    data->set.headers = va_arg(param, struct curl_slist *);
    break;

      

+5


source







All Articles