curl-library
Unable to send GET request via proxy tunnel
Date: Tue, 18 Feb 2014 16:24:40 +0300
Hi.
I'm trying to send GET request through proxy using tunnelling.
Expected behaviour:
1. Tunnel over proxy is created.
2. GET request is sent via tunnel.
Actual behaviour:
1. Tunnel over proxy is created.
2. GET request is sent not along the tunnell, as expected, but itself. This
behaviour results in impossibility to sent such request if proxy requires
authorization, because request is sent without proxy-authorization header.
For some strange reason this bug is reprodused with GET requests only: HEAD
seems to work just fine.
Development environment:
Windows 8 x64
libcurl version 7.19.7 (aslo reproduced on 7.35.0)
visual studio 2005 (without service pack)
proxy: fiddler v4.4.5.9
Following code sample demonstrates this behaviour:
#include "stdafx.h"
#include "curl/curl.h"
#include "curl/types.h"
#include "curl/easy.h"
#include <iostream>
char* url = "http://www.curl.haxx.se/download/curl-7.35.0.tar.gz";
char* host = "Host: www.curl.haxx.se:80";/**/
void perform(char* method)
{
CURL* curl = NULL;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, method);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_CRLF, 0);
curl_slist list;
list.data = new char[strlen(host) + 1];
memset(list.data, 0, strlen(host) + 1);
strcpy(list.data, host);
list.next = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, &list);
curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, 0);
curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, 0);/**/
curl_easy_setopt(curl, CURLOPT_PROXY, "127.0.0.1");
curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8888);
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "123");
curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "123");
curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 120);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
int _tmain(int argc, _TCHAR* argv[])
{
perform("GET");
perform("HEAD");
return 0;
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-18