cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Gargbage sent with PUT

From: Robert Kohn <personalrobert_at_gmail.com>
Date: Mon, 26 Sep 2011 09:25:06 -0700

Hi Daniel,

 1) What is that 2nd "Content-Length: 46" doing there?
>>
>
> Because due to a bug you couldn't replace Content-Length: in all
> circumstances. I just committed a bug fix for this.
>

Do you have an estimate as to when (and what version) this will be released?

Providing your own Content-Length: is something we strongly advice you not
> to do.

I am accessing the Amazon Web Service (AWS) S3 database. For a PUT
operation, if I do not include Content-Length, I get an error from them:
 "411 You must provide the Content-Length HTTP header". And if I add
"Transfer-Encoding: chunked" to the header, I get the error: "501 A header
you provided implies functionality that is not implemented". So I think I'm
stuck using Content-Length.

 2) Why does the string "Content-Length: 46" end up in my uploaded PUT
>> file?
>>
>
> That's beyond what we can tell. That's clearly a header and I don't know
> why or how that ends up in your file.

Here is a clue. My actual header looks like:

  Expect:
  Content-Length: 46
  Date: Mon, 26 Sep 2011 15:59:54 +0000
  Authorization: AWS JFIERJF678fj:fjkPNJ8fnh&hb&noe7byOY&ERBY

But when I perform the PUT, the Content-Length: 46 shows up again (as you
know) after the Authorization line (preceded and followed by a newline). It
seems that whatever follows the Authorization line ends up in my uploaded
file, as if AWS assumes that the Authorization line is the last entry in the
header, and whatever follows is data to be uploaded! I hope that when you
fix the "Content-Length" problem, my PUT will work.

Now look at line 54 in the source code (INFILESIZE_LARGE), currently
>> commented out. If I un-comment it, my output changes to:
>>
>
> fsize is a curl_off_t, so your use of CURLOPT_INFILESIZE is wrong. Why you
> instead see the error when you use CURLOPT_INFILESIZE_LARGE is unclear to
> me...
>

Thank you. I fixed my code to use a long for CURLOPT_INFILESIZE and
curl_off_t for CURLOPT_INFILESIZE_LARGE, but that did not change the symptom
(I get Content-Length: -4634857839473456382 as the additional header line).

> What libcurl version on what OS is this?
>

I am using libcurl 7.18.0 on Ubuntu Linux 2.6.34

Thank you very much for your assistance.

- Robert

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-26