Commit 82180643 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

test proxy supports CONNECT

There's a new 'http-proxy' server for tests that runs on a separate port
and lets clients do HTTP CONNECT to other ports on the same host to
allow us to test HTTP "tunneling" properly.

Test cases now have a <proxy> section in <verify> to check that the
proxy protocol part matches correctly.

Test case 80, 83, 95, 275, 503 and 1078 have been converted. Test 1316
was added.
parent 585b89a6
Loading
Loading
Loading
Loading
+20 −4
Original line number Original line Diff line number Diff line
@@ -160,6 +160,7 @@ pop3
smtp
smtp
httptls+srp
httptls+srp
httptls+srp-ipv6
httptls+srp-ipv6
http-proxy


Give only one per line.  This subsection is mandatory.
Give only one per line.  This subsection is mandatory.
</server>
</server>
@@ -275,6 +276,7 @@ Available substitute variables include:
%HOST6IP   - IPv6 address of the host running this test
%HOST6IP   - IPv6 address of the host running this test
%HTTP6PORT - IPv6 port number of the HTTP server
%HTTP6PORT - IPv6 port number of the HTTP server
%HTTPSPORT - Port number of the HTTPS server
%HTTPSPORT - Port number of the HTTPS server
%PROXYPORT - Port number of the HTTP proxy
%FTPPORT   - Port number of the FTP server
%FTPPORT   - Port number of the FTP server
%FTP6PORT  - IPv6 port number of the FTP server
%FTP6PORT  - IPv6 port number of the FTP server
%FTPSPORT  - Port number of the FTPS server
%FTPSPORT  - Port number of the FTPS server
@@ -321,12 +323,26 @@ changing protocol data such as port numbers or user-agent strings.
One perl op per line that operates on the protocol dump. This is pretty
One perl op per line that operates on the protocol dump. This is pretty
advanced. Example: "s/^EPRT .*/EPRT stripped/"
advanced. Example: "s/^EPRT .*/EPRT stripped/"
</strippart>
</strippart>

<protocol [nonewline="yes"]>
<protocol [nonewline="yes"]>
the protocol dump curl should transmit, if 'nonewline' is set, we will cut

off the trailing newline of this given data before comparing with the one
the protocol dump curl should transmit, if 'nonewline' is set, we will cut off
actually sent by the client
the trailing newline of this given data before comparing with the one actually
Variables are substituted as in the <command> section.
sent by the client Variables are substituted as in the <command> section.  The
<strip> and <strippart> rules are applied before comparisons are made.

</protocol>
</protocol>

<proxy [nonewline="yes"]>

The protocol dump curl should transmit to a HTTP proxy (when the http-proxy
server is used), if 'nonewline' is set, we will cut off the trailing newline
of this given data before comparing with the one actually sent by the client
Variables are substituted as in the <command> section. The <strip> and
<strippart> rules are applied before comparisons are made.

</proxy>

<stdout [mode="text"] [nonewline="yes"]>
<stdout [mode="text"] [nonewline="yes"]>
This verifies that this data was passed to stdout.  Variables are
This verifies that this data was passed to stdout.  Variables are
substituted as in the <command> section.
substituted as in the <command> section.
+1 −1
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ test1208 test1209 test1210 test1211 \
test1220 \
test1220 \
test1300 test1301 test1302 test1303 test1304 test1305	\
test1300 test1301 test1302 test1303 test1304 test1305	\
test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \
test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \
test1314 test1315 test1317 test1318 \
test1314 test1315 test1316 test1317 test1318 \
test2000 test2001 test2002 test2003 test2004
test2000 test2001 test2002 test2003 test2004


EXTRA_DIST = $(TESTCASES) DISABLED
EXTRA_DIST = $(TESTCASES) DISABLED
+5 −2
Original line number Original line Diff line number Diff line
@@ -31,12 +31,13 @@ contents
<client>
<client>
<server>
<server>
http
http
http-proxy
</server>
</server>
 <name>
 <name>
HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0
HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0
 </name>
 </name>
 <command>
 <command>
--proxy1.0 %HOSTIP:%HTTPPORT -p http://%HOSTIP:%HTTPPORT/we/want/that/page/1078 http://%HOSTIP:%HTTPPORT/we/want/that/page/1078
--proxy1.0 %HOSTIP:%PROXYPORT -p http://%HOSTIP:%HTTPPORT/we/want/that/page/1078 http://%HOSTIP:%HTTPPORT/we/want/that/page/1078
</command>
</command>
</client>
</client>


