-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dan Fandrich
Sent: Wednesday, January 25, 2012 2:28 PM
To: [email protected]
Subject: Re: libcurl PUT retry and READFUNCTION
>> Um, that's not what the code shows.
Sorry Dan, It must be too late for me last night.
This is the actual code. It uses local variable, not on stack.
put_data_t m_data;
m_data.data_start = m_buff,
m_data.read_pos = 0 ;
m_data.data_len = pos + length;
// read head information
std::string mfile_uri = s_connMgrP->getBaseUri()+ m_dirName +
m_fileName + mdExt;
msg = "WriteMetadata URI is " + mfile_uri;
DCAL_logDebug(msg.c_str());
CURL* curl = m_connP->handle;
assert(curl);
curl_easy_set_default(curl);
curl_easy_setopt(curl, CURLOPT_URL, mfile_uri.c_str());
struct curl_slist *headers = 0;
headers = curl_slist_append(headers,
s_connMgrP->getAuthToken().c_str());
headers = curl_slist_append(headers, "Expect:");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
// set the put_data_callback function
curl_easy_setopt(curl, CURLOPT_PUT, true);
curl_easy_setopt(curl, CURLOPT_READDATA, &m_data);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, put_data_callback);
curl_easy_setopt(curl, CURLOPT_SEEKDATA, &m_data);
curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_data_callback);
curl_easy_perform(curl);
long result;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &result);
curl_slist_free_all(headers);
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html