Copy the url string before passing it to curl.
This commit is contained in:
@@ -30,6 +30,7 @@ struct DownloadData
|
|||||||
CURL *curlHandle;
|
CURL *curlHandle;
|
||||||
CURLM *curlMultiHandle;
|
CURLM *curlMultiHandle;
|
||||||
FILE *targetFile;
|
FILE *targetFile;
|
||||||
|
string curlUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -54,8 +55,8 @@ DownloadHelper::Init(const string &url, const string &targetFileName)
|
|||||||
//m_data->curlMultiHandle = curl_multi_init();
|
//m_data->curlMultiHandle = curl_multi_init();
|
||||||
|
|
||||||
// TODO throw exception on error
|
// TODO throw exception on error
|
||||||
|
m_data->curlUrl = url;
|
||||||
curl_easy_setopt(m_data->curlHandle, CURLOPT_URL, url.c_str());
|
curl_easy_setopt(m_data->curlHandle, CURLOPT_URL, m_data->curlUrl.c_str());
|
||||||
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEFUNCTION, NULL);
|
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEFUNCTION, NULL);
|
||||||
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEDATA, m_data->targetFile);
|
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEDATA, m_data->targetFile);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user