]> granicus.if.org Git - curl/commitdiff
test1509: verify proxy header response headers count
authorDaniel Stenberg <daniel@haxx.se>
Fri, 15 Mar 2013 16:28:32 +0000 (17:28 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 27 Mar 2013 14:30:46 +0000 (15:30 +0100)
Modified sws to support and use custom CONNECT responses instead of the
previously naive hard-coded version. Made the HTTP test server able to
extract test case number from the host name in a CONNECT request by
finding the number after the last dot. It makes 'machine.moo.123' use
test case 123.

Adapted a larger amount of tests to the new <connect> style.

Bug: http://curl.haxx.se/bug/view.cgi?id=1204
Reported by: Martin Jansen

30 files changed:
tests/FILEFORMAT
tests/data/Makefile.am
tests/data/test1008
tests/data/test1021
tests/data/test1059
tests/data/test1060
tests/data/test1061
tests/data/test1078
tests/data/test1097
tests/data/test1316
tests/data/test1319
tests/data/test1320
tests/data/test1321
tests/data/test1509 [new file with mode: 0644]
tests/data/test206
tests/data/test209
tests/data/test213
tests/data/test217
tests/data/test265
tests/data/test275
tests/data/test287
tests/data/test302
tests/data/test503
tests/data/test80
tests/data/test83
tests/data/test94
tests/data/test95
tests/libtest/Makefile.inc
tests/libtest/lib1509.c [new file with mode: 0644]
tests/server/sws.c

index 0029a8eec2d108765ae6f8c875175a49cf34149f..063925f099d367d9dd478ea273890e0ee3b361f1 100644 (file)
@@ -75,6 +75,11 @@ to complete a transfer. The response to each request is found in its own data
 section.  Validating the entire negotiation sequence can be done by
 specifying a datacheck section.
 </dataNUM>
+<connect>
+The connect section is used instead of the 'data' for all CONNECT
+requests. The remainder of the rules for the data section then apply but with
+a connect prefix.
+</connect>
 <datacheck [nonewline="yes"]>
 if the data is sent but this is what should be checked afterwards. If
 'nonewline' is set, we will cut off the trailing newline of this given data
@@ -247,13 +252,10 @@ that is returned. The last slash in the URL must be followed by a number. That
 number (N) will be used by the test-server to load test case N and return the
 data that is defined within the <reply><data></data></reply> section.
 
-If a CONNECT is used to the server (to emulate HTTPS etc over proxy), the port
-number given in the CONNECT request will be used to identify which test that
-is being run, if the proxy host name is said to start with 'test'.
-
-If there's no non-zero test number found in the above two places, the HTTP test
-server will use the number following the last dot in the given url so that
-"foo.bar.123" gets treated as test case 123.
+If there's no test number found above, the HTTP test server will use the
+number following the last dot in the given hostname (made so that a CONNECT
+can still pass on test number) so that "foo.bar.123" gets treated as test case
+123.
 
 Set type="perl" to write the test case as a perl script. It implies that
 there's no memory debugging and valgrind gets shut off for this test.
index a377c0ddd5c30ff4f3aeb8bac734908ebb1c4dd2..3d7b04e1d0c4894e0d3bcd976f28d40c7c3f3ab9 100644 (file)
@@ -109,7 +109,7 @@ test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
 test1408 test1409 test1410 test1411 test1412 test1413 \
 \
 test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
-test1508 \
+test1508 test1509 \
 \
 test1900 test1901 test1902 test1903 \
 \
index e576e719738cef377516dc77b9a00acd959b3372..30714f9af37b010759dbe6e429e75fa4c358419a 100644 (file)
@@ -16,7 +16,7 @@ connection-monitor
 </servercmd>
 
 # this is returned first since we get no proxy-auth
-<data1001>
+<connect1001>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==\r
 Transfer-Encoding: chunked\r
@@ -27,16 +27,16 @@ FA0
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r
 0\r
 \r
-</data1001>
+</connect1001>
 
 # This is supposed to be returned when the server gets the second
 # Authorization: NTLM line passed-in from the client
-<data1002>
+<connect1002>
 HTTP/1.1 200 Things are fine in proxy land\r
 Server: Microsoft-IIS/5.0\r
 Content-Type: text/html; charset=iso-8859-1\r
 \r
-</data1002>
+</connect1002>
 
 # this is returned when we get a GET!
 <data2>
@@ -96,7 +96,7 @@ CURL_GETHOSTNAME=curlhost
 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  </setenv>
  <command>
-http://test.remote.example.com:1008/path/10080002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel
+http://test.remote.example.com.1008:%HTTPPORT/path/10080002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel
 </command>
 <precheck>
 chkhostname curlhost
@@ -109,19 +109,19 @@ chkhostname curlhost
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.example.com:1008 HTTP/1.1\r
-Host: test.remote.example.com:1008\r
+CONNECT test.remote.example.com.1008:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.1008:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.example.com:1008 HTTP/1.1\r
-Host: test.remote.example.com:1008\r
+CONNECT test.remote.example.com.1008:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.1008:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=\r
 Proxy-Connection: Keep-Alive\r
 \r
 GET /path/10080002 HTTP/1.1\r
 User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4\r
-Host: test.remote.example.com:1008\r
+Host: test.remote.example.com.1008:%HTTPPORT\r
 Accept: */*\r
 \r
 [DISCONNECT]
index 1979f7507f94ab3dbe3cf86f582fc279ac3c18f6..81127249a1543ddc5c769bb62700fa5b6ab9de22 100644 (file)
@@ -12,32 +12,32 @@ HTTP proxy NTLM auth
 # Server-side
 <reply>
 
-<data>
+<connect>
 HTTP/1.1 407 Authorization Required to proxy me my dear swsclose\r
 Proxy-Authenticate: NTLM\r
 Content-Length: 21\r
 Connection: close\r
 
 data to discard
-</data>
+</connect>
 
 # this is returned first since we get no proxy-auth
-<data1001>
+<connect1001>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==\r
 Content-Length: 28\r
 
 And you should ignore this data.\r
-</data1001>
+</connect1001>
 
 # This is supposed to be returned when the server gets the second
 # Authorization: NTLM line passed-in from the client
-<data1002>
+<connect1002>
 HTTP/1.1 200 Things are fine in proxy land\r
 Server: Microsoft-IIS/5.0\r
 Content-Type: text/html; charset=iso-8859-1\r
 \r
-</data1002>
+</connect1002>
 
 # this is returned when we get a GET!
 <data2>
@@ -102,7 +102,7 @@ CURL_GETHOSTNAME=curlhost
 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  </setenv>
  <command>
-http://test.remote.example.com:1021/path/10210002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-anyauth --proxytunnel
+http://test.remote.example.com.1021:%HTTPPORT/path/10210002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-anyauth --proxytunnel
 </command>
 <precheck>
 chkhostname curlhost
@@ -115,23 +115,23 @@ chkhostname curlhost
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.example.com:1021 HTTP/1.1\r
-Host: test.remote.example.com:1021\r
+CONNECT test.remote.example.com.1021:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.1021:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.example.com:1021 HTTP/1.1\r
-Host: test.remote.example.com:1021\r
+CONNECT test.remote.example.com.1021:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.1021:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.example.com:1021 HTTP/1.1\r
-Host: test.remote.example.com:1021\r
+CONNECT test.remote.example.com.1021:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.1021:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=\r
 Proxy-Connection: Keep-Alive\r
 \r
 GET /path/10210002 HTTP/1.1\r
 User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4\r
-Host: test.remote.example.com:1021\r
+Host: test.remote.example.com.1021:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index 5a96de61ad82e3a6e48bb37b9f3de7006992fc76..6820ea6791eaef7d2177f50c2940222272e1f3a9 100644 (file)
@@ -12,13 +12,13 @@ FAILURE
 #
 # Server-side
 <reply>
-<data>
+<connect>
 HTTP/1.1 501 Method not implemented swsclose\r
 Date: Thu, 09 Nov 2010 14:49:00 GMT\r
 Connection: close\r
 Content-Length: 0\r
 \r
-</data>
+</connect>
 </reply>
 
 #
index 767a7ccc99cd4cfa77c51f23b7eb1d796989506a..da1be78b722562a188dcd2615e234114a567bd70 100644 (file)
@@ -14,7 +14,7 @@ HTTP proxy Digest auth
 <reply>
 
 # this is returned first since we get no proxy-auth
-<data>
+<connect>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345"\r
 Content-Length: 40000\r
@@ -820,7 +820,7 @@ And you should ignore this data. aaaaaaaaaaaaaaaa
 And you should ignore this data. aaaaaaaaaaaaaaaa
 And you should ignore this data. aaaaaaaaaaaaaaaa
 end of 1 KB aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-</data>
+</connect>
 
 # this is returned when we get a GET!
 <data2>
@@ -835,12 +835,12 @@ daniel
 </data2>
 
 # then this is returned when we get proxy-auth
-<data1000>
+<connect1000>
 HTTP/1.1 200 OK swsbounce\r
 Server: no
 \r
 Nice proxy auth sir!
-</data1000>
+</connect1000>
 
 <datacheck>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
@@ -874,7 +874,7 @@ crypto
 HTTP proxy CONNECT auth Digest, large headers and data
  </name>
  <command>
-http://test.remote.haxx.se:1060/path/10600002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-digest --proxytunnel
+http://test.remote.haxx.se.1060:%HTTPPORT/path/10600002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-digest --proxytunnel
 </command>
 </client>
 
@@ -884,17 +884,17 @@ http://test.remote.haxx.se:1060/path/10600002 --proxy http://%HOSTIP:%HTTPPORT -
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.haxx.se:1060 HTTP/1.1\r
-Host: test.remote.haxx.se:1060\r
+CONNECT test.remote.haxx.se.1060:%HTTPPORT HTTP/1.1\r
+Host: test.remote.haxx.se.1060:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.haxx.se:1060 HTTP/1.1\r
-Host: test.remote.haxx.se:1060\r
-Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se:1060", response="79e394ffcd42b6c771c7582da1fc4498"\r
+CONNECT test.remote.haxx.se.1060:%HTTPPORT HTTP/1.1\r
+Host: test.remote.haxx.se.1060:%HTTPPORT\r
+Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se.1060:%HTTPPORT", response="e1fbed39c26f4efe284adc0e576ff638"\r
 Proxy-Connection: Keep-Alive\r
 \r
 GET /path/10600002 HTTP/1.1\r
-Host: test.remote.haxx.se:1060\r
+Host: test.remote.haxx.se.1060:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index 0fb8c51104f972b5980eb4b7e3d322fc056cbce2..05c3209c47d488e107272ffe94365a5ff17e25e3 100644 (file)
@@ -15,7 +15,7 @@ HTTP proxy Digest auth
 <reply>
 
 # this is returned first since we get no proxy-auth
-<data>
+<connect>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345"\r
 Transfer-Encoding: chunked\r
@@ -825,7 +825,7 @@ end of 1 KB aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 \r
 0\r
 \r
-</data>
+</connect>
 
 # this is returned when we get a GET!
 <data2>
@@ -840,12 +840,12 @@ daniel
 </data2>
 
 # then this is returned when we get proxy-auth
-<data1000>
+<connect1000>
 HTTP/1.1 200 OK swsbounce\r
 Server: no
 \r
 Nice proxy auth sir!
-</data1000>
+</connect1000>
 
 <datacheck>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
@@ -879,7 +879,7 @@ crypto
 HTTP proxy CONNECT auth Digest, large headers and chunked data
  </name>
  <command>
-http://test.remote.haxx.se:1061/path/10610002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-digest --proxytunnel
+http://test.remote.haxx.se.1061:%HTTPPORT/path/10610002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-digest --proxytunnel
 </command>
 </client>
 
@@ -889,17 +889,17 @@ http://test.remote.haxx.se:1061/path/10610002 --proxy http://%HOSTIP:%HTTPPORT -
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.haxx.se:1061 HTTP/1.1\r
-Host: test.remote.haxx.se:1061\r
+CONNECT test.remote.haxx.se.1061:%HTTPPORT HTTP/1.1\r
+Host: test.remote.haxx.se.1061:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.haxx.se:1061 HTTP/1.1\r
-Host: test.remote.haxx.se:1061\r
-Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se:1061", response="8e96acf6a6214012183879e28e73b2d3"\r
+CONNECT test.remote.haxx.se.1061:%HTTPPORT HTTP/1.1\r
+Host: test.remote.haxx.se.1061:%HTTPPORT\r
+Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se.1061:%HTTPPORT", response="4e23449fa93224834299e7282a70472c"\r
 Proxy-Connection: Keep-Alive\r
 \r
 GET /path/10610002 HTTP/1.1\r
-Host: test.remote.haxx.se:1061\r
+Host: test.remote.haxx.se.1061:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index cacdf4dd490a3d2b25fe23c6c1f970fc3b8207bf..a9bb771be7110cbb591c09e0988b27792736affb 100644 (file)
@@ -13,6 +13,12 @@ proxytunnel
 #
 # Server-side
 <reply>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+Server: test tunnel 2000\r
+\r
+</connect>
+
 <data nocheck="yes">
 HTTP/1.0 200 OK\r
 Date: Thu, 09 Nov 2010 14:49:00 GMT\r
@@ -37,7 +43,7 @@ http-proxy
 HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0
  </name>
  <command>
---proxy1.0 %HOSTIP:%PROXYPORT -p http://%HOSTIP:%HTTPPORT/we/want/that/page/1078 http://%HOSTIP:%HTTPPORT/we/want/that/page/1078
+--proxy1.0 %HOSTIP:%PROXYPORT -p http://%HOSTIP.1078:%HTTPPORT/we/want/that/page/1078 http://%HOSTIP.1078:%HTTPPORT/we/want/that/page/1078
 </command>
 </client>
 
@@ -48,23 +54,24 @@ HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0
 ^User-Agent:.*
 </strip>
 <proxy>
-CONNECT %HOSTIP:%HTTPPORT HTTP/1.0\r
-Host: %HOSTIP:%HTTPPORT\r
+CONNECT %HOSTIP.1078:%HTTPPORT HTTP/1.0\r
+Host: %HOSTIP.1078:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
 </proxy>
 <protocol>
 GET /we/want/that/page/1078 HTTP/1.1\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: %HOSTIP.1078:%HTTPPORT\r
 Accept: */*\r
 \r
 GET /we/want/that/page/1078 HTTP/1.0\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: %HOSTIP.1078:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
 <stdout>
 HTTP/1.1 200 Mighty fine indeed\r
+Server: test tunnel 2000\r
 \r
 HTTP/1.0 200 OK\r
 Date: Thu, 09 Nov 2010 14:49:00 GMT\r
index ebb039962765b44152d37ddb9bd02b64ab36b88b..b899810d09166e175096827dd7557756d4c06e94 100644 (file)
@@ -18,13 +18,15 @@ Content-Length: 27
 
 This is all fine and dandy
 </data>
-<data1001>
+
+<connect1001>
 HTTP/1.1 200 We are fine and cool\r
 Server: Apache/1.3.27 (Dorw1n) PHP/44.1.2\r
 Content-Length: 27\r
 
 This is all fine and dandy
-</data1001>
+</connect1001>
+
 <datacheck>
 HTTP/1.1 200 We are fine and cool\r
 Server: Apache/1.3.27 (Dorw1n) PHP/44.1.2\r
@@ -50,7 +52,7 @@ NTLM
 HTTP POST using CONNECT with --proxy-ntlm but no auth is required
  </name>
  <command>
-http://test.a.galaxy.far.far.away:1097/1097 --proxy http://%HOSTIP:%HTTPPORT --proxy-user foo:bar --proxy-ntlm -d "dummy=value" -p
+http://test.a.galaxy.far.far.away.1097:%HTTPPORT/1097 --proxy http://%HOSTIP:%HTTPPORT --proxy-user foo:bar --proxy-ntlm -d "dummy=value" -p
 </command>
 </client>
 
@@ -60,15 +62,15 @@ http://test.a.galaxy.far.far.away:1097/1097 --proxy http://%HOSTIP:%HTTPPORT --p
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.a.galaxy.far.far.away:1097 HTTP/1.1\r
-Host: test.a.galaxy.far.far.away:1097\r
+CONNECT test.a.galaxy.far.far.away.1097:%HTTPPORT HTTP/1.1\r
+Host: test.a.galaxy.far.far.away.1097:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
 User-Agent: curl/7.19.5-CVS (i686-pc-linux-gnu) libcurl/7.19.5-CVS OpenSSL/0.9.8g zlib/1.2.3.3 c-ares/1.6.1-CVS libidn/1.12 libssh2/1.0.1_CVS\r
 Proxy-Connection: Keep-Alive\r
 \r
 POST /1097 HTTP/1.1\r
 User-Agent: curl/7.19.5-CVS (i686-pc-linux-gnu) libcurl/7.19.5-CVS OpenSSL/0.9.8g zlib/1.2.3.3 c-ares/1.6.1-CVS libidn/1.12 libssh2/1.0.1_CVS\r
-Host: test.a.galaxy.far.far.away:1097\r
+Host: test.a.galaxy.far.far.away.1097:%HTTPPORT\r
 Accept: */*\r
 Content-Length: 0\r
 Content-Type: application/x-www-form-urlencoded\r
index e65bd5f6a0308b9ceae4f60e8179aedd3cd583bc..51f58c26869d15f0d9cf4ff8b1d69d8a9ad2b6a1 100644 (file)
@@ -12,12 +12,21 @@ HTTP proxy
 #
 # Server-side
 <reply>
+
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+Magic: sure you can FTP me\r
+\r
+</connect>
+
 # When doing LIST, we get the default list output hard-coded in the test
 # FTP server
 <datacheck>
 HTTP/1.1 200 Mighty fine indeed\r
+Magic: sure you can FTP me\r
 \r
 HTTP/1.1 200 Mighty fine indeed\r
+Magic: sure you can FTP me\r
 \r
 total 20
 drwxr-xr-x   8 98       98           512 Oct 22 13:06 .
@@ -36,6 +45,11 @@ dr-xr-xr-x   5 0        1            512 Oct  1  1997 usr
 #
 # Client-side
 <client>
+
+# please send the real CONNECT connect off to the FTP server's port
+<connectport>
+%FTPPORT
+</connectport>
 <server>
 ftp
 http-proxy
@@ -44,7 +58,7 @@ http-proxy
 FTP LIST tunneled through HTTP proxy
  </name>
  <command>
-ftp://%HOSTIP:%FTPPORT/ -p -x %HOSTIP:%PROXYPORT
+ftp://ftp.1316:%FTPPORT/ -p -x %HOSTIP:%PROXYPORT
 </command>
 </client>
 
index dc46a69a527fcdb98d06e268ade2d230f08e6bfa..7818503bd2bff358299dc55a9d00c3019457ca77 100644 (file)
@@ -11,6 +11,13 @@ HTTP proxy
 #
 # Server-side
 <reply>
+
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+pop3: sure hit me\r
+\r
+</connect>
+
 # When doing LIST, we get the default list output hard-coded in the test
 # FTP server
 <data>
@@ -25,6 +32,7 @@ body
 
 <datacheck>
 HTTP/1.1 200 Mighty fine indeed\r
+pop3: sure hit me\r
 \r
 From: me@somewhere
 To: fake@nowhere
@@ -47,7 +55,7 @@ http-proxy
 POP3 fetch tunneled through HTTP proxy
  </name>
  <command>
-pop3://%HOSTIP:%POP3PORT/1319 -p -x %HOSTIP:%PROXYPORT -u user:secret
+pop3://pop.1319:%POP3PORT/1319 -p -x %HOSTIP:%PROXYPORT -u user:secret
 </command>
 </client>
 
@@ -65,8 +73,8 @@ RETR 1319
 QUIT\r
 </protocol>
 <proxy>
-CONNECT %HOSTIP:%POP3PORT HTTP/1.1\r
-Host: %HOSTIP:%POP3PORT\r
+CONNECT pop.1319:%POP3PORT HTTP/1.1\r
+Host: pop.1319:%POP3PORT\r
 User-Agent: curl/7.24.0-DEV (i686-pc-linux-gnu) libcurl/7.24.0-DEV OpenSSL/1.0.0e zlib/1.2.3.4 c-ares/1.7.6-DEV libidn/1.23 libssh2/1.4.0_DEV librtmp/2.2e\r
 Proxy-Connection: Keep-Alive\r
 \r
index f7af40aa1fcc37499ac6122ab4b6030b38a9dedf..7ccf6724684c036a4abdf7a17acfc37136f33755 100644 (file)
@@ -11,6 +11,11 @@ HTTP proxy
 #
 # Server-side
 <reply>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+smtp: sure hit me\r
+\r
+</connect>
 </reply>
 
 #
@@ -30,7 +35,7 @@ To: another
 body
 </stdin>
  <command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 1320@foo --mail-rcpt 1320@foobar.example --mail-from 1320@from -T - -p -x %HOSTIP:%PROXYPORT
+smtp://smtp.1320:%SMTPPORT/user --mail-rcpt 1320@foo --mail-rcpt 1320@foobar.example --mail-from 1320@from -T - -p -x %HOSTIP:%PROXYPORT
 </command>
 </client>
 
@@ -57,8 +62,8 @@ body
 .\r
 </upload>
 <proxy>
-CONNECT %HOSTIP:%SMTPPORT HTTP/1.1\r
-Host: %HOSTIP:%SMTPPORT\r
+CONNECT smtp.1320:%SMTPPORT HTTP/1.1\r
+Host: smtp.1320:%SMTPPORT\r
 User-Agent: curl/7.24.0-DEV (i686-pc-linux-gnu) libcurl/7.24.0-DEV OpenSSL/1.0.0e zlib/1.2.3.4 c-ares/1.7.6-DEV libidn/1.23 libssh2/1.4.0_DEV librtmp/2.2e\r
 Proxy-Connection: Keep-Alive\r
 \r
index 74f5a1d991ac033ffeff049ecfa75e59088bc45f..bfa31e00c942e71da12d50660d27e457a331d351 100644 (file)
@@ -12,6 +12,11 @@ HTTP proxy
 #
 # Server-side
 <reply>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+imap: sure hit me\r
+\r
+</connect>
 <data>
 From: me@somewhere\r
 To: fake@nowhere\r
@@ -23,6 +28,7 @@ body
 </data>
 <datacheck>
 HTTP/1.1 200 Mighty fine indeed\r
+imap: sure hit me\r
 \r
 From: me@somewhere\r
 To: fake@nowhere\r
@@ -45,7 +51,7 @@ http-proxy
 IMAP FETCH tunneled through HTTP proxy
  </name>
  <command>
-'imap://%HOSTIP:%IMAPPORT/1321/;UID=1' -u user:secret -p -x %HOSTIP:%PROXYPORT
+'imap://imap.1321:%IMAPPORT/1321/;UID=1' -u user:secret -p -x %HOSTIP:%PROXYPORT
 </command>
 </client>
 
@@ -63,8 +69,8 @@ A004 FETCH 1 BODY[]
 A005 LOGOUT\r
 </protocol>
 <proxy>
-CONNECT %HOSTIP:%IMAPPORT HTTP/1.1\r
-Host: %HOSTIP:%IMAPPORT\r
+CONNECT imap.1321:%IMAPPORT HTTP/1.1\r
+Host: imap.1321:%IMAPPORT\r
 User-Agent: curl/7.24.0-DEV (i686-pc-linux-gnu) libcurl/7.24.0-DEV OpenSSL/1.0.0e zlib/1.2.3.4 c-ares/1.7.6-DEV libidn/1.23 libssh2/1.4.0_DEV librtmp/2.2e\r
 Proxy-Connection: Keep-Alive\r
 \r
diff --git a/tests/data/test1509 b/tests/data/test1509
new file mode 100644 (file)
index 0000000..dd68b05
--- /dev/null
@@ -0,0 +1,88 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+HTTP CONNECT
+HTTP proxy
+proxytunnel
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<servercmd>
+connection-monitor
+</servercmd>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+Server: the beast that eats naughty clients\r
+\r
+</connect>
+
+<data>
+HTTP/1.1 200 OK swsclose
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+
+</data>
+<datacheck>
+HTTP/1.1 200 Mighty fine indeed\r
+Server: the beast that eats naughty clients\r
+\r
+HTTP/1.1 200 OK swsclose
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+
+header length is ........: 239
+header length should be..: 239
+</datacheck>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+http-proxy
+</server>
+# tool is what to use instead of 'curl'
+<tool>
+lib1509
+</tool>
+
+ <name>
+simple multi http:// through proxytunnel with authentication info
+ </name>
+ <command>
+http://the.old.moo.1509:%HTTPPORT/1509 %HOSTIP:%PROXYPORT
+</command>
+<file name="log/test1509.txt">
+foo
+   bar
+bar
+   foo
+moo
+</file>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<proxy>
+CONNECT the.old.moo.1509:%HTTPPORT HTTP/1.1\r
+Host: the.old.moo.1509:%HTTPPORT\r
+Proxy-Connection: Keep-Alive\r
+\r
+</proxy>
+<protocol>
+GET /1509 HTTP/1.1\r
+Host: the.old.moo.1509:%HTTPPORT\r
+Accept: */*\r
+\r
+[DISCONNECT]
+</protocol>
+</verify>
+</testcase>
index 9c1e0248df39129fe64206c2585896709453c6ad..3ddc1d995416e590d4889c32c6ae2dde577108a1 100644 (file)
@@ -14,16 +14,18 @@ HTTP proxy Digest auth
 <reply>
 <servercmd>
 connection-monitor
+auth_required
 </servercmd>
 
+
 # this is returned first since we get no proxy-auth
-<data>
+<connect>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345"\r
 Content-Length: 33\r
 \r
 And you should ignore this data.
-</data>
+</connect>
 
 # this is returned when we get a GET!
 <data2>
@@ -38,11 +40,11 @@ daniel
 </data2>
 
 # then this is returned when we get proxy-auth
-<data1000>
+<connect1000>
 HTTP/1.1 200 OK swsbounce\r
 Server: no
 \r
-</data1000>
+</connect1000>
 
 <datacheck>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
@@ -75,7 +77,7 @@ crypto
 HTTP proxy CONNECT auth Digest
  </name>
  <command>
-http://test.remote.haxx.se:206/path/2060002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-digest --proxytunnel
+http://test.remote.haxx.se.206:%HTTPPORT/path/2060002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-digest --proxytunnel
 </command>
 </client>
 
@@ -85,18 +87,18 @@ http://test.remote.haxx.se:206/path/2060002 --proxy http://%HOSTIP:%HTTPPORT --p
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.haxx.se:206 HTTP/1.1\r
-Host: test.remote.haxx.se:206\r
+CONNECT test.remote.haxx.se.206:%HTTPPORT HTTP/1.1\r
+Host: test.remote.haxx.se.206:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.haxx.se:206 HTTP/1.1\r
-Host: test.remote.haxx.se:206\r
-Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se:206", response="676e0836f3e1c5b31bf29770ef9d8224"\r
+CONNECT test.remote.haxx.se.206:%HTTPPORT HTTP/1.1\r
+Host: test.remote.haxx.se.206:%HTTPPORT\r
+Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se.206:%HTTPPORT", response="003e36decb4dbf6366b3ecb9b87c24ec"\r
 Proxy-Connection: Keep-Alive\r
 \r
 GET /path/2060002 HTTP/1.1\r
 User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4\r
-Host: test.remote.haxx.se:206\r
+Host: test.remote.haxx.se.206:%HTTPPORT\r
 Accept: */*\r
 \r
 [DISCONNECT]
index b248faf9ff5ee97b9e8d0428465a1906328d307c..d8bd8bd242d096ace10c66ae1f7e4bed1e5e7f91 100644 (file)
@@ -13,21 +13,21 @@ HTTP proxy NTLM auth
 <reply>
 
 # this is returned first since we get no proxy-auth
-<data1001>
+<connect1001>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==\r
 \r
 And you should ignore this data.
-</data1001>
+</connect1001>
 
 # This is supposed to be returned when the server gets the second
 # Authorization: NTLM line passed-in from the client
-<data1002>
+<connect1002>
 HTTP/1.1 200 Things are fine in proxy land\r
 Server: Microsoft-IIS/5.0\r
 Content-Type: text/html; charset=iso-8859-1\r
 \r
-</data1002>
+</connect1002>
 
 # this is returned when we get a GET!
 <data2>
@@ -86,7 +86,7 @@ CURL_GETHOSTNAME=curlhost
 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  </setenv>
  <command>
-http://test.remote.example.com:209/path/2090002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel
+http://test.remote.example.com.209:%HTTPPORT/path/2090002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel
 </command>
 <precheck>
 chkhostname curlhost
@@ -99,19 +99,19 @@ chkhostname curlhost
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.example.com:209 HTTP/1.1\r
-Host: test.remote.example.com:209\r
+CONNECT test.remote.example.com.209:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.209:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.example.com:209 HTTP/1.1\r
-Host: test.remote.example.com:209\r
+CONNECT test.remote.example.com.209:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.209:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=\r
 Proxy-Connection: Keep-Alive\r
 \r
 GET /path/2090002 HTTP/1.1\r
 User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4\r
-Host: test.remote.example.com:209\r
+Host: test.remote.example.com.209:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index 55b20b0d8d8733529c510e7bd95a95b27dc5deff..5c14aa875666b9b79b23a8d5994bdeec8451b4ba 100644 (file)
@@ -13,21 +13,21 @@ HTTP proxy NTLM auth
 <reply>
 
 # this is returned first since we get no proxy-auth
-<data1001>
+<connect1001>
 HTTP/1.1 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==\r
 \r
 And you should ignore this data.
-</data1001>
+</connect1001>
 
 # This is supposed to be returned when the server gets the second
 # Authorization: NTLM line passed-in from the client
-<data1002>
+<connect1002>
 HTTP/1.1 200 Things are fine in proxy land\r
 Server: Microsoft-IIS/5.0\r
 Content-Type: text/html; charset=iso-8859-1\r
 \r
-</data1002>
+</connect1002>
 
 # this is returned when we get a GET!
 <data2>
@@ -86,7 +86,7 @@ CURL_GETHOSTNAME=curlhost
 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  </setenv>
  <command>
-http://test.remote.example.com:213/path/2130002 --proxy1.0 http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel -d "postit"
+http://test.remote.example.com.213:%HTTPPORT/path/2130002 --proxy1.0 http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel -d "postit"
 </command>
 <precheck>
 chkhostname curlhost
@@ -99,19 +99,19 @@ chkhostname curlhost
 ^User-Agent: curl/.*
 </strip>
 <protocol nonewline="yes">
-CONNECT test.remote.example.com:213 HTTP/1.0\r
-Host: test.remote.example.com:213\r
+CONNECT test.remote.example.com.213:%HTTPPORT HTTP/1.0\r
+Host: test.remote.example.com.213:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.example.com:213 HTTP/1.0\r
-Host: test.remote.example.com:213\r
+CONNECT test.remote.example.com.213:%HTTPPORT HTTP/1.0\r
+Host: test.remote.example.com.213:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=\r
 Proxy-Connection: Keep-Alive\r
 \r
 POST /path/2130002 HTTP/1.1\r
 User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4\r
-Host: test.remote.example.com:213\r
+Host: test.remote.example.com.213:%HTTPPORT\r
 Accept: */*\r
 Content-Length: 6\r
 Content-Type: application/x-www-form-urlencoded\r
index 4b1bed9c941674268f229cf21b611a431a81b03d..f10df566b7b9fd02f395b38fe37e226d2010c81d 100644 (file)
@@ -15,11 +15,11 @@ followlocation
 <reply>
 
 # this is returned first since we get no proxy-auth
-<data nocheck="yes">
+<connect nocheck="yes">
 HTTP/1.1 405 Method Not Allowed swsclose\r
 \r
 And you should ignore this data.
-</data>
+</connect>
 
 </reply>
 
@@ -32,7 +32,7 @@ http
 HTTP proxy CONNECT to proxy returning 405
  </name>
  <command>
-http://test.remote.example.com:217/path/2170002 --proxy http://%HOSTIP:%HTTPPORT --proxytunnel -w "%{http_code} %{http_connect}\n"
+http://test.remote.example.com.217:%HTTPPORT/path/2170002 --proxy http://%HOSTIP:%HTTPPORT --proxytunnel -w "%{http_code} %{http_connect}\n"
 </command>
 </client>
 
@@ -42,8 +42,8 @@ http://test.remote.example.com:217/path/2170002 --proxy http://%HOSTIP:%HTTPPORT
 ^User-Agent: curl/.*
 </strip>
 <protocol>
-CONNECT test.remote.example.com:217 HTTP/1.1\r
-Host: test.remote.example.com:217\r
+CONNECT test.remote.example.com.217:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.217:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
 </protocol>
index dfac8bfafc4ad540e5c770e710d6020eed3c775d..07de45547149af73a2608b311b0e7407170e6b5e 100644 (file)
@@ -13,23 +13,23 @@ HTTP proxy NTLM auth
 <reply>
 
 # this is returned first since we get no proxy-auth
-<data1001>
+<connect1001>
 HTTP/1.0 407 Authorization Required to proxy me my dear\r
 Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==\r
 Content-Length: 1033\r
 \r
 And you should ignore this data.
 QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQz
-</data1001>
+</connect1001>
 
 # This is supposed to be returned when the server gets the second
 # Authorization: NTLM line passed-in from the client
-<data1002>
+<connect1002>
 HTTP/1.1 200 Things are fine in proxy land\r
 Server: Microsoft-IIS/5.0\r
 Content-Type: text/html; charset=iso-8859-1\r
 \r
-</data1002>
+</connect1002>
 
 # this is returned when we get a GET!
 <data2>
@@ -89,7 +89,7 @@ CURL_GETHOSTNAME=curlhost
 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  </setenv>
  <command>
-http://test.remote.example.com:265/path/2650002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel -d "postit"
+http://test.remote.example.com.265:%HTTPPORT/path/2650002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel -d "postit"
 </command>
 <precheck>
 chkhostname curlhost
@@ -102,19 +102,19 @@ chkhostname curlhost
 ^User-Agent: curl/.*
 </strip>
 <protocol nonewline="yes">
-CONNECT test.remote.example.com:265 HTTP/1.1\r
-Host: test.remote.example.com:265\r
+CONNECT test.remote.example.com.265:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.265:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
 Proxy-Connection: Keep-Alive\r
 \r
-CONNECT test.remote.example.com:265 HTTP/1.1\r
-Host: test.remote.example.com:265\r
+CONNECT test.remote.example.com.265:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.265:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=\r
 Proxy-Connection: Keep-Alive\r
 \r
 POST /path/2650002 HTTP/1.1\r
 User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4\r
-Host: test.remote.example.com:265\r
+Host: test.remote.example.com.265:%HTTPPORT\r
 Accept: */*\r
 Content-Length: 6\r
 Content-Type: application/x-www-form-urlencoded\r
index 713990544c660957deb792c764eb177367bda73c..ac54e25945f838ea147fa2367c42accd65c43655 100644 (file)
@@ -14,6 +14,12 @@ proxytunnel
 #
 # Server-side
 <reply>
+<connect>
+HTTP/1.1 200 OK\r
+Connected-fine: sure\r
+\r
+</connect>
+
 <data>
 HTTP/1.1 200 OK
 Date: Thu, 09 Nov 2010 14:49:00 GMT
@@ -24,7 +30,8 @@ Content-Length: 9
 contents
 </data>
 <datacheck>
-HTTP/1.1 200 Mighty fine indeed\r
+HTTP/1.1 200 OK\r
+Connected-fine: sure\r
 \r
 HTTP/1.1 200 OK
 Date: Thu, 09 Nov 2010 14:49:00 GMT
@@ -47,7 +54,7 @@ http-proxy
 HTTP CONNECT with proxytunnel getting two URLs from the same host
  </name>
  <command>
-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
+http://remotesite.com.275:%HTTPPORT/we/want/that/page/275 -p -x %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself http://remotesite.com.275:%HTTPPORT/we/want/that/page/275
 </command>
 </client>
 
@@ -58,8 +65,8 @@ http://remotesite.com:%HTTPPORT/we/want/that/page/275 -p -x %HOSTIP:%PROXYPORT -
 ^User-Agent:.*
 </strip>
 <proxy>
-CONNECT remotesite.com:%HTTPPORT HTTP/1.1\r
-Host: remotesite.com:%HTTPPORT\r
+CONNECT remotesite.com.275:%HTTPPORT HTTP/1.1\r
+Host: remotesite.com.275:%HTTPPORT\r
 Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
 Proxy-Connection: Keep-Alive\r
@@ -68,12 +75,12 @@ Proxy-Connection: Keep-Alive
 <protocol>
 GET /we/want/that/page/275 HTTP/1.1\r
 Authorization: Basic aWFtOm15c2VsZg==\r
-Host: remotesite.com:%HTTPPORT\r
+Host: remotesite.com.275:%HTTPPORT\r
 Accept: */*\r
 \r
 GET /we/want/that/page/275 HTTP/1.1\r
 Authorization: Basic aWFtOm15c2VsZg==\r
-Host: remotesite.com:%HTTPPORT\r
+Host: remotesite.com.275:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index 323d3f3928962c0c77cb569eb2f91ed30b53d05a..ec4dfeb05b03d0100e27e61302a014d656e4782f 100644 (file)
@@ -11,12 +11,11 @@ proxytunnel
 # Server-side
 <reply>
 
-# this is returned first since we get no proxy-auth
-<data nocheck="yes">
+<connect nocheck="yes">
 HTTP/1.1 405 Method Not Allowed swsclose\r
 \r
 And you should ignore this data.
-</data>
+</connect>
 
 </reply>
 
@@ -29,15 +28,15 @@ http
 HTTP proxy CONNECT with custom User-Agent header
  </name>
  <command>
-http://test.remote.example.com:287/path/287 -H "User-Agent: looser/2007" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel
+http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/2007" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel
 </command>
 </client>
 
 # Verify data after the test has been "shot"
 <verify>
 <protocol>
-CONNECT test.remote.example.com:287 HTTP/1.1\r
-Host: test.remote.example.com:287\r
+CONNECT test.remote.example.com.287:%HTTPPORT HTTP/1.1\r
+Host: test.remote.example.com.287:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 User-Agent: looser/2007\r
 \r
index 1223f1c3313c81c5421096f90b0a15bb470ff41b..7bb162b41660b51d7d2dc8d1ed9bbd7803731634 100644 (file)
@@ -9,6 +9,17 @@ FAILURE
 </keywords>
 </info>
 
+# Server-side
+<reply>
+
+<connect nocheck="yes">
+HTTP/1.1 405 Method Not Allowed swsclose\r
+\r
+And you should ignore this data.
+</connect>
+
+</reply>
+
 # Client-side
 <client>
 <features>
@@ -21,7 +32,7 @@ https
 HTTPS GET over HTTP proxy fails
  </name>
  <command>
--k -U fake:user -x %HOSTIP:%HTTPPORT https://bad.fakeurl-to.test/slash/302
+-k -U fake:user -x %HOSTIP:%HTTPPORT https://bad.fakeurl-to.test:302/slash/302
 </command>
 </client>
 
index 2acfc4a16d38dfc5f9150b02f6f521ed17b59d86..ea31483006de9aefdf16899299047fb2fc7ef9f5 100644 (file)
@@ -16,6 +16,10 @@ multi
 <servercmd>
 connection-monitor
 </servercmd>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
 <data>
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
@@ -51,7 +55,7 @@ lib503
 simple multi http:// through proxytunnel with authentication info
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/503 %HOSTIP:%PROXYPORT
+http://machine.503:%HTTPPORT/503 %HOSTIP:%PROXYPORT
 </command>
 <file name="log/test503.txt">
 foo
@@ -65,8 +69,8 @@ moo
 # Verify data after the test has been "shot"
 <verify>
 <proxy>
-CONNECT %HOSTIP:%HTTPPORT HTTP/1.1\r
-Host: %HOSTIP:%HTTPPORT\r
+CONNECT machine.503:%HTTPPORT HTTP/1.1\r
+Host: machine.503:%HTTPPORT\r
 Proxy-Authorization: Basic dGVzdDppbmc=\r
 Proxy-Connection: Keep-Alive\r
 \r
@@ -74,7 +78,7 @@ Proxy-Connection: Keep-Alive
 <protocol>
 GET /503 HTTP/1.1\r
 Authorization: Basic dGVzdDppbmc=\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: machine.503:%HTTPPORT\r
 Accept: */*\r
 \r
 [DISCONNECT]
index 2fa196910cc15eaf6d446c374525363958adeeb1..16805cabb5548680f0dfd71f423ee3bfc992de89 100644 (file)
@@ -24,6 +24,10 @@ Content-Length: 9
 
 contents
 </data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
 <datacheck>
 HTTP/1.1 200 Mighty fine indeed\r
 \r
@@ -49,7 +53,7 @@ http-proxy
 HTTP 1.0 CONNECT with proxytunnel and proxy+host Basic authentication
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/we/want/that/page/80 -p --proxy1.0 %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself
+http://test.80:%HTTPPORT/we/want/that/page/80 -p --proxy1.0 %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself
 </command>
 </client>
 
@@ -60,8 +64,8 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/80 -p --proxy1.0 %HOSTIP:%PROXYPORT -
 ^User-Agent:.*
 </strip>
 <proxy>
-CONNECT %HOSTIP:%HTTPPORT HTTP/1.0\r
-Host: %HOSTIP:%HTTPPORT\r
+CONNECT test.80:%HTTPPORT HTTP/1.0\r
+Host: test.80:%HTTPPORT\r
 Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
 Proxy-Connection: Keep-Alive\r
@@ -71,7 +75,7 @@ Proxy-Connection: Keep-Alive
 GET /we/want/that/page/80 HTTP/1.1\r
 Authorization: Basic aWFtOm15c2VsZg==\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: test.80:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index 3015c9ca78005635b321751dc69d882db5bbebfd..4386c12b931068fbf21475f979ec2975d6902098 100644 (file)
@@ -21,6 +21,10 @@ Content-Length: 9
 
 contents
 </data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
 <datacheck>
 HTTP/1.1 200 Mighty fine indeed\r
 \r
@@ -46,7 +50,7 @@ http-proxy
 HTTP over proxy-tunnel with site authentication
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%PROXYPORT --user iam:myself
+http://test.83:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%PROXYPORT --user iam:myself
 </command>
 </client>
 
@@ -57,9 +61,9 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%PROXYPORT --user ia
 ^User-Agent:.*
 </strip>
 <proxy>
-CONNECT %HOSTIP:%HTTPPORT HTTP/1.1\r
+CONNECT test.83:%HTTPPORT HTTP/1.1\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: test.83:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
 </proxy>
@@ -67,7 +71,7 @@ Proxy-Connection: Keep-Alive
 GET /we/want/that/page/83 HTTP/1.1\r
 Authorization: Basic aWFtOm15c2VsZg==\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: test.83:%HTTPPORT\r
 Accept: */*\r
 \r
 </protocol>
index a7bafa6958de6134a6c6fb8589250c98b1a7f460..2f3f4824df9bb01d3d3982a72bea9296a2099356 100644 (file)
@@ -11,14 +11,14 @@ FAILURE
 #
 # Server-side
 <reply>
-<data nocheck="yes">
+<connect nocheck="yes">
 HTTP/1.1 407 Needs proxy authentication
 Server: test-server/fake swsclose yesyes
 Proxy-Authenticate: Basic "oh please"
 Connection: close
 
 bing
-</data>
+</connect>
 </reply>
 
 #
index 55b0e65833a795c709d354da7064d24531b507ab..1cd88acab63c2a573227c3cff54688cd54e42c96 100644 (file)
@@ -21,6 +21,10 @@ Content-Length: 9
 
 contents
 </data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
 <datacheck>
 HTTP/1.1 200 Mighty fine indeed\r
 \r
@@ -46,7 +50,7 @@ http-proxy
 HTTP over proxytunnel using POST
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%PROXYPORT -d "datatopost=ohthatsfunyesyes"
+http://test.95:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%PROXYPORT -d "datatopost=ohthatsfunyesyes"
 </command>
 </client>
 
@@ -57,16 +61,16 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%PROXYPORT -d "datat
 ^User-Agent:.*
 </strip>
 <proxy>
-CONNECT %HOSTIP:%HTTPPORT HTTP/1.1\r
+CONNECT test.95:%HTTPPORT HTTP/1.1\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: test.95:%HTTPPORT\r
 Proxy-Connection: Keep-Alive\r
 \r
 </proxy>
 <protocol nonewline="yes">
 POST /we/want/that/page/95 HTTP/1.1\r
 User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: test.95:%HTTPPORT\r
 Accept: */*\r
 Content-Length: 27\r
 Content-Type: application/x-www-form-urlencoded\r
index b880e4ca40adccaa6b55decd092be036dadf0953..4cc2f80d2fe78a8a333cab7f3f2dbd3ab91935cc 100644 (file)
@@ -21,6 +21,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect                \
  lib571 lib572 lib573 lib574 lib575 lib576        lib578 lib579 lib582   \
  lib583 lib585 lib586 lib587        lib590 lib591 lib597 lib598 lib599   \
  lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
+ lib1509 \
  lib1900 \
  lib2033
 
@@ -326,6 +327,10 @@ lib1508_SOURCES = lib1508.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
 lib1508_LDADD = $(TESTUTIL_LIBS)
 lib1508_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1508
 
+lib1509_SOURCES = lib1509.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1509_LDADD = $(TESTUTIL_LIBS)
+lib1509_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1509
+
 lib1900_SOURCES = lib1900.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
 lib1900_CPPFLAGS = $(AM_CPPFLAGS)
 
diff --git a/tests/libtest/lib1509.c b/tests/libtest/lib1509.c
new file mode 100644 (file)
index 0000000..5087363
--- /dev/null
@@ -0,0 +1,81 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "test.h"
+
+#include "testutil.h"
+#include "warnless.h"
+#include "memdebug.h"
+
+#define VERBOSE 0
+
+size_t WriteOutput(void *ptr, size_t size, size_t nmemb, void *stream);
+size_t WriteHeader(void *ptr, size_t size, size_t nmemb, void *stream);
+
+long realHeaderSize = 0;
+
+int test(char *URL)
+{
+  CURL *curl;
+  long headerSize;
+  CURLcode res=CURLE_OK;
+
+  curl_global_init(CURL_GLOBAL_ALL);
+  curl = curl_easy_init();
+
+  easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); /* set in first.c */
+
+  easy_setopt(curl, CURLOPT_WRITEFUNCTION, *WriteOutput);
+  easy_setopt(curl, CURLOPT_HEADERFUNCTION, *WriteHeader);
+
+  easy_setopt(curl, CURLOPT_HEADER, 1L);
+  easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+  easy_setopt(curl, CURLOPT_URL, URL);
+  easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
+  res = curl_easy_perform(curl);
+
+  curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
+  printf("header length is ........: %lu\n", headerSize);
+  printf("header length should be..: %lu\n", realHeaderSize);
+
+test_cleanup:
+
+  /* undocumented cleanup sequence - type UA */
+
+  curl_easy_cleanup(curl);
+  curl_global_cleanup();
+  return (int)res;
+}
+
+size_t WriteOutput(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+  fwrite(ptr, size, nmemb, stream);
+  return nmemb * size;
+}
+
+size_t WriteHeader(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+  (void)ptr;
+  (void)stream;
+  realHeaderSize += size * nmemb;
+
+  return nmemb * size;
+}
index aef55ea9605903e15eaffac82f5275c312fa46f7..7e1c44012f8316605c70510c30a4d3e0ab89a8f4 100644 (file)
@@ -88,6 +88,8 @@ static bool prevbounce=FALSE; /* instructs the server to increase the part
 
 struct httprequest {
   char reqbuf[REQBUFSIZ]; /* buffer area for the incoming request */
