Add a couple of tests for connection headers with keep-alive-timeout set
authorFabian Keil <fk@fabiankeil.de>
Thu, 19 Jun 2025 10:27:36 +0000 (12:27 +0200)
committerFabian Keil <fk@fabiankeil.de>
Tue, 24 Jun 2025 12:09:35 +0000 (14:09 +0200)
13 files changed:
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test1 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test10 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test11 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test12 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test2 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test3 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test4 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test5 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test6 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test7 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test8 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/data/test9 [new file with mode: 0644]
tests/cts/connection-headers-with-keep-alive-timeout-set/privoxy.conf [new file with mode: 0644]

diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test1 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test1
new file mode 100644 (file)
index 0000000..5843fe1
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+Simple "Connection: close" header
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test10 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test10
new file mode 100644 (file)
index 0000000..edd769c
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection:                         keep-alive        
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+Empty "Connection:" header with "keep-alive" keyword and lots of whitespace
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test11 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test11
new file mode 100644 (file)
index 0000000..95ca532
--- /dev/null
@@ -0,0 +1,48 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Connection: close
+Connection: close
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+Multiple conflicting "Connection:" headers.
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test12 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test12
new file mode 100644 (file)
index 0000000..925103a
--- /dev/null
@@ -0,0 +1,47 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Connection: keep-alive
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+Multiple conflicting "Connection:" headers.
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test2 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test2
new file mode 100644 (file)
index 0000000..1c2b67f
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+Simple "Connection: keep-alive" header
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test3 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test3
new file mode 100644 (file)
index 0000000..d360741
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive, Upgrade
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+"Connection:" header with unsupported "upgrade" keyword
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test4 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test4
new file mode 100644 (file)
index 0000000..cb21ad5
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive, blafasel, tralala, yolo, test, hoho
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+"Connection:" header with "too many" keywords
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test5 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test5
new file mode 100644 (file)
index 0000000..39e0df1
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive, test1, test2, test3
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+"Connection:" header with some unsupported keywords
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test6 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test6
new file mode 100644 (file)
index 0000000..45e9d7a
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: test1, test2, test3, keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+"Connection:" header with some unsupported keywords, keep-alive keyword at the end
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test7 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test7
new file mode 100644 (file)
index 0000000..f507144
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: KeEp-aLiVe
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: KeEp-aLiVe
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+"Connection:" header with "KeEp-aLiVe" keyword
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test8 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test8
new file mode 100644 (file)
index 0000000..2b498eb
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection: ,
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+"Connection:" header with single comma instead of actual keywords
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test9 b/tests/cts/connection-headers-with-keep-alive-timeout-set/data/test9
new file mode 100644 (file)
index 0000000..1f990d5
--- /dev/null
@@ -0,0 +1,45 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Connection:
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: text/plain
+Content-Length: 10
+
+Blafasel.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+Empty "Connection:" header
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+</verify>
+</testcase>
diff --git a/tests/cts/connection-headers-with-keep-alive-timeout-set/privoxy.conf b/tests/cts/connection-headers-with-keep-alive-timeout-set/privoxy.conf
new file mode 100644 (file)
index 0000000..72c021f
--- /dev/null
@@ -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
+
+keep-alive-timeout 1