From: Fabian Keil <fk@fabiankeil.de> Date: Sun, 10 Jan 2021 08:48:35 +0000 (+0100) Subject: Add redirect tests X-Git-Tag: v_4_0_0~103 X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/man-page/faq/diff?a=commitdiff_plain;h=e917ae3908064b70cca0e0e57b2c043d572306b8;p=privoxy.git Add redirect tests Sponsored by: Privoxy project funds collected at SPI --- diff --git a/tests/cts/redirects/data/test1 b/tests/cts/redirects/data/test1 new file mode 100644 index 00000000..3bcd690a --- /dev/null +++ b/tests/cts/redirects/data/test1 @@ -0,0 +1,45 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +</keywords> +</info> + +<reply> +<data> +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. +</data> +</reply> + +<proxy-reply> +<data> +HTTP/1.1 302 Local Redirect from Privoxy +Location: http://www.privoxy.org +Content-Length: 0 +X-Ignore-Header: Date +Date: Sun, 10 Jan 2021 08:13:02 GMT + +</data> +</proxy-reply> + +<client> +<server> +none +</server> +<name> +Redirect to http://www.privoxy.org +</name> +<command> +http://%HOSTIP/%TESTNUMBER-redirect-me-to-www.privoxy.org +</command> +</client> + +<verify> +</verify> +</testcase> diff --git a/tests/cts/redirects/data/test2 b/tests/cts/redirects/data/test2 new file mode 100644 index 00000000..245b5bcf --- /dev/null +++ b/tests/cts/redirects/data/test2 @@ -0,0 +1,45 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +</keywords> +</info> + +<reply> +<data> +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. +</data> +</reply> + +<proxy-reply> +<data> +HTTP/1.1 302 Local Redirect from Privoxy +Location: https://www.privoxy.org +Content-Length: 0 +X-Ignore-Header: Date +Date: Sun, 10 Jan 2021 08:13:02 GMT + +</data> +</proxy-reply> + +<client> +<server> +none +</server> +<name> +Redirect to https://www.privoxy.org +</name> +<command> +http://%HOSTIP/%TESTNUMBER-redirect-me-to-www.privoxy.org +</command> +</client> + +<verify> +</verify> +</testcase> diff --git a/tests/cts/redirects/data/test3 b/tests/cts/redirects/data/test3 new file mode 100644 index 00000000..625131b5 --- /dev/null +++ b/tests/cts/redirects/data/test3 @@ -0,0 +1,45 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +</keywords> +</info> + +<reply> +<data> +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. +</data> +</reply> + +<proxy-reply> +<data> +HTTP/1.1 302 Local Redirect from Privoxy +Location: http://www.privoxy.org/ +Content-Length: 0 +X-Ignore-Header: Date +Date: Sun, 10 Jan 2021 08:13:02 GMT + +</data> +</proxy-reply> + +<client> +<server> +none +</server> +<name> +Redirect to http://www.privoxy.org using a pcrs command +</name> +<command> +http://www.example.org/%TESTNUMBER-redirect-me-to-www.privoxy.org +</command> +</client> + +<verify> +</verify> +</testcase> diff --git a/tests/cts/redirects/data/test4 b/tests/cts/redirects/data/test4 new file mode 100644 index 00000000..f9c632b7 --- /dev/null +++ b/tests/cts/redirects/data/test4 @@ -0,0 +1,45 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +</keywords> +</info> + +<reply> +<data> +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. +</data> +</reply> + +<proxy-reply> +<data> +HTTP/1.1 302 Local Redirect from Privoxy +Location: http://www.privoxy.org/path-replaced +Content-Length: 0 +X-Ignore-Header: Date +Date: Sun, 10 Jan 2021 08:13:02 GMT + +</data> +</proxy-reply> + +<client> +<server> +none +</server> +<name> +Redirect to http://www.privoxy.org/path-replaced using a pcrs command +</name> +<command> +http://www.privoxy.org/%TESTNUMBER-replace-me +</command> +</client> + +<verify> +</verify> +</testcase> diff --git a/tests/cts/redirects/privoxy.conf b/tests/cts/redirects/privoxy.conf new file mode 100644 index 00000000..777fb322 --- /dev/null +++ b/tests/cts/redirects/privoxy.conf @@ -0,0 +1,16 @@ +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 + +actionsfile redirects.action diff --git a/tests/cts/redirects/redirects.action b/tests/cts/redirects/redirects.action new file mode 100644 index 00000000..b95ea2ea --- /dev/null +++ b/tests/cts/redirects/redirects.action @@ -0,0 +1,11 @@ +{+redirect{http://www.privoxy.org}} +/1-redirect-me-to-www.privoxy.org + +{+redirect{https://www.privoxy.org}} +/2-redirect-me-to-www.privoxy.org + +{+redirect{s@http://www.example.org/.*@http://www.privoxy.org/@}} +/3-redirect-me-to-www.privoxy.org + +{+redirect{s@http://www.privoxy.org/\d-replace-me@http://www.privoxy.org/path-replaced@}} +/4-replace-me