From 9149a35785e7bc6dbe64601dbc7b6cf489a3f784 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 10 Jan 2021 10:17:30 +0100 Subject: [PATCH] Add tests for redirects for https-inspected requests Sponsored by: Privoxy project funds collected at SPI --- tests/cts/redirects-https/data/test1 | 47 ++++++++++++++++++++++ tests/cts/redirects-https/data/test2 | 47 ++++++++++++++++++++++ tests/cts/redirects-https/data/test3 | 47 ++++++++++++++++++++++ tests/cts/redirects-https/data/test4 | 47 ++++++++++++++++++++++ tests/cts/redirects-https/data/test5 | 47 ++++++++++++++++++++++ tests/cts/redirects-https/privoxy.conf | 25 ++++++++++++ tests/cts/redirects-https/redirects.action | 17 ++++++++ 7 files changed, 277 insertions(+) create mode 100644 tests/cts/redirects-https/data/test1 create mode 100644 tests/cts/redirects-https/data/test2 create mode 100644 tests/cts/redirects-https/data/test3 create mode 100644 tests/cts/redirects-https/data/test4 create mode 100644 tests/cts/redirects-https/data/test5 create mode 100644 tests/cts/redirects-https/privoxy.conf create mode 100644 tests/cts/redirects-https/redirects.action diff --git a/tests/cts/redirects-https/data/test1 b/tests/cts/redirects-https/data/test1 new file mode 100644 index 00000000..a1a69ada --- /dev/null +++ b/tests/cts/redirects-https/data/test1 @@ -0,0 +1,47 @@ + + + +HTTPS +HTTP GET + + + + + +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. + + + + + +HTTP/1.1 200 Connection established + +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 + + + + + + +none + + +Redirect to http://www.privoxy.org + + +--insecure https://%HOSTIP/%TESTNUMBER-redirect-me-to-www.privoxy.org + + + + + + diff --git a/tests/cts/redirects-https/data/test2 b/tests/cts/redirects-https/data/test2 new file mode 100644 index 00000000..60e815f6 --- /dev/null +++ b/tests/cts/redirects-https/data/test2 @@ -0,0 +1,47 @@ + + + +HTTPS +HTTP GET + + + + + +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. + + + + + +HTTP/1.1 200 Connection established + +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 + + + + + + +none + + +Redirect to https://www.privoxy.org + + +--insecure https://%HOSTIP/%TESTNUMBER-redirect-me-to-www.privoxy.org + + + + + + diff --git a/tests/cts/redirects-https/data/test3 b/tests/cts/redirects-https/data/test3 new file mode 100644 index 00000000..3e7368b2 --- /dev/null +++ b/tests/cts/redirects-https/data/test3 @@ -0,0 +1,47 @@ + + + +HTTPS +HTTP GET + + + + + +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. + + + + + +HTTP/1.1 200 Connection established + +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 + + + + + + +none + + +Redirect to http://www.privoxy.org/ using a pcrs command + + +--insecure https://www.example.org/%TESTNUMBER-redirect-me-to-www.privoxy.org + + + + + + diff --git a/tests/cts/redirects-https/data/test4 b/tests/cts/redirects-https/data/test4 new file mode 100644 index 00000000..47491e6b --- /dev/null +++ b/tests/cts/redirects-https/data/test4 @@ -0,0 +1,47 @@ + + + +HTTPS +HTTP GET + + + + + +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. + + + + + +HTTP/1.1 200 Connection established + +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 + + + + + + +none + + +Redirect to https://www.privoxy.org/ using a pcrs command + + +--insecure https://www.example.org/%TESTNUMBER-redirect-me-to-www.privoxy.org + + + + + + diff --git a/tests/cts/redirects-https/data/test5 b/tests/cts/redirects-https/data/test5 new file mode 100644 index 00000000..9bcc1bfa --- /dev/null +++ b/tests/cts/redirects-https/data/test5 @@ -0,0 +1,47 @@ + + + +HTTPS +HTTP GET + + + + + +HTTP/1.1 200 OK +Connection: close +Content-Type: text/html +Content-Length: 29 + +Not actually used. + + + + + +HTTP/1.1 200 Connection established + +HTTP/1.1 302 Local Redirect from Privoxy +Location: https://www.privoxy.org/path-replaced +Content-Length: 0 +X-Ignore-Header: Date +Date: Sun, 10 Jan 2021 08:13:02 GMT + + + + + + +none + + +Redirect to https://www.privoxy.org/path-replaced using a pcrs command + + +--insecure https://www.privoxy.org/%TESTNUMBER-replace-me + + + + + + diff --git a/tests/cts/redirects-https/privoxy.conf b/tests/cts/redirects-https/privoxy.conf new file mode 100644 index 00000000..5bc00dab --- /dev/null +++ b/tests/cts/redirects-https/privoxy.conf @@ -0,0 +1,25 @@ +listen-address 127.0.0.1:9119 + +ca-directory ../ca-directory +ca-cert-file privoxy-test-cacert.crt +ca-key-file privoxy-test-cakey.pem +ca-password blafasel +# We don't check certificate anyway +trusted-cas-file privoxy-test-cacert.crt + +certificate-directory ../certs + +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-https/redirects.action b/tests/cts/redirects-https/redirects.action new file mode 100644 index 00000000..4c5017d8 --- /dev/null +++ b/tests/cts/redirects-https/redirects.action @@ -0,0 +1,17 @@ +{+https-inspection +ignore-certificate-errors} +/ + +{+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@https://www.example.org/.*@http://www.privoxy.org/@}} +/3-redirect-me-to-www.privoxy.org + +{+redirect{s@https://www.example.org/.*@https://www.privoxy.org/@}} +/4-redirect-me-to-www.privoxy.org + +{+redirect{s@https://www.privoxy.org/\d-replace-me@https://www.privoxy.org/path-replaced@}} +/5-replace-me -- 2.39.2