Add client-header-order tests
authorFabian Keil <fk@fabiankeil.de>
Sat, 9 Jan 2021 15:49:29 +0000 (16:49 +0100)
committerFabian Keil <fk@fabiankeil.de>
Wed, 20 Mar 2024 11:38:38 +0000 (12:38 +0100)
Sponsored by: Privoxy project funds collected at SPI

tests/cts/client-header-order/data/test332 [new file with mode: 0644]
tests/cts/client-header-order/data/test333 [new file with mode: 0644]
tests/cts/client-header-order/data/test334 [new file with mode: 0644]
tests/cts/client-header-order/data/test335 [new file with mode: 0644]
tests/cts/client-header-order/privoxy.conf [new file with mode: 0644]

diff --git a/tests/cts/client-header-order/data/test332 b/tests/cts/client-header-order/data/test332
new file mode 100644 (file)
index 0000000..0cf8407
--- /dev/null
@@ -0,0 +1,52 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Content-Length: 9
+
+Blafasel
+</data>
+</reply>
+
+
+<client>
+<server>
+http
+</server>
+<name>
+HTTP client header order
+</name>
+<command>
+-H "Origin: https://www.privoxy.org/" -H "Cache-Control: max-age=315576000" -H "If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT" -H "Upgrade-Insecure-Requests: 1" -H "Pragma: no-cache" -H "DNT: 1" -H "Cookie: yolo=123" -H "Referer: https://www.example.org/" -H "Proxy-Connection: keep-alive" -H "Accept-Encoding: gzip" -H "Accept: */*" -H "Host: %HOSTIP:%HTTPPORT" -H "Accept-Language: en-CA" --user-agent "Client with unsorted headers" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: Client with unsorted headers\r
+Accept: */*\r
+Accept-Language: en-CA\r
+Accept-Encoding: gzip\r
+Referer: https://www.example.org/\r
+Cookie: yolo=123\r
+DNT: 1\r
+Connection: close\r
+Pragma: no-cache\r
+Upgrade-Insecure-Requests: 1\r
+If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT\r
+Cache-Control: max-age=315576000\r
+Origin: https://www.privoxy.org/\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/client-header-order/data/test333 b/tests/cts/client-header-order/data/test333
new file mode 100644 (file)
index 0000000..a67eb4f
--- /dev/null
@@ -0,0 +1,52 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Content-Length: 9
+
+Blafasel
+</data>
+</reply>
+
+
+<client>
+<server>
+http
+</server>
+<name>
+HTTP client header order 2
+</name>
+<command>
+-H "Origin: https://www.privoxy.org/" -H "Cache-Control: max-age=315576000" -H "If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "Pragma: no-cache" -H "Cookie: yolo=123" -H "Referer: https://www.example.org/" -H "Accept-Encoding: gzip" -H "Proxy-Connection: keep-alive" -H "Accept: */*" -H "Accept-Language: en-CA" -H "Host: %HOSTIP:%HTTPPORT" --user-agent "Client with unsorted headers" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: Client with unsorted headers\r
+Accept: */*\r
+Accept-Language: en-CA\r
+Accept-Encoding: gzip\r
+Referer: https://www.example.org/\r
+Cookie: yolo=123\r
+DNT: 1\r
+Connection: close\r
+Pragma: no-cache\r
+Upgrade-Insecure-Requests: 1\r
+If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT\r
+Cache-Control: max-age=315576000\r
+Origin: https://www.privoxy.org/\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/client-header-order/data/test334 b/tests/cts/client-header-order/data/test334
new file mode 100644 (file)
index 0000000..2c7ed0f
--- /dev/null
@@ -0,0 +1,42 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Content-Length: 9
+
+Blafasel
+</data>
+</reply>
+
+
+<client>
+<server>
+http
+</server>
+<name>
+HTTP client header order 3. Only a few headers to sort.
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+Connection: close\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/client-header-order/data/test335 b/tests/cts/client-header-order/data/test335
new file mode 100644 (file)
index 0000000..7c89c6b
--- /dev/null
@@ -0,0 +1,54 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Content-Length: 9
+
+Blafasel
+</data>
+</reply>
+
+
+<client>
+<server>
+http
+</server>
+<name>
+HTTP client header order 4. Left over headers.
+</name>
+<command>
+-H "Bum: Tschaka" -H "Blafasel: Die da" -H "Origin: https://www.privoxy.org/" -H "Cache-Control: max-age=315576000" -H "If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT" -H "Upgrade-Insecure-Requests: 1" -H "DNT: 1" -H "Pragma: no-cache" -H "Cookie: yolo=123" -H "Referer: https://www.example.org/" -H "Accept-Encoding: gzip" -H "Proxy-Connection: keep-alive" -H "Accept: */*" -H "Accept-Language: en-CA" -H "Host: %HOSTIP:%HTTPPORT" --user-agent "Client with unsorted headers" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: Client with unsorted headers\r
+Accept: */*\r
+Accept-Language: en-CA\r
+Accept-Encoding: gzip\r
+Referer: https://www.example.org/\r
+Cookie: yolo=123\r
+DNT: 1\r
+Connection: close\r
+Pragma: no-cache\r
+Upgrade-Insecure-Requests: 1\r
+If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT\r
+Cache-Control: max-age=315576000\r
+Origin: https://www.privoxy.org/\r
+Bum: Tschaka\r
+Blafasel: Die da\r
+\r
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/cts/client-header-order/privoxy.conf b/tests/cts/client-header-order/privoxy.conf
new file mode 100644 (file)
index 0000000..fb15ffd
--- /dev/null
@@ -0,0 +1,20 @@
+listen-address 127.0.0.1:9119
+
+client-header-order Host User-Agent Accept Accept-Language Accept-Encoding \
+                    Proxy-Connection Referer Cookie DNT Connection \
+                    Pragma Upgrade-Insecure-Requests If-Modified-Since \
+                    Cache-Control Content-Length Origin Content-Type
+
+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
+