cURL / Mailing Lists / curl-library / Single Mail


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

From: Tanmay Anjaria <>
Date: Sat, 10 Jan 2009 11:32:44 +0530


I am new to cURL and started using it for some project in *Windows Xp*. I'm
using *Visual Studio 2005* for development.

*cURL version:* libcurl-7.15.1-msvc-win32-ssl-0.9.8a-zlib-1.2.3

*Project is : *To upload a video file on YouTube using cURL.

Currently, It's failing in the first phase, that is authentication.

please find the link below from google suggesting the method to do the same.

While executing the curl_perform it come out with an error saying that
"content-length header required" Please find the *error.html file

Can some one please let me know how this can be resolved?

*Also find the code that I'm using.* I'm pasting it after my signature at
the end of the mail.

Thanks & Regards,


    CURL *curl_handle=NULL;
    CURLcode res=0;
    char url_string[MAX_PATH] = {0};

    curl_handle = curl_easy_init();

'Email=testuser&Passwd=testpw&service=youtube&source=Test' --header

    /* Curl initializations */
    res = curl_easy_setopt(curl_handle,CURLOPT_URL,url_string);

    // For making sure that SSL related error doesn't come

    res = curl_easy_setopt(curl_handle,CURLOPT_POST,1);
        printf("Error in Curl_easy_setopt");

    //res = curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS,
"Content-Length: 372");
        //printf("Error in Curl_easy_setopt");

    //curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION,
    //curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, NULL);
    //curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION,
    //curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, NULL);

    res = curl_easy_perform(curl_handle);
        printf("Error in curl_easy_perform ");

Received on 2009-01-10