+  bool connect_request; /* if a CONNECT */
+  unsigned short connect_port; /* the port number CONNECT used */
   size_t checkindex; /* where to start checking of the request */
   size_t offset;     /* size of the incoming request */
   long testno;       /* test number found in the request */
@@ -111,7 +113,6 @@ struct httprequest {
   int prot_version;  /* HTTP version * 10 */
   bool pipelining;   /* true if request is pipelined */
   int callcount;  /* times ProcessRequest() gets called */
-  unsigned short connect_port; /* the port number CONNECT used */
   bool connmon;   /* monitor the state of the connection, log disconnects */
   int done_processing;
 };
@@ -166,11 +167,8 @@ const char *serverlogfile = DEFAULT_LOGFILE;
 #define END_OF_HEADERS "\r\n\r\n"
 
 enum {
-  DOCNUMBER_NOTHING = -7,
-  DOCNUMBER_QUIT    = -6,
-  DOCNUMBER_BADCONNECT = -5,
-  DOCNUMBER_INTERNAL= -4,
-  DOCNUMBER_CONNECT = -3,
+  DOCNUMBER_NOTHING = -4,
+  DOCNUMBER_QUIT    = -3,
   DOCNUMBER_WERULEZ = -2,
   DOCNUMBER_404     = -1
 };
