cURL / Mailing Lists / curl-library / Single Mail


Re: your mail

From: Brad Mann <>
Date: Mon, 9 Jan 2012 10:41:49 +0530

Hi Dan,.

Thanks a lot for your reply..I was not available due to internet
issues over the weekend..

By chunks I mean that I am sending the file in parts, i.e. chunks of
512 (as directed in the documentation) . I am using the following

vector<string> request_headers2;

request_headers2.push_back("Content-Length: 524288");
request_headers2.push_back("Content-Range: bytes 0-524287/" + strFileSize);

strGoogleResponseUP = "";

struct curl_slist *header_text = NULL;

// Add standard headers
for (unsigned int i = 0; i < request_headers2.size(); ++i)
        header_text = curl_slist_append(header_text, request_headers2[i].c_str());
// Add standard headers

curl_easy_setopt(curl,CURLOPT_URL, strURLWithID.c_str()); //version 3 url.
curl_easy_setopt(curl,CURLOPT_HEADER, true);
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,false); //skipping peer
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl, CURLOPT_READDATA, pFile);

res = curl_easy_perform(curl);

The response is NULL in the case of Content-Length and Content-Range tags...

Am I doing something wrong up there..?


On 1/6/12, Dan Fandrich <> wrote:
> On Fri, Jan 06, 2012 at 05:56:55PM +0530, Brad Mann wrote:
>> I am implementing Google docs functionality in my application using
>> libcurl and for the same I need to send the file in chunks to their
>> server. Problem is that I am not able to do the same.
> When you say "chunks" are you talking about HTTP chunked encoding or
> application- level chunks? Because libcurl will handle HTTP chunks on
> its own, and automatically--there's no need (in fact, no way) to call
> curl_easy_perform() several times to do it. If it's application-level
> chunks (with several different curl_easy_perform() calls), then the
> application will be involved. But, libcurl should handle all the headers
> itself, including Content-Length and Content-Range, based on other
> curl_easy_setopt options.
>>>> Dan
> -------------------------------------------------------------------
> List admin:
> Etiquette:
List admin:
Received on 2012-01-09