cURL / Mailing Lists / curl-library / Single Mail


Re: curl-library Digest, Vol 54, Issue 33

From: Nanbackups <>
Date: Mon, 22 Feb 2010 12:09:15 -0500

>> Instead I have captured the TCP stream (pasted below) using a packet
>> sniffer, and as you can see the content-length is 0.
> Right, but what is your app telling libcurl?

success = SetBoolOpt(CURLOPT_POST, true) &&
                                     request.request()->length()) &&
                 SetStringOpt(CURLOPT_POSTFIELDS, *(request.request()));

I have some wrappers around curl_easy_opt, pasted below.
At the end of the above line the value of success is true and
request.request()->length() is non-zero. request.request() points to
string whose lifetime is maintained until curl_easy_perform returns.

bool HttpConnection::SetStringOpt(CURLoption option, const string& value) {
  return SetCurlOpt(curl_handle_, option, value.c_str());

bool HttpConnection::SetBoolOpt(CURLoption option, bool value) {
  return SetCurlOpt(curl_handle_, option, static_cast<int64>(value));

bool HttpConnection::SetSizeOpt(CURLoption option, size_t value) {
  return SetCurlOpt(curl_handle_, option, static_cast<int64>(value));

template <typename Parameter>
static bool SetCurlOpt(CURL* handle,
                       CURLoption option,
                       const Parameter parameter) {
  if (!handle) {
    return false;
  CURLcode rv = curl_easy_setopt(handle, option, parameter);
  if (rv) {
    LOG("libcurl error: %s.\n", Logger::WARN, curl_easy_strerror(rv));
  return rv == CURLE_OK;
List admin:
Received on 2010-02-22