@@ -181,14 +179,6 @@ static const char *end_of_headers = END_OF_HEADERS;
 static const char *docquit =
 "HTTP/1.1 200 Goodbye" END_OF_HEADERS;
 
-/* sent as reply to a CONNECT */
-static const char *docconnect =
-"HTTP/1.1 200 Mighty fine indeed" END_OF_HEADERS;
-
-/* sent as reply to a "bad" CONNECT */
-static const char *docbadconnect =
-"HTTP/1.1 501 Forbidden you fool" END_OF_HEADERS;
-
 /* send back this on 404 file not found */
 static const char *doc404 = "HTTP/1.1 404 Not Found\r\n"
     "Server: " SWSVERSION "\r\n"
@@ -342,8 +332,8 @@ static int parse_servercmd(struct httprequest *req)
   if(!stream) {
     error = errno;
     logmsg("fopen() failed with error: %d %s", error, strerror(error));
-    logmsg("Error opening file: %s", filename);
-    logmsg("Couldn't open test file %ld", req->testno);
+    logmsg("  [1] Error opening file: %s", filename);
+    logmsg("  Couldn't open test file %ld", req->testno);
     req->open = FALSE; /* closes connection */
     return 1; /* done */
   }
@@ -533,6 +523,8 @@ static int ProcessRequest(struct httprequest *req)
                 doc, prot_major, prot_minor);
         logmsg("%s", logbuf);
 
