Add test scenario forward-to-socks-proxy
authorFabian Keil <fk@fabiankeil.de>
Tue, 9 Mar 2021 16:40:54 +0000 (17:40 +0100)
committerFabian Keil <fk@fabiankeil.de>
Wed, 20 Mar 2024 11:38:39 +0000 (12:38 +0100)
Sponsored by: Privoxy project funds collected at SPI

tests/cts/forward-to-socks-proxy/data/test1 [new file with mode: 0644]
tests/cts/forward-to-socks-proxy/data/test2 [new file with mode: 0644]
tests/cts/forward-to-socks-proxy/data/test3 [new file with mode: 0644]
tests/cts/forward-to-socks-proxy/data/test4 [new file with mode: 0644]
tests/cts/forward-to-socks-proxy/data/test5 [new file with mode: 0644]
tests/cts/forward-to-socks-proxy/data/test6 [new file with mode: 0644]
tests/cts/forward-to-socks-proxy/privoxy.conf [new file with mode: 0644]

diff --git a/tests/cts/forward-to-socks-proxy/data/test1 b/tests/cts/forward-to-socks-proxy/data/test1
new file mode 100644 (file)
index 0000000..39120f5
--- /dev/null
@@ -0,0 +1,59 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</proxy-reply>
+
+
+<client>
+<server>
+http
+socks4
+</server>
+<name>
+Request forwarded through a SOCKS4 proxy
+</name>
+<features>
+proxy
+</features>
+<command>
+http://%HOSTIP:%HTTPPORT/socks4/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /socks4/%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/forward-to-socks-proxy/data/test2 b/tests/cts/forward-to-socks-proxy/data/test2
new file mode 100644 (file)
index 0000000..2f23b1f
--- /dev/null
@@ -0,0 +1,59 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</proxy-reply>
+
+
+<client>
+<server>
+http
+socks4
+</server>
+<name>
+Request forwarded through a SOCKS4A proxy
+</name>
+<features>
+proxy
+</features>
+<command>
+http://%HOSTIP:%HTTPPORT/socks4a/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /socks4a/%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/forward-to-socks-proxy/data/test3 b/tests/cts/forward-to-socks-proxy/data/test3
new file mode 100644 (file)
index 0000000..08172ca
--- /dev/null
@@ -0,0 +1,59 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</proxy-reply>
+
+
+<client>
+<server>
+http
+socks4
+</server>
+<name>
+Request forwarded through a SOCKS5 proxy. Destination host specified by IPv4 address.
+</name>
+<features>
+proxy
+</features>
+<command>
+http://%HOSTIP:%HTTPPORT/socks5/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /socks5/%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/forward-to-socks-proxy/data/test4 b/tests/cts/forward-to-socks-proxy/data/test4
new file mode 100644 (file)
index 0000000..d4ad737
--- /dev/null
@@ -0,0 +1,63 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</proxy-reply>
+
+
+<client>
+<server>
+http
+socks4
+</server>
+<precheck>
+# XXX: The test also requires that localhost resolves to 127.0.0.1 ...
+perl -e "print 'Test requires %HOSTIP 127.0.0.1' if ('%HOSTIP' ne '127.0.0.1');"
+</precheck>
+<name>
+Request forwarded through a SOCKS5 proxy. Destination host specified by domain name.
+</name>
+<features>
+proxy
+</features>
+<command>
+http://localhost:%HTTPPORT/socks5/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /socks5/%TESTNUMBER HTTP/1.1\r
+Host: localhost:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/forward-to-socks-proxy/data/test5 b/tests/cts/forward-to-socks-proxy/data/test5
new file mode 100644 (file)
index 0000000..ad416af
--- /dev/null
@@ -0,0 +1,62 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+# Skip for now as the Socks server from curl's test suite does
+# not seem to deal properly deal with optimistically sent data
+skip
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+X-Control: swsclose
+
+Blafasel
+</data>
+</proxy-reply>
+
+
+<client>
+<server>
+http
+socks4
+</server>
+<name>
+Request forwarded through a SOCKS5t proxy. Destination host specified by IPv4 address.
+</name>
+<features>
+proxy
+</features>
+<command>
+http://%HOSTIP:%HTTPPORT/socks5t/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /socks5t/%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/forward-to-socks-proxy/data/test6 b/tests/cts/forward-to-socks-proxy/data/test6
new file mode 100644 (file)
index 0000000..1d03754
--- /dev/null
@@ -0,0 +1,30 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<client>
+<server>
+http
+socks4
+</server>
+<name>
+Request forwarded through a SOCKS5 proxy. Destination host specified by invalid IPv4 address.
+</name>
+<features>
+proxy
+</features>
+<command>
+-s --write-out '%{stderr}%{response_code}\n' http://127.1234.0.1:%HTTPPORT/socks5/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<stderr>
+503
+</stderr>
+</verify>
+</testcase>
diff --git a/tests/cts/forward-to-socks-proxy/privoxy.conf b/tests/cts/forward-to-socks-proxy/privoxy.conf
new file mode 100644 (file)
index 0000000..8079715
--- /dev/null
@@ -0,0 +1,25 @@
+listen-address 127.0.0.1:9119
+
+debug     1 # Log the destination for each request Privoxy let through. See also debug 1024.
+debug     2 # show each connection status
+debug     4 # show tagging-related messages
+debug     8 # show header parsing
+debug    32 # debug force feature
+debug    64 # debug regular expression filters
+debug   128 # debug redirects
+debug   256 # debug GIF de-animation
+debug   512 # Common Log Format
+debug  1024 # Log the destination for requests Privoxy didn't let through, and the reason why.
+debug  4096 # Startup banner and warnings.
+debug  8192 # Non-fatal errors
+
+templdir ../../../templates
+
+keep-alive-timeout 5
+default-server-timeout 5
+
+forward-socks4 /socks4/ 127.0.0.1:20001 .
+forward-socks4a /socks4a/ 127.0.0.1:20001 .
+forward-socks5 /socks5/ 127.0.0.1:20001 .
+forward-socks5t /socks5t/ 127.0.0.1:20001 .
+forward /verifiedserver .