Hi Folks,
I am using libcurl version CURL-7.19.0. I am trying to use curl easy handle
for accessing multiple urls.
Here is the code
ProcessURl(string link)
{
url = link;
//Provide this link to curl so that curl will make requests for this link.
curl_easy_setopt(easyHandle, CURLOPT_URL,url.c_str());
//This API will make http request to check if the header has valid content
type
status = curl_easy_perform(easyHandle);
//For the header request
if (status == CURLE_OK || status == CURLE_WRITE_ERROR)
{
ReadContentIdFile();
SetContentType();
if(IsDownloadable())
{
curl_easy_setopt(easyHandle, CURLOPT_WRITEFUNCTION,
AsxDownloadManager::CurlWriteFunctionCallback);
status = curl_easy_perform(easyHandle);
if(status == CURLE_OK)
{
DumpContents();
}
else
{
cout << "Could not dump data for URL: "<< url <<endl;
}
}
Deinit();
}
else
{
cout << "Error occured" << errorBuffer << endl;
}
}
}
in Init() function where i initialise all the curl handle option i have code
Init()
{
curl_global_init(CURL_GLOBAL_WIN32 | CURL_GLOBAL_SSL );
easyHandle = curl_easy_init();
//Check if handle is valid Cannout use curl in this case.
if(!easyHandle)
{
exit(1);
}
curl_easy_setopt(easyHandle, CURLOPT_WRITEDATA, this);
curl_easy_setopt(easyHandle, CURLOPT_WRITEHEADER, this);
curl_easy_setopt(easyHandle, CURLOPT_WRITEFUNCTION,
DummyCurlWriteFunctionCallback);
curl_easy_setopt(easyHandle, CURLOPT_HEADERFUNCTION,
CurlHeaderFunctionCallback);
curl_easy_setopt(easyHandle, CURLOPT_TIMEOUT ,PROCESSING_TIMEOUT);
curl_easy_setopt(easyHandle, CURLOPT_ERRORBUFFER, &errorBuffer);
}
First time i call ProcessURl(string link) with some string url, it works,
and then when second time i make a call to ProcessURl(string link), the code
crashes at curl_easy_setopt(easyHandle, CURLOPT_URL,url.c_str());.
I am using msvc++ 2005 compiler. My Question here is:
Is it possible to use multiple setopt for CURL_OPT_URL, with multiple urls?
or for one easy_handle only one url is valid.
Please tell me if i am doing something wrong here.
Regards
Su
--
--------------------
"It is only with the heart that one can see rightly; what is essential is
invisible to the eye."
_______________________________________________
cURLpp mailing list
[email protected]
http://www.rrette.com/mailman/listinfo/curlpp