+        req->connect_request = TRUE;
+
         if(req->prot_version == 10)
           req->open = FALSE; /* HTTP 1.0 closes connection by default */
 
@@ -557,55 +549,45 @@ static int ProcessRequest(struct httprequest *req)
           else
             req->connect_port = curlx_ultous(ulnum);
         }
-
-        if(!strncmp(doc, "bad", 3))
-          /* if the host name starts with bad, we fake an error here */
-          req->testno = DOCNUMBER_BADCONNECT;
-        else if(!strncmp(doc, "test", 4))
-          /* if the host name starts with test, the port number used in the
-             CONNECT line will be used as test number! */
-          req->testno = req->connect_port?req->connect_port:DOCNUMBER_CONNECT;
-        else
-          req->testno = req->connect_port?DOCNUMBER_CONNECT:DOCNUMBER_BADCONNECT;
-
-        /* find and parse <servercmd> for this test */
-        parse_servercmd(req);
       }
-      else {
-        /* there was no trailing slash and it wasn't CONNECT, then we get the
-           the number off the last dot instead, IE we consider the TLD to be
-           the test number. Test 123 can then be written as
-           "example.com.123". */
+    }
 
-        /* find the last dot */
-        ptr = strrchr(doc, '.');
+    if(req->testno == DOCNUMBER_NOTHING) {
+      /* Still no test case number. Try to get the the number off the last dot
+         instead, IE we consider the TLD to be the test number. Test 123 can
+         then be written as "example.com.123". */
 
-        /* get the number after it */
-        if(ptr) {
-          ptr++; /* skip the dot */
+      /* find the last dot */
+      ptr = strrchr(doc, '.');
 
-          req->testno = strtol(ptr, &ptr, 10);
+      /* get the number after it */
+      if(ptr) {
+        ptr++; /* skip the dot */
 
-          if(req->testno > 10000) {
-            req->partno = req->testno % 10000;
-            req->testno /= 10000;
-          }
-          else
-            req->partno = 0;
+        req->testno = strtol(ptr, &ptr, 10);
 
-          sprintf(logbuf, "Requested test number %ld part %ld (from host name)",
-                  req->testno, req->partno);
-          logmsg("%s", logbuf);
+        if(req->testno > 10000) {
+          req->partno = req->testno % 10000;
+          req->testno /= 10000;
 
-        }
+          logmsg("found test %d in requested host name", req->testno);
 
-        if(!req->testno) {
-          logmsg("Did not find test number in PATH");
-          req->testno = DOCNUMBER_404;
         }
         else
-          parse_servercmd(req);
+          req->partno = 0;
+
+        sprintf(logbuf, "Requested test number %ld part %ld (from host name)",
+                req->testno, req->partno);
+        logmsg("%s", logbuf);
+
       }
+
+      if(!req->testno) {
+        logmsg("Did not find test number in PATH");
+        req->testno = DOCNUMBER_404;
+      }
+      else
+        parse_servercmd(req);
     }
   }
   else if((req->offset >= 3) && (req->testno == DOCNUMBER_NOTHING)) {
@@ -822,7 +804,7 @@ static void storerequest(char *reqbuf, size_t totalsize)
     dump = fopen(dumpfile, "ab");
   } while ((dump == NULL) && ((error = errno) == EINTR));
   if (dump == NULL) {
-    logmsg("Error opening file %s error: %d %s",
+    logmsg("[2] Error opening file %s error: %d %s",
            dumpfile, error, strerror(error));
     logmsg("Failed to write request input ");
     return;
@@ -868,6 +850,7 @@ static void init_httprequest(struct httprequest *req)
   }
   req->testno = DOCNUMBER_NOTHING;
   req->partno = 0;
+  req->connect_request = FALSE;
   req->open = TRUE;
   req->auth_req = FALSE;
   req->auth = FALSE;
@@ -1007,10 +990,6 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
   const char *responsedump = is_proxy?RESPONSE_PROXY_DUMP:RESPONSE_DUMP;
   static char weare[256];
 
-  char partbuf[80]="data";
-
-  logmsg("Send response test%ld section <data%ld>", req->testno, req->partno);
-
   switch(req->rcmd) {
   default:
   case RCMD_NORMALREQ:
@@ -1056,17 +1035,6 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
                 msglen, msgbuf);
       buffer = weare;
       break;
-    case DOCNUMBER_INTERNAL:
-      logmsg("Bailing out due to internal error");
-      return -1;
-    case DOCNUMBER_CONNECT:
-      logmsg("Replying to CONNECT");
-      buffer = docconnect;
-      break;
-    case DOCNUMBER_BADCONNECT:
-      logmsg("Replying to a bad CONNECT");
-      buffer = docbadconnect;
-      break;
     case DOCNUMBER_404:
     default:
       logmsg("Replying to with a 404");
@@ -1077,17 +1045,25 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
     count = strlen(buffer);
   }
   else {
+    char partbuf[80];
     char *filename = test2file(req->testno);
 
-    if(0 != req->partno)
-      sprintf(partbuf, "data%ld", req->partno);
+    /* select the <data> tag for "normal" requests and the <connect> one
+       for CONNECT requests (within the <reply> section) */
+    const char *section= req->connect_request?"connect":"data";
+
+    if(req->partno)
+      sprintf(partbuf, "%s%ld", section, req->partno);
+    else
+      sprintf(partbuf, "%s", section);
+
+    logmsg("Send response test%ld section <%s>", req->testno, partbuf);
 
     stream=fopen(filename, "rb");
     if(!stream) {
       error = errno;
       logmsg("fopen() failed with error: %d %s", error, strerror(error));
-      logmsg("Error opening file: %s", filename);
-      logmsg("Couldn't open test file");
+      logmsg("  [3] Error opening file: %s", filename);
       return 0;
     }
     else {
@@ -1111,8 +1087,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
     if(!stream) {
       error = errno;
       logmsg("fopen() failed with error: %d %s", error, strerror(error));
-      logmsg("Error opening file: %s", filename);
-      logmsg("Couldn't open test file");
+      logmsg("  [4] Error opening file: %s", filename);
       if(ptr)
         free(ptr);
       return 0;
@@ -1156,7 +1131,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
   if(!dump) {
     error = errno;
     logmsg("fopen() failed with error: %d %s", error, strerror(error));
-    logmsg("Error opening file: %s", responsedump);
+    logmsg("  [5] Error opening file: %s", responsedump);
     if(ptr)
       free(ptr);
     if(cmd)
@@ -1389,8 +1364,8 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
 
 static void http_connect(curl_socket_t *infdp,
                          curl_socket_t rootfd,
-                         struct httprequest *req,
-                         const char *ipaddr)
+                         const char *ipaddr,
+                         unsigned short ipport)
 {
   curl_socket_t serverfd[2] = {CURL_SOCKET_BAD, CURL_SOCKET_BAD};
   curl_socket_t clientfd[2] = {CURL_SOCKET_BAD, CURL_SOCKET_BAD};
@@ -1422,7 +1397,7 @@ static void http_connect(curl_socket_t *infdp,
   if(got_exit_signal)
     goto http_connect_cleanup;
 
-  serverfd[CTRL] = connect_to(ipaddr, req->connect_port);
+  serverfd[CTRL] = connect_to(ipaddr, ipport);
   if(serverfd[CTRL] == CURL_SOCKET_BAD)
     goto http_connect_cleanup;
 
@@ -1539,7 +1514,7 @@ static void http_connect(curl_socket_t *infdp,
           /* skip this and close the socket if err < 0 */
           if(err >= 0) {
             err = send_doc(datafd, &req2);
-            if(!err && (req2.testno == DOCNUMBER_CONNECT)) {
+            if(!err && req2.connect_request) {
               /* sleep to prevent triggering libcurl known bug #39. */
               for(loop = 2; (loop > 0) && !got_exit_signal; loop--)
                 wait_ms(250);
@@ -1847,7 +1822,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
 /* returns 1 if the connection should be serviced again immediately, 0 if there
    is no data waiting, or < 0 if it should be closed */
 static int service_connection(curl_socket_t msgsock, struct httprequest *req,
-                              curl_socket_t listensock, const char *hostport)
+                              curl_socket_t listensock,
+                              const char *connecthost)
 {
   if(got_exit_signal)
     return -1;
@@ -1878,17 +1854,7 @@ static int service_connection(curl_socket_t msgsock, struct httprequest *req,
   if(got_exit_signal)
     return -1;
 
-  if(DOCNUMBER_CONNECT == req->testno) {
-    /* a CONNECT request, setup and talk the tunnel */
-    if(!is_proxy) {
-      logmsg("received CONNECT but isn't running as proxy! EXIT");
-    }
-    else
-      http_connect(&msgsock, listensock, req, hostport);
-    return -1;
-  }
-
-  if((req->testno < 0) && (req->testno != DOCNUMBER_CONNECT)) {
+  if(req->testno < 0) {
     logmsg("special request received, no persistency");
     return -1;
   }
@@ -1897,6 +1863,18 @@ static int service_connection(curl_socket_t msgsock, struct httprequest *req,
     return -1;
   }
 
+  if(req->connect_request) {
+    /* a CONNECT request, setup and talk the tunnel */
+    if(!is_proxy) {
+      logmsg("received CONNECT but isn't running as proxy!");
+      return 1;
+    }
+    else {
+      http_connect(&msgsock, listensock, connecthost, req->connect_port);
+      return -1;
+    }
+  }
+
   /* if we got a CONNECT, loop and get another request as well! */
 
   if(req->open) {
@@ -1904,9 +1882,6 @@ static int service_connection(curl_socket_t msgsock, struct httprequest *req,
     return 1;
   }
 
-  if(req->testno == DOCNUMBER_CONNECT)
-    return 1;
-
   return -1;
 }
 
@@ -1923,7 +1898,9 @@ int main(int argc, char *argv[])
   int error;
   int arg=1;
   long pid;
-  const char *hostport = "127.0.0.1";
+  const char *connecthost = "127.0.0.1";
+
+  /* a default CONNECT port is basically pointless but still ... */
   size_t socket_idx;
 
   memset(&req, 0, sizeof(req));
@@ -1993,14 +1970,15 @@ int main(int argc, char *argv[])
       }
     }
     else if(!strcmp("--connect", argv[arg])) {
-      /* store the connect host, but also use this as a hint that we
-         run as a proxy and do a few different internal choices */
+      /* The connect host IP number that the proxy will connect to no matter
+         what the client asks for, but also use this as a hint that we run as
+         a proxy and do a few different internal choices */
       arg++;
       if(argc>arg) {
-        hostport = argv[arg];
+        connecthost = argv[arg];
         arg++;
         is_proxy = TRUE;
-        logmsg("Run as proxy, CONNECT to %s", hostport);
+        logmsg("Run as proxy, CONNECT to host %s", connecthost);
       }
     }
     else {
@@ -2184,7 +2162,8 @@ int main(int argc, char *argv[])
 
         /* Service this connection until it has nothing available */
         do {
-          rc = service_connection(all_sockets[socket_idx], &req, sock, hostport);
+          rc = service_connection(all_sockets[socket_idx], &req, sock,
+                                  connecthost);
           if(got_exit_signal)
             goto sws_cleanup;