cURL requests changed

Posted by Andriy Mytroshyn on Stack Overflow See other posts from Stack Overflow or by Andriy Mytroshyn
Published on 2011-11-23T09:23:29Z Indexed on 2011/11/23 9:50 UTC
Read the original article Hit count: 440

Filed under:
|
|

I've start work with cURL library, before work i compile library. i Send request and have some problem. Code in c++ that i used for work with cURL:

CURL *curl=NULL;
CURLcode res;
struct curl_slist *headers=NULL; // init to NULL is important 
 curl_slist_append(headers, "POST /oauth/authorize HTTP/1.1");
 curl_slist_append(headers, "Host: sp-money.yandex.ru");
 curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
 curl_slist_append(headers, "charset: UTF-8");
 curl_slist_append(headers, "Content-Length: 12345");
curl = curl_easy_init();
if(!curl) 
    return 0;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, "sp-money.yandex.ru");
curl_easy_setopt(curl, CURLOPT_PROXY, "127.0.0.1:8888");
if( curl_easy_perform(curl)!=CURLE_OK)
    return 1;

I've used proxy, fiddler2, for check what data sent to server. When i check sent data i get result:

POST HTTP://sp-money.yandex.ru/ HTTP/1.1
Host: sp-money.yandex.ru
Accept: */*
Connection: Keep-Alive
Content-Length: 151
Content-Type: application/x-www-form-urlencoded

also i check this data using Wiresharck, result the same.

Do you know why in first line cURL wrote:

POST HTTP://sp-money.yandex.ru/ HTTP/1.1

I send

POST /oauth/authorize HTTP/1.1

I've used VS 2010 for work, and also i don't used framework

© Stack Overflow or respective owner

Related posts about c++

Related posts about curl