cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Oleksiy <patriot_of_ua_at_ukr.net>
Date: Fri, 02 Sep 2011 17:42:38 +0300
('binary' encoding is not supported, stored as-is) ('binary' encoding is not supported, stored as-is)    I use this options:

>

>

   curl_easy_setopt(curl, CURLOPT_URL, urlUpload);
   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buffer);
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);

>

>

   It must be post request with header. And in header variable there is
   length

>

>

   ***
   char sizeStr[50];
   sprintf(sizeStr, "Content-Length: %d", body.length());

>

   ***

>

>

   header = curl_slist_append(header, sizeStr);

>

>

   ***

>

>

   What I'm trying to di is to upload video to YouTube, I'm using their
   manual -
   http://code.google.com/apis/youtube/2.0/developers_guide_protocol_direct_uploading.html#Direct_uploading

>

   And I receive such error.

>

   <!DOCTYPE html>
   <html lang=en>
   <meta charset=utf-8>
   <title>Error 411 (Length Required)!!1</title>
   <style>
   *mane symbols here* </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>

>

>

   Maybe I must use some other CURLoptions?

>

('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-03