From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 9 Jan 2021 15:49:29 +0000 (+0100)
Subject: Add client-header-order tests
X-Git-Tag: v_4_0_0~107
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/static/user-manual/@default-cgi@toggle?a=commitdiff_plain;h=e485c071824e070da5eca6a4ccaecb12ccbb0e84;p=privoxy.git

Add client-header-order tests

Sponsored by: Privoxy project funds collected at SPI
---

diff --git a/tests/cts/client-header-order/data/test332 b/tests/cts/client-header-order/data/test332
new file mode 100644
index 00000000..0cf8407d
--- /dev/null
+++ b/tests/cts/client-header-order/data/test332
@@ -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
+Host: %HOSTIP:%HTTPPORT
+User-Agent: Client with unsorted headers
+Accept: */*
+Accept-Language: en-CA
+Accept-Encoding: gzip
+Referer: https://www.example.org/
+Cookie: yolo=123
+DNT: 1
+Connection: close
+Pragma: no-cache
+Upgrade-Insecure-Requests: 1
+If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT
+Cache-Control: max-age=315576000
+Origin: https://www.privoxy.org/
+
+</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
index 00000000..a67eb4ff
--- /dev/null
+++ b/tests/cts/client-header-order/data/test333
@@ -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
+Host: %HOSTIP:%HTTPPORT
+User-Agent: Client with unsorted headers
+Accept: */*
+Accept-Language: en-CA
+Accept-Encoding: gzip
+Referer: https://www.example.org/
+Cookie: yolo=123
+DNT: 1
+Connection: close
+Pragma: no-cache
+Upgrade-Insecure-Requests: 1
+If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT
+Cache-Control: max-age=315576000
+Origin: https://www.privoxy.org/
+
+</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
index 00000000..2c7ed0f7
--- /dev/null
+++ b/tests/cts/client-header-order/data/test334
@@ -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
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Connection: close
+
+</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
index 00000000..7c89c6b1
--- /dev/null
+++ b/tests/cts/client-header-order/data/test335
@@ -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
+Host: %HOSTIP:%HTTPPORT
+User-Agent: Client with unsorted headers
+Accept: */*
+Accept-Language: en-CA
+Accept-Encoding: gzip
+Referer: https://www.example.org/
+Cookie: yolo=123
+DNT: 1
+Connection: close
+Pragma: no-cache
+Upgrade-Insecure-Requests: 1
+If-Modified-Since: Thu, 07 Jan 2021 22:05:31 GMT
+Cache-Control: max-age=315576000
+Origin: https://www.privoxy.org/
+Bum: Tschaka
+Blafasel: Die da
+
+</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
index 00000000..fb15ffd8
--- /dev/null
+++ b/tests/cts/client-header-order/privoxy.conf
@@ -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
+