From: Fabian Keil Date: Fri, 22 Jan 2021 15:32:10 +0000 (+0100) Subject: Add test scenario header-filters X-Git-Url: http://www.privoxy.org/gitweb/show-status?p=privoxy.git;a=commitdiff_plain;h=e4a7ec439a8ff4199c00718922f5cf255d2dabdf Add test scenario header-filters Sponsored by: Privoxy project funds collected at SPI --- diff --git a/tests/cts/header-filters/data/test1 b/tests/cts/header-filters/data/test1 new file mode 100644 index 00000000..763ea61d --- /dev/null +++ b/tests/cts/header-filters/data/test1 @@ -0,0 +1,59 @@ + + + +HTTP +HTTP GET +server-header-filter x-httpd-php-to-html + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: application/x-httpd-php +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++server-header-filter{x-httpd-php-to-html} + + +proxy + + +--head http://%HOSTIP:%HTTPPORT/x-httpd-php-to-html/%TESTNUMBER + + + + + +HEAD /x-httpd-php-to-html/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Connection: close + + + + diff --git a/tests/cts/header-filters/data/test2 b/tests/cts/header-filters/data/test2 new file mode 100644 index 00000000..77bcc769 --- /dev/null +++ b/tests/cts/header-filters/data/test2 @@ -0,0 +1,61 @@ + + + +HTTP +HTTP GET +server-header-filter html-to-xml + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +Content-Type: text/html; blafasel +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: application/xhtml+xml +Content-Type: application/xhtml+xml; blafasel +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++server-header-filter{html-to-xml} + + +proxy + + +--head http://%HOSTIP:%HTTPPORT/html-to-xml/%TESTNUMBER + + + + + +HEAD /html-to-xml/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Connection: close + + + + diff --git a/tests/cts/header-filters/data/test3 b/tests/cts/header-filters/data/test3 new file mode 100644 index 00000000..776fab80 --- /dev/null +++ b/tests/cts/header-filters/data/test3 @@ -0,0 +1,67 @@ + + + +HTTP +HTTP GET +server-header-filter xml-to-html + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: application/xhtml+xml; blafasel +Content-Type: application/xml; blafasel +Content-Type: application/xml +Content-Type: text/xml; blafasel +Content-Type: text/xml +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html; blafasel +Content-Type: text/html; blafasel +Content-Type: text/html +Content-Type: text/html; blafasel +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++server-header-filter{xml-to-html} + + +proxy + + +--head http://%HOSTIP:%HTTPPORT/xml-to-html/%TESTNUMBER + + + + + +HEAD /xml-to-html/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Connection: close + + + + diff --git a/tests/cts/header-filters/data/test4 b/tests/cts/header-filters/data/test4 new file mode 100644 index 00000000..37ebfd4b --- /dev/null +++ b/tests/cts/header-filters/data/test4 @@ -0,0 +1,60 @@ + + + +HTTP +HTTP GET +client-header-filter hide-tor-exit-notation + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++client-header-filter{hide-tor-exit-notation} with http:// Referer: + + +proxy + + +--head -H "Referer: http://www.example.org.blafasel.exit/" -H "Host: www.example.org.blafasel.exit" http://%HOSTIP:%HTTPPORT/hide-tor-exit-notation/%TESTNUMBER + + + + + +HEAD /hide-tor-exit-notation/%TESTNUMBER HTTP/1.1 +Host: www.example.org +User-Agent: curl/%VERSION +Accept: */* +Referer: http://www.example.org/ +Connection: close + + + + diff --git a/tests/cts/header-filters/data/test5 b/tests/cts/header-filters/data/test5 new file mode 100644 index 00000000..f614a550 --- /dev/null +++ b/tests/cts/header-filters/data/test5 @@ -0,0 +1,60 @@ + + + +HTTP +HTTP GET +client-header-filter hide-tor-exit-notation + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++client-header-filter{hide-tor-exit-notation} with https:// Referer: + + +proxy + + +--head -H "Referer: https://www.example.org.blafasel.exit/secure/" -H "Host: www.example.org.blafasel.exit" http://%HOSTIP:%HTTPPORT/hide-tor-exit-notation/%TESTNUMBER + + + + + +HEAD /hide-tor-exit-notation/%TESTNUMBER HTTP/1.1 +Host: www.example.org +User-Agent: curl/%VERSION +Accept: */* +Referer: https://www.example.org/secure/ +Connection: close + + + + diff --git a/tests/cts/header-filters/data/test6 b/tests/cts/header-filters/data/test6 new file mode 100644 index 00000000..802d9f5a --- /dev/null +++ b/tests/cts/header-filters/data/test6 @@ -0,0 +1,62 @@ + + + +HTTP +HTTP GET +client-header-filter no-brotli-accepted + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/html +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++client-header-filter{no-brotli-accepted} + + +proxy + + +--head -H "Accept-Encoding: br" -H "Accept-Encoding: gzip, br" -H "Accept-Encoding: br, gzip" http://%HOSTIP:%HTTPPORT/no-brotli-accepted/%TESTNUMBER + + + + + +HEAD /no-brotli-accepted/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Accept-Encoding: +Accept-Encoding: gzip +Accept-Encoding: gzip +Connection: close + + + + diff --git a/tests/cts/header-filters/data/test7 b/tests/cts/header-filters/data/test7 new file mode 100644 index 00000000..6706141f --- /dev/null +++ b/tests/cts/header-filters/data/test7 @@ -0,0 +1,78 @@ + + + +HTTP +HTTP GET +server-header-filter less-download-windows + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Disposition: blafasel filename="foo.png" tralala +Content-Disposition: blafasel filename="foo.gif" tralala +Content-Disposition: blafasel filename="foo.jpeg" tralala +Content-Disposition: blafasel filename="foo.jpg" tralala +Content-Disposition: blafasel filename="foo.diff" tralala +Content-Disposition: blafasel filename="foo.patch" tralala +Content-Disposition: blafasel filename="foo.dpatch" tralala +Content-Disposition: blafasel filename='foo.c' tralala +Content-Disposition: blafasel filename="foo.h" tralala +Content-Disposition: blafasel filename=foo.pl tralala +Content-Disposition: blafasel filename="foo.shar" tralala +Content-Type: message/news +Content-Type: message/rfc822 +Content-Type: message/text-blafasel +Content-Type: application/x-sh +Content-Type: application/x-sh +X-Control: swsclose +Content-Length: 0 + + + + + + +HTTP/1.1 200 OK +Date: Thu, 22 Jul 2010 11:22:33 GMT +Connection: close +Content-Type: text/plain +Content-Type: text/plain +Content-Type: message/text-blafasel +Content-Type: text/plain +Content-Type: text/plain +X-Control: swsclose +Content-Length: 0 + + + + + + +http + + ++server-header-filter{less-download-windows} + + +proxy + + +--head http://%HOSTIP:%HTTPPORT/less-download-windows/%TESTNUMBER + + + + + +HEAD /less-download-windows/%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Connection: close + + + + diff --git a/tests/cts/header-filters/header-filters.action b/tests/cts/header-filters/header-filters.action new file mode 100644 index 00000000..bcb60951 --- /dev/null +++ b/tests/cts/header-filters/header-filters.action @@ -0,0 +1,17 @@ +{+server-header-filter{x-httpd-php-to-html}} +/x-httpd-php-to-html/ + +{+server-header-filter{html-to-xml}} +/html-to-xml/ + +{+server-header-filter{xml-to-html}} +/xml-to-html/ + +{+client-header-filter{hide-tor-exit-notation}} +/hide-tor-exit-notation/ + +{+client-header-filter{no-brotli-accepted}} +/no-brotli-accepted/ + +{+server-header-filter{less-download-windows}} +/less-download-windows/ diff --git a/tests/cts/header-filters/privoxy.conf b/tests/cts/header-filters/privoxy.conf new file mode 100644 index 00000000..7ffc6293 --- /dev/null +++ b/tests/cts/header-filters/privoxy.conf @@ -0,0 +1,17 @@ +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 + +filterfile ../../../default.filter +actionsfile ./header-filters.action