cURL / Mailing Lists / curl-library / Single Mail


Re: cURL on Windows Xp: "Content-Length Header required" error

From: Tanmay Anjaria <>
Date: Mon, 12 Jan 2009 14:46:18 +0530

Hey All,

As I mentioned earlier, I am working on YouTube Uploading project in WinXp
using cURL and google data APIs.

I was *able to pass the authentication stage* and thanks for all the inputs
from u ppl :)

YouTube gives a long authentication string for further Uploading task which
is to be used by the developer.

*I need to post a number of things before the actual binary data
file.*Please see the list as below:

It's from the link:


POST /feeds/api/users/default/uploads HTTP/1.1
Authorization: AuthSub token="DXAA...sdb8"
GData-Version: 2
X-GData-Client: b1c4t9sl2159
X-GData-Key: key=adf15ee97731bca89da876c...a8dc
Slug: video-test.mp4
Content-Type: multipart/related; boundary="f93dcbA3"
Content-Length: 1941255
Connection: close

Content-Type: application/atom+xml; charset=UTF-8

<?xml version="1.0"?>
<entry <>
  <media:group <>>
type="plain">Bad Wedding Toast</media:title>
      I gave a bad toast at my friend's wedding.
Content-Type: video/mp4
Content-Transfer-Encoding: binary

<Binary File Data>


Now, my question is *how to send all these using HTTP POST*? I'm looking
into CURLOPT_HTTPPOST, but through that u can only send one post at a time
and that too only of an HTTP header.

Is there anyway I can bundle all of these and then send in one time shot?

Any suggestions for making these HTTP POST will be welcome...

Thanks & Regards,
Tanmay Anjaria

On Sat, Jan 10, 2009 at 5:09 PM, Daniel Stenberg <> wrote:

> On Sat, 10 Jan 2009, Tanmay Anjaria wrote:
> Below mentioned are the 3 command line args that I wanted to send to
>> YouTube:
>> curl \
>> --location \
>> --data 'Email=testuser&Passwd=testpw&service=youtube&source=Test' \
>> --header 'Content-Type:application/x-www-form-urlencoded'
> Use curl's --libcurl option to get a rough C version of the same thing.
> --header is not needed as it sets the same header libcurl will use anyway.
> about the only options you need.
> Oh, and perhaps CURLOPT_WRITEFUNCTION etc to get the response back in some
> way you like.
> --
> Daniel
Received on 2009-01-12