curl-library
Re: Content-Length Question
Date: Mon, 17 Apr 2006 16:07:21 -0700
Hi Gang,
I think I have tracked down the issue to be the one mentioned in this
thread:
http://curl.haxx.se/mail/lib-2004-08/0101.html
I think the problem that I am experiencing is that add_bufferf() does not
properly handle the %lld format in CodeWarrior 9.3 on Mac OS X.
I am working on a terrible hack right now to get around this problem. Does
anybody have any ideas on an elegant way to address this issue?
Cheers!
-- Jim
On 4/17/06 12:34 PM, "Jim Birkenseer" <jim_at_premediasystems.com> wrote:
> Hi All,
>
> First off, I'm new to libcurl, and to HTTP, so please forgive me if this is
> a silly question. Actually, I hope this is a silly question and someone can
> easily answer it for me! ;-)
>
> I have written the code below, and it looks like the Content-Length is being
> sent out set to zero. I think the Content-Length should be 4. Why is it
> being sent out with a zero length?
>
> My Code:
>
> CURLcode resCode;
> CURL *curl = nil;
> char errorBuffer[CURL_ERROR_SIZE];
> std::string buffer;
>
> curl = curl_easy_init();
> curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
> curl_easy_setopt(curl, CURLOPT_STDERR, stdout);
> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
> curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
> curl_easy_setopt(curl, CURLOPT_URL, fURL.c_str());
> curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
> curl_easy_setopt(curl, CURLOPT_POST, 1);
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "test");
> curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 4);
> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
> curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
> curl_easy_perform(curl);
>
> Debug Message:
>
> * About to connect() to xxx.yyy.com port 80
> * Trying ##.##.##.##... * connected
> * Connected to xxx.yyy.com (##.##.##.##) port 80
>> POST /aaaa/bbbbb.php HTTP/1.0
> Host: xxx.yyy.com
> Accept: */*
> Content-Length: 0
> Content-Type: application/x-www-form-urlencoded
>
>
> Thanks in advance!!
>
> -- Jim
>
>
>
Received on 2006-04-18