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
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.
test1408 test1409 test1410 test1411 test1412 test1413 \
\
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
-test1508 \
+test1508 test1509 \
\
test1900 test1901 test1902 test1903 \
\
</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
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>
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
^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]
# 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>
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
^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>
#
# 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>
#
<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
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>
</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
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>
^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>
<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
\r
0\r
\r
-</data>
+</connect>
# this is returned when we get a GET!
<data2>
</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
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>
^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>
#
# 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
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>
^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
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
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>
^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
#
# 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 .
#
# Client-side
<client>
+
+# please send the real CONNECT connect off to the FTP server's port
+<connectport>
+%FTPPORT
+</connectport>
<server>
ftp
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>
#
# 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>
<datacheck>
HTTP/1.1 200 Mighty fine indeed\r
+pop3: sure hit me\r
\r
From: me@somewhere
To: fake@nowhere
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>
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
#
# Server-side
<reply>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+smtp: sure hit me\r
+\r
+</connect>
</reply>
#
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>
.\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
#
# 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
</data>
<datacheck>
HTTP/1.1 200 Mighty fine indeed\r
+imap: sure hit me\r
\r
From: me@somewhere\r
To: fake@nowhere\r
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>
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
--- /dev/null
+<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>
<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>
</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
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>
^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]
<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>
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
^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>
<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>
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
^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
<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>
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>
^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>
<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>
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
^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
#
# 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
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
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>
^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
<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>
# 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>
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
</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>
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>
<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
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
# 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
<protocol>
GET /503 HTTP/1.1\r
Authorization: Basic dGVzdDppbmc=\r
-Host: %HOSTIP:%HTTPPORT\r
+Host: machine.503:%HTTPPORT\r
Accept: */*\r
\r
[DISCONNECT]
contents
</data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
<datacheck>
HTTP/1.1 200 Mighty fine indeed\r
\r
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>
^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
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>
contents
</data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
<datacheck>
HTTP/1.1 200 Mighty fine indeed\r
\r
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>
^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>
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>
#
# 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>
#
contents
</data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
<datacheck>
HTTP/1.1 200 Mighty fine indeed\r
\r
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>
^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
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
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)
--- /dev/null
+/***************************************************************************
+ * _ _ ____ _
+ * 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;
+}
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 */
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;
};
#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
};
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"
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 */
}
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 */
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)) {
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;
}
req->testno = DOCNUMBER_NOTHING;
req->partno = 0;
+ req->connect_request = FALSE;
req->open = TRUE;
req->auth_req = FALSE;
req->auth = FALSE;
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:
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");
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 {
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;
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)
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};
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;
/* 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);
/* 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;
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;
}
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) {
return 1;
}
- if(req->testno == DOCNUMBER_CONNECT)
- return 1;
-
return -1;
}
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));
}
}
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 {
/* 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;