31
I want to properly reuse a curl handle, so that it won't give me errors and function normally.
Suppose I have this piece of code:
CURL *curl;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0...");
curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com");
curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "http://www.bbc.com");
curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_global_cleanup();
Would this be a good or correct way of reusing a curl handle? Or do I need to use curl_easy_reset() on that handle?
I would also appreciate if anyone suggested what you should avoid doing in curl. Maybe someone could give me a link to an already existing source of information?