@@ -46,11 +47,13 @@ HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0
<strip>
<strip>
^User-Agent:.*
^User-Agent:.*
</strip>
</strip>
<protocol>
<proxy>
CONNECT %HOSTIP:%HTTPPORT HTTP/1.0
CONNECT %HOSTIP:%HTTPPORT HTTP/1.0
Host: %HOSTIP:%HTTPPORT
Host: %HOSTIP:%HTTPPORT
Proxy-Connection: Keep-Alive
Proxy-Connection: Keep-Alive


</proxy>
<protocol>
GET /we/want/that/page/1078 HTTP/1.1
GET /we/want/that/page/1078 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Host: %HOSTIP:%HTTPPORT
Accept: */*
Accept: */*

tests/data/test1316

0 → 100644
+62 −0
Original line number Original line Diff line number Diff line
<testcase>
<info>
<keywords>
FTP
PASV
LIST
HTTP CONNECT
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
HTTP/1.1 200 Mighty fine indeed

HTTP/1.1 200 Mighty fine indeed

total 20
drwxr-xr-x   8 98       98           512 Oct 22 13:06 .
drwxr-xr-x   8 98       98           512 Oct 22 13:06 ..
drwxr-xr-x   2 98       98           512 May  2  1996 .NeXT
-r--r--r--   1 0        1             35 Jul 16  1996 README
lrwxrwxrwx   1 0        1              7 Dec  9  1999 bin -> usr/bin
dr-xr-xr-x   2 0        1            512 Oct  1  1997 dev
drwxrwxrwx   2 98       98           512 May 29 16:04 download.html
dr-xr-xr-x   2 0        1            512 Nov 30  1995 etc
drwxrwxrwx   2 98       1            512 Oct 30 14:33 pub
dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
</datacheck>
</reply>

#
# Client-side
<client>
<server>
ftp
http-proxy
</server>
 <name>
FTP LIST tunneled through HTTP proxy
 </name>
 <command>
ftp://%HOSTIP:%FTPPORT/ -p -x %HOSTIP:%PROXYPORT
</command>
</client>

#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
EPSV
TYPE A
LIST
QUIT
</protocol>
</verify>
</testcase>
+9 −6
Original line number Original line Diff line number Diff line
@@ -41,12 +41,13 @@ contents
<client>
<client>
<server>
<server>
http
http
http-proxy
</server>
</server>
 <name>
 <name>
HTTP CONNECT with proxytunnel getting two URLs from the same host
HTTP CONNECT with proxytunnel getting two URLs from the same host
 </name>
 </name>
 <command>
 <command>
http://remotesite.com/we/want/that/page/275 -p -x %HOSTIP:%HTTPPORT --user iam:myself --proxy-user youare:yourself http://remotesite.com/we/want/that/page/275
http://remotesite.com:%HTTPPORT/we/want/that/page/275 -p -x %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself http://remotesite.com:%HTTPPORT/we/want/that/page/275
</command>
</command>
</client>
</client>


@@ -56,21 +57,23 @@ http://remotesite.com/we/want/that/page/275 -p -x %HOSTIP:%HTTPPORT --user iam:m
<strip>
<strip>
^User-Agent:.*
^User-Agent:.*
</strip>
</strip>
<protocol>
<proxy>
CONNECT remotesite.com:80 HTTP/1.1
CONNECT remotesite.com:%HTTPPORT HTTP/1.1
Host: remotesite.com:80
Host: remotesite.com:%HTTPPORT
Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm
Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
Proxy-Connection: Keep-Alive
Proxy-Connection: Keep-Alive


</proxy>
<protocol>
GET /we/want/that/page/275 HTTP/1.1
GET /we/want/that/page/275 HTTP/1.1
Authorization: Basic aWFtOm15c2VsZg==
Authorization: Basic aWFtOm15c2VsZg==
Host: remotesite.com
Host: remotesite.com:%HTTPPORT
Accept: */*
Accept: */*


GET /we/want/that/page/275 HTTP/1.1
GET /we/want/that/page/275 HTTP/1.1
Authorization: Basic aWFtOm15c2VsZg==
Authorization: Basic aWFtOm15c2VsZg==
Host: remotesite.com
Host: remotesite.com:%HTTPPORT
Accept: */*
Accept: */*


</protocol>
</protocol>
Loading