From 2387f6d8d978b789fb240d20da4d0bc1b6b9004f Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 9 Mar 2021 17:40:54 +0100 Subject: [PATCH] Add test scenario forward-to-socks-proxy Sponsored by: Privoxy project funds collected at SPI --- tests/cts/forward-to-socks-proxy/data/test1 | 59 +++++++++++++++++ tests/cts/forward-to-socks-proxy/data/test2 | 59 +++++++++++++++++ tests/cts/forward-to-socks-proxy/data/test3 | 59 +++++++++++++++++ tests/cts/forward-to-socks-proxy/data/test4 | 63 +++++++++++++++++++ tests/cts/forward-to-socks-proxy/data/test5 | 62 ++++++++++++++++++ tests/cts/forward-to-socks-proxy/data/test6 | 30 +++++++++ tests/cts/forward-to-socks-proxy/privoxy.conf | 25 ++++++++ 7 files changed, 357 insertions(+) create mode 100644 tests/cts/forward-to-socks-proxy/data/test1 create mode 100644 tests/cts/forward-to-socks-proxy/data/test2 create mode 100644 tests/cts/forward-to-socks-proxy/data/test3 create mode 100644 tests/cts/forward-to-socks-proxy/data/test4 create mode 100644 tests/cts/forward-to-socks-proxy/data/test5 create mode 100644 tests/cts/forward-to-socks-proxy/data/test6 create mode 100644 tests/cts/forward-to-socks-proxy/privoxy.conf diff --git a/tests/cts/forward-to-socks-proxy/data/test1 b/tests/cts/forward-to-socks-proxy/data/test1 new file mode 100644 index 00000000..39120f5e --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/data/test1 @@ -0,0 +1,59 @@ + + + +HTTP +HTTP GET + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + + +http +socks4 + + +Request forwarded through a SOCKS4 proxy + + +proxy + + +http://%HOSTIP:%HTTPPORT/socks4/%TESTNUMBER + + + + + +GET /socks4/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + + diff --git a/tests/cts/forward-to-socks-proxy/data/test2 b/tests/cts/forward-to-socks-proxy/data/test2 new file mode 100644 index 00000000..2f23b1fe --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/data/test2 @@ -0,0 +1,59 @@ + + + +HTTP +HTTP GET + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + + +http +socks4 + + +Request forwarded through a SOCKS4A proxy + + +proxy + + +http://%HOSTIP:%HTTPPORT/socks4a/%TESTNUMBER + + + + + +GET /socks4a/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + + diff --git a/tests/cts/forward-to-socks-proxy/data/test3 b/tests/cts/forward-to-socks-proxy/data/test3 new file mode 100644 index 00000000..08172ca3 --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/data/test3 @@ -0,0 +1,59 @@ + + + +HTTP +HTTP GET + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + + +http +socks4 + + +Request forwarded through a SOCKS5 proxy. Destination host specified by IPv4 address. + + +proxy + + +http://%HOSTIP:%HTTPPORT/socks5/%TESTNUMBER + + + + + +GET /socks5/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + + diff --git a/tests/cts/forward-to-socks-proxy/data/test4 b/tests/cts/forward-to-socks-proxy/data/test4 new file mode 100644 index 00000000..d4ad737c --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/data/test4 @@ -0,0 +1,63 @@ + + + +HTTP +HTTP GET + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + + +http +socks4 + + +# 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');" + + +Request forwarded through a SOCKS5 proxy. Destination host specified by domain name. + + +proxy + + +http://localhost:%HTTPPORT/socks5/%TESTNUMBER + + + + + +GET /socks5/%TESTNUMBER HTTP/1.1 +Host: localhost:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + + diff --git a/tests/cts/forward-to-socks-proxy/data/test5 b/tests/cts/forward-to-socks-proxy/data/test5 new file mode 100644 index 00000000..ad416af1 --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/data/test5 @@ -0,0 +1,62 @@ + + + +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 + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose + +Blafasel + + + + + + +http +socks4 + + +Request forwarded through a SOCKS5t proxy. Destination host specified by IPv4 address. + + +proxy + + +http://%HOSTIP:%HTTPPORT/socks5t/%TESTNUMBER + + + + + +GET /socks5t/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + + diff --git a/tests/cts/forward-to-socks-proxy/data/test6 b/tests/cts/forward-to-socks-proxy/data/test6 new file mode 100644 index 00000000..1d037544 --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/data/test6 @@ -0,0 +1,30 @@ + + + +HTTP +HTTP GET + + + + + +http +socks4 + + +Request forwarded through a SOCKS5 proxy. Destination host specified by invalid IPv4 address. + + +proxy + + +-s --write-out '%{stderr}%{response_code}\n' http://127.1234.0.1:%HTTPPORT/socks5/%TESTNUMBER + + + + + +503 + + + diff --git a/tests/cts/forward-to-socks-proxy/privoxy.conf b/tests/cts/forward-to-socks-proxy/privoxy.conf new file mode 100644 index 00000000..80797154 --- /dev/null +++ b/tests/cts/forward-to-socks-proxy/privoxy.conf @@ -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 . -- 2.39.2