From 82180643f4886d47816cf654f2ee46114e9c296f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 17 Dec 2011 23:47:22 +0100 Subject: 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 section in 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. --- tests/data/Makefile.am | 2 +- tests/data/test1078 | 7 ++++-- tests/data/test1316 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test275 | 15 +++++++----- tests/data/test503 | 13 +++++++---- tests/data/test80 | 9 +++++--- tests/data/test83 | 7 ++++-- tests/data/test95 | 7 ++++-- 8 files changed, 101 insertions(+), 21 deletions(-) create mode 100644 tests/data/test1316 (limited to 'tests/data') diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 53d94841f..6b661a216 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -81,7 +81,7 @@ test1208 test1209 test1210 test1211 \ test1220 \ test1300 test1301 test1302 test1303 test1304 test1305 \ test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \ -test1314 test1315 test1317 test1318 \ +test1314 test1315 test1316 test1317 test1318 \ test2000 test2001 test2002 test2003 test2004 EXTRA_DIST = $(TESTCASES) DISABLED diff --git a/tests/data/test1078 b/tests/data/test1078 index e2355e3ae..cacdf4dd4 100644 --- a/tests/data/test1078 +++ b/tests/data/test1078 @@ -31,12 +31,13 @@ contents http +http-proxy HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0 ---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 @@ -46,11 +47,13 @@ HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0 ^User-Agent:.* - + CONNECT %HOSTIP:%HTTPPORT HTTP/1.0 Host: %HOSTIP:%HTTPPORT Proxy-Connection: Keep-Alive + + GET /we/want/that/page/1078 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* diff --git a/tests/data/test1316 b/tests/data/test1316 new file mode 100644 index 000000000..d485c0553 --- /dev/null +++ b/tests/data/test1316 @@ -0,0 +1,62 @@ + + + +FTP +PASV +LIST +HTTP CONNECT + + +# +# Server-side + +# When doing LIST, we get the default list output hard-coded in the test +# FTP server + +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 + + + +# +# Client-side + + +ftp +http-proxy + + +FTP LIST tunneled through HTTP proxy + + +ftp://%HOSTIP:%FTPPORT/ -p -x %HOSTIP:%PROXYPORT + + + +# +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE A +LIST +QUIT + + + diff --git a/tests/data/test275 b/tests/data/test275 index 145c163b3..713990544 100644 --- a/tests/data/test275 +++ b/tests/data/test275 @@ -41,12 +41,13 @@ contents http +http-proxy HTTP CONNECT with proxytunnel getting two URLs from the same host -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 @@ -56,21 +57,23 @@ http://remotesite.com/we/want/that/page/275 -p -x %HOSTIP:%HTTPPORT --user iam:m ^User-Agent:.* - -CONNECT remotesite.com:80 HTTP/1.1 -Host: remotesite.com:80 + +CONNECT remotesite.com:%HTTPPORT HTTP/1.1 +Host: remotesite.com:%HTTPPORT 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 Proxy-Connection: Keep-Alive + + GET /we/want/that/page/275 HTTP/1.1 Authorization: Basic aWFtOm15c2VsZg== -Host: remotesite.com +Host: remotesite.com:%HTTPPORT Accept: */* GET /we/want/that/page/275 HTTP/1.1 Authorization: Basic aWFtOm15c2VsZg== -Host: remotesite.com +Host: remotesite.com:%HTTPPORT Accept: */* diff --git a/tests/data/test503 b/tests/data/test503 index 3f29d8f6e..e7543593f 100644 --- a/tests/data/test503 +++ b/tests/data/test503 @@ -37,6 +37,7 @@ ETag: "21025-dc7-39462498" http +http-proxy # tool is what to use instead of 'curl' @@ -47,7 +48,7 @@ lib503 simple multi http:// through proxytunnel with authentication info -http://%HOSTIP:%HTTPSPORT/503 %HOSTIP:%HTTPPORT +http://%HOSTIP:%HTTPPORT/503 %HOSTIP:%PROXYPORT foo @@ -60,15 +61,17 @@ moo # Verify data after the test has been "shot" - -CONNECT %HOSTIP:%HTTPSPORT HTTP/1.1 -Host: %HOSTIP:%HTTPSPORT + +CONNECT %HOSTIP:%HTTPPORT HTTP/1.1 +Host: %HOSTIP:%HTTPPORT Proxy-Authorization: Basic dGVzdDppbmc= Proxy-Connection: Keep-Alive + + GET /503 HTTP/1.1 Authorization: Basic dGVzdDppbmc= -Host: %HOSTIP:%HTTPSPORT +Host: %HOSTIP:%HTTPPORT Accept: */* diff --git a/tests/data/test80 b/tests/data/test80 index a405af7a1..2fa196910 100644 --- a/tests/data/test80 +++ b/tests/data/test80 @@ -43,12 +43,13 @@ contents http +http-proxy -HTTP 1.0 CONNECT with proxytunnel and host Basic authentication +HTTP 1.0 CONNECT with proxytunnel and proxy+host Basic authentication -http://%HOSTIP:%HTTPPORT/we/want/that/page/80 -p --proxy1.0 %HOSTIP:%HTTPPORT --user iam:myself --proxy-user youare:yourself +http://%HOSTIP:%HTTPPORT/we/want/that/page/80 -p --proxy1.0 %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself @@ -58,13 +59,15 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/80 -p --proxy1.0 %HOSTIP:%HTTPPORT -- ^User-Agent:.* - + CONNECT %HOSTIP:%HTTPPORT HTTP/1.0 Host: %HOSTIP:%HTTPPORT 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 Proxy-Connection: Keep-Alive + + GET /we/want/that/page/80 HTTP/1.1 Authorization: Basic aWFtOm15c2VsZg== User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3 diff --git a/tests/data/test83 b/tests/data/test83 index 0ada5d1af..3015c9ca7 100644 --- a/tests/data/test83 +++ b/tests/data/test83 @@ -40,12 +40,13 @@ contents http +http-proxy HTTP over proxy-tunnel with site authentication -http://%HOSTIP:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%HTTPPORT --user iam:myself +http://%HOSTIP:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%PROXYPORT --user iam:myself @@ -55,12 +56,14 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%HTTPPORT --user iam ^User-Agent:.* - + CONNECT %HOSTIP:%HTTPPORT HTTP/1.1 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3 Host: %HOSTIP:%HTTPPORT Proxy-Connection: Keep-Alive + + GET /we/want/that/page/83 HTTP/1.1 Authorization: Basic aWFtOm15c2VsZg== User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3 diff --git a/tests/data/test95 b/tests/data/test95 index 9fea1bec1..55b0e6583 100644 --- a/tests/data/test95 +++ b/tests/data/test95 @@ -40,12 +40,13 @@ contents http +http-proxy HTTP over proxytunnel using POST -http://%HOSTIP:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%HTTPPORT -d "datatopost=ohthatsfunyesyes" +http://%HOSTIP:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%PROXYPORT -d "datatopost=ohthatsfunyesyes" @@ -55,12 +56,14 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%HTTPPORT -d "datato ^User-Agent:.* - + CONNECT %HOSTIP:%HTTPPORT HTTP/1.1 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3 Host: %HOSTIP:%HTTPPORT Proxy-Connection: Keep-Alive + + POST /we/want/that/page/95 HTTP/1.1 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3 Host: %HOSTIP:%HTTPPORT -- cgit v1.2.3