cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_PROXYHEADER getting closer

From: Maciej Puzio <mx34567_at_gmail.com>
Date: Mon, 24 Feb 2014 12:24:36 -0600

I got the git snapshot, applied all 7 patches and run some tests. My
tests consisted of running the curl tool, and I did not call curl
library directly. Here is what I noticed:

1. The new behavior (CURLOPT_HEADEROPT == CURLHEADER_SEPARATE) is
default and I haven't found a cmdline option to change it (not that I
complain!),

2. If CONNECT is used, proxy gets headers specified by --proxy-header,
and end server gets headers specified by --header (as expected),

3. If CONNECT is not used, --proxy-header list is appended to --header
list, and this may result in some headers being duplicated (not sure
if this is correct or not, but this is such a borderline case, that it
probably does not matter).

Curl was invoked as follows:
./bin/curl -v -K curl.test

Contents of file curl.test:
url = "http://www.google.com"
proxy = "http://[redacted]"
proxytunnel
proxy-header = "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0)
Gecko/20100101 Firefox/20.0"
proxy-header = "Proxy-Connection: close"
proxy-header = "X-Debug: proxy"
header = "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:25.0)
Gecko/20100101 Firefox/25.0"
header = "Connection: close"
header = "X-Debug: origin"

Request sent to the proxy:
> CONNECT www.google.com:80 HTTP/1.1
> Host: www.google.com:80
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0
> Proxy-Connection: close
> X-Debug: proxy

Request sent to the end server:
> GET / HTTP/1.1
> Host: www.google.com
> Accept: */*
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0
> Connection: close
> X-Debug: origin

Request sent when proxytunnel option is removed from curl.test
> GET http://www.google.com/ HTTP/1.1
> Host: www.google.com
> Accept: */*
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0
> Connection: close
> X-Debug: origin
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0
> Proxy-Connection: close
> X-Debug: proxy

Thanks
Maciej
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-24