curl-library
Re: HTTP proxy issue
Date: Fri, 27 Apr 2012 15:13:32 +0200
On Fri, Apr 27, 2012 at 08:43:47PM +0800, po_mail_test wrote:
> I'm using libcurl 7.22.0, but something troubles me.
> I'v written the following codes in hope of making a HTTP request through a HTTP proxy (hosted by CCProxy: www.ccproxy.com/).
[...]
> But, it does not work as i expected. It sends "GET some_url HTTP/1.1" instead of "CONNECT some_host HTTP/1.1".
>
> libcurl sent:
>
> GET http://www.google.com HTTP/1.1
> Proxy-Authorization: Basic password_in_base64
> User-Agent: curl/7.22.0 (i386-pc-win32) libcurl/7.22.0
> Host: 163.com
> Accept: */*
> Proxy-Connection: Keep-Alive
This isn't a normal use case for an HTTP proxy--I'm not even sure what the
specs say is supposed to happen with differing GET and Host: lines. The
principle of least surprise would have the proxy leave that Host: line alone
when it performs the remote request, but I'm not surprised to hear that
the proxy you're using doesn't.
> rather than:
>
> CONNECT 192.168.144.4:443 HTTP/1.1
> Proxy-Authorization: Basic password_in_base64
> Proxy-Connection: Keep-Alive
> Accept: */*
> Content-Type: text/html
> Content-length: 0
This is a tunneling proxy connection, and can be enabled with the
CURLOPT_HTTPPROXYTUNNEL option.
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPPROXYTUNNEL
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-27