cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: Error 411 (Length Required) in post request with header, but header has Content-Length:

From: Oleksiy <patriot_of_ua_at_ukr.net>
Date: Sun, 04 Sep 2011 14:49:14 +0300
('binary' encoding is not supported, stored as-is) ('binary' encoding is not supported, stored as-is) >You should never need to specify the Content-Length header like
   this--libcurl
>takes care of that as necessary. In this case, you probably want
   the
>CURLOPT_POSTFIELDSIZE_LARGE option. Enable logging and you'll see
   exactly

>what headers are being sent out.

>

>

   I try with or without Content-Length in my header - result is the
   same. I'm trying to form post request as in the manual -
   http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Direct_uploading

>

>

   when I include CURLOPT_VERBOSE option I get such info. Maybe I form
   POST request wrong? What is the right way to send POST request with
   headers in libCurl?

>

>

   <!DOCTYPE html>
   <html lang=en>
   <meta charset=utf-8>
   <title>Error 411 (Length Required)!!1</title>
   <style>
   *{margin:0;padding:0}html,code{font:15px/22px
   arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADVCAMAAAAfHvCaAAAAGFBMVEVYn

>

   *

>

   _

>

   my file that I try to upload to YouTube in binary represantation here

>

   _

>

   *

>

   aJDjbRA8dGsW6X6cgNmAhSEG%2FUiY%2Fsfiv02O7iVu1LunAAAAAElFTkSuQmCC);display:block;height:55px;margin:0
   0 -7px;width:150px}* > #g{margin-left:-2px}#g img{visibility:hidden}*
   html #g img{visibility:visible}*+html #g img{visibility:visible}
   </style>
   <a href=//www.google.com/ id=g><img
   src=//www.google.com/images/logo_sm.gif alt=Google></a>
   <p><b>411.</b> <ins>That’s an error.</ins>
   <p>POST requests require a <code>Content-length</code> header.
   <ins>That’s all we know.</ins>

   succes [0]
   * About to connect() to uploads.gdata.youtube.com port 80 (#0)
   * Trying 74.125.43.116... * connected
   * Connected to uploads.gdata.youtube.com (74.125.43.116) port 80 (#0)
> POST /feeds/api/users/default/uploads HTTP/1.1

   Accept: */*

   Host: uploads.gdata.youtube.com

   Authorization: GoogleLogin
   auth=DQAAAIkAAADhpy7VDX06BTq42tjSZeID8AnKsNBAGqYowiLvWBoYHj9CuiZE1MAMt00p-Mscs4KzOpjSot9LW1oQWF_c7cXd-zflzXPj2V5b1v2SEIYHRSVhQYRjLkIwbnLldHSaH3ps_nOBkjbQ8-_uk-evI7E6E2NNA5LbLbfBubOLvsAP7HqjdGcx8Pc3YbH19FkSUxs

   GData-Version: 2

   X-GData-Key:
   key=AI39si59VMkm6DATDmfG_Df6D23jfto3xRVfbAEMrFBv035pdRZ5AYMPsRXbGLCRXXnK5jz6KCSWSkuXOTrlDIIKWy7Le9fkQQ

   Slug: screen.avi

   Content-Type: multipart/related; boundary="d31fcjR2"

   Connection: close

   Content-Length: 910273

   Expect: 100-continue

   * HTTP 1.0, assume close after body
   < HTTP/1.0 411 Length Required

   < Content-Type: text/html; charset=UTF-8

   < Content-Length: 11791

   < Date: Sun, 04 Sep 2011 11:02:46 GMT

   < Server: GFE/2.0

   <

   * Closing connection #0

>

('binary' encoding is not supported, stored as-is) -------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-04