From 515869172fe9e95ffcc6b46f327210e147028938 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 28 Jan 2021 14:56:59 +0100
Subject: [PATCH] Add test scenario gzip compression

Sponsored by: Privoxy project funds collected at SPI
---
 tests/cts/gzip-compression/data/test1         | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test10        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test11        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test12        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test13        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test14        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test15        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test16        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test17        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test18        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test19        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test2         | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test20        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test21        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test22        | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test23        | 71 +++++++++++++++++++
 tests/cts/gzip-compression/data/test24        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test25        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test26        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test27        | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test28        | 63 ++++++++++++++++
 tests/cts/gzip-compression/data/test3         | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test4         | 65 +++++++++++++++++
 tests/cts/gzip-compression/data/test5         | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test6         | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test7         | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test8         | 64 +++++++++++++++++
 tests/cts/gzip-compression/data/test9         | 64 +++++++++++++++++
 .../gzip-compression/gzip-compression.action  |  3 +
 tests/cts/gzip-compression/privoxy.conf       | 20 ++++++
 30 files changed, 1831 insertions(+)
 create mode 100644 tests/cts/gzip-compression/data/test1
 create mode 100644 tests/cts/gzip-compression/data/test10
 create mode 100644 tests/cts/gzip-compression/data/test11
 create mode 100644 tests/cts/gzip-compression/data/test12
 create mode 100644 tests/cts/gzip-compression/data/test13
 create mode 100644 tests/cts/gzip-compression/data/test14
 create mode 100644 tests/cts/gzip-compression/data/test15
 create mode 100644 tests/cts/gzip-compression/data/test16
 create mode 100644 tests/cts/gzip-compression/data/test17
 create mode 100644 tests/cts/gzip-compression/data/test18
 create mode 100644 tests/cts/gzip-compression/data/test19
 create mode 100644 tests/cts/gzip-compression/data/test2
 create mode 100644 tests/cts/gzip-compression/data/test20
 create mode 100644 tests/cts/gzip-compression/data/test21
 create mode 100644 tests/cts/gzip-compression/data/test22
 create mode 100644 tests/cts/gzip-compression/data/test23
 create mode 100644 tests/cts/gzip-compression/data/test24
 create mode 100644 tests/cts/gzip-compression/data/test25
 create mode 100644 tests/cts/gzip-compression/data/test26
 create mode 100644 tests/cts/gzip-compression/data/test27
 create mode 100644 tests/cts/gzip-compression/data/test28
 create mode 100644 tests/cts/gzip-compression/data/test3
 create mode 100644 tests/cts/gzip-compression/data/test4
 create mode 100644 tests/cts/gzip-compression/data/test5
 create mode 100644 tests/cts/gzip-compression/data/test6
 create mode 100644 tests/cts/gzip-compression/data/test7
 create mode 100644 tests/cts/gzip-compression/data/test8
 create mode 100644 tests/cts/gzip-compression/data/test9
 create mode 100644 tests/cts/gzip-compression/gzip-compression.action
 create mode 100644 tests/cts/gzip-compression/privoxy.conf

diff --git a/tests/cts/gzip-compression/data/test1 b/tests/cts/gzip-compression/data/test1
new file mode 100644
index 00000000..52325dfe
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test1
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Valid gzip data.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test10 b/tests/cts/gzip-compression/data/test10
new file mode 100644
index 00000000..2fefead0
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test10
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%01%00%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Skipping 1 bytes for gzip compression. Does this sound right?
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test11 b/tests/cts/gzip-compression/data/test11
new file mode 100644
index 00000000..a9564745
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test11
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%FF%00%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%FF%00%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Unreasonable amount of bytes to skip (-1). Stopping decompression
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test12 b/tests/cts/gzip-compression/data/test12
new file mode 100644
index 00000000..d621a117
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test12
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%00%01]hex%%repeat[256 x A]%hex[%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%00%01]hex%%repeat[256 x A]%hex[%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Unexpected error while decompressing to the buffer (iob): invalid distance too far back
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test13 b/tests/cts/gzip-compression/data/test13
new file mode 100644
index 00000000..87f5a0af
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test13
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%00%01]hex%%repeat[256 x A]%hex[%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Skipping 256 bytes for gzip compression. Does this sound right?
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test14 b/tests/cts/gzip-compression/data/test14
new file mode 100644
index 00000000..1080abde
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test14
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%00%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Skipping 0 bytes for gzip compression. Does this sound right?
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test15 b/tests/cts/gzip-compression/data/test15
new file mode 100644
index 00000000..12d3042f
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test15
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%18%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00]hex%This is a comment to skip%hex[%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Comment to skip.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test16 b/tests/cts/gzip-compression/data/test16
new file mode 100644
index 00000000..25a4a039
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test16
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%18%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00]hex%%repeat[1000 x This is a long comment to skip]%hex[%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Long comment to skip.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test17 b/tests/cts/gzip-compression/data/test17
new file mode 100644
index 00000000..b25b44b8
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test17
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%a2%c1%12%60%00%03%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. No filename to skip.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test18 b/tests/cts/gzip-compression/data/test18
new file mode 100644
index 00000000..59683592
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test18
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%02%a2%c1%12%60%00%FF%FF%03%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Checksum to skip.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test19 b/tests/cts/gzip-compression/data/test19
new file mode 100644
index 00000000..0a8c8aba
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test19
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%02%a2%c1%12%60%00%FF]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%02%a2%c1%12%60%00%FF]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Checksum to skip. Insufficient data left.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test2 b/tests/cts/gzip-compression/data/test2
new file mode 100644
index 00000000..8ebb10e4
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test2
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%08%a2%c1%12%60%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%08%a2%c1%12%60%00]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Malformed gzip header.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test20 b/tests/cts/gzip-compression/data/test20
new file mode 100644
index 00000000..7fcd00ab
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test20
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%00%00%00%00%02%03%ed%c4%31%0d%00%00%08%03%b0%1f%97%4b%26%01%ff%c1%05%57%7b%b4%d9%4c%25%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%a4%9f%0e%80%af%70%a8%40%ec%00%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%00%00%00%00%02%03%ed%c4%31%0d%00%00%08%03%b0%1f%97%4b%26%01%ff%c1%05%57%7b%b4%d9%4c%25%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%a4%9f%0e%80%af%70%a8%40%ec%00%00]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Buffer limit reached while decompressing iob.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test21 b/tests/cts/gzip-compression/data/test21
new file mode 100644
index 00000000..255d54e0
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test21
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%00%00%00%00%02%03%ed%c4%31%0d%00%00%08%03%b0%1f%97%4b%26%01%ff%c1%05%57%7b%b4%d9%4c%25%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%a4%9f%0e%80%af%70%a8%40%ec%00%00]hex%%repeat[10000 x padding data]%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%00%00%00%00%02%03%ed%c4%31%0d%00%00%08%03%b0%1f%97%4b%26%01%ff%c1%05%57%7b%b4%d9%4c%25%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%24%49%92%a4%9f%0e%80%af%70%a8%40%ec%00%00]hex%%repeat[10000 x padding data]%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Buffer limit reached while extending the buffer (iob).
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test22 b/tests/cts/gzip-compression/data/test22
new file mode 100644
index 00000000..d3c41bcf
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test22
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+deflate compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: deflate
+X-Control: swsclose
+
+%hex[%0b%ce%cf%4d%55%48%49%4d%cb%49%2c%49%55%48%cd%4b%ce%4f%49%4d%51%48%49%2c%49%d4%e3%f2%4b%2d%57%c8%c9%cc%4b%55%c8%48%2d%4a%d5%e3%02%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 42
+
+Some deflate encoded data.
+New line here.
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+deflate-encoded content. Valid.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: deflate" http://%HOSTIP:%HTTPPORT/deflate-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /deflate-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: deflate
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test23 b/tests/cts/gzip-compression/data/test23
new file mode 100644
index 00000000..07b5bf24
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test23
@@ -0,0 +1,71 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+deflate compression
+skip
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: deflate
+X-Control: swsclose
+
+%hex[%0b%ce%cf%4d%55%48%49%4d%cb%49%2c%49%55%48%cd%4b%ce%4f%49%4d%]hex%
+Bogus data blafasel
+</data>
+</reply>
+
+# The actual reply does not contain a line break after the trailing NUL byte
+# but we can't currently express this as the </data> tag has to be on its
+# own line.
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: deflate
+X-Control: swsclose
+
+%hex[%0b%ce%cf%4d%55%48%49%4d%cb%49%2c%49%55%48%cd%4b%ce%4f%49%4d%]hex%
+Bogus data blafasel
+%hex[%00]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+deflate-encoded content. Corrupted data.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: deflate" http://%HOSTIP:%HTTPPORT/deflate-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /deflate-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: deflate
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test24 b/tests/cts/gzip-compression/data/test24
new file mode 100644
index 00000000..94eae477
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test24
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%00%FF%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%00%00%FF%00%0A%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields with skip bytes that would be negative when not being casted.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test25 b/tests/cts/gzip-compression/data/test25
new file mode 100644
index 00000000..520d69e8
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test25
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields with not enough data.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test26 b/tests/cts/gzip-compression/data/test26
new file mode 100644
index 00000000..62621cc0
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test26
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%1A%a2%c1%12%60%FF%03%62%6c%61%66%61%73%65%6c%FF%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%FF%62%37%9b%0c%24%FF%FF%FF%FF]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%1A%a2%c1%12%60%FF%03%62%6c%61%66%61%73%65%6c%FF%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%FF%62%37%9b%0c%24%FF%FF%FF%FF]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Unterminated file name and comment.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test27 b/tests/cts/gzip-compression/data/test27
new file mode 100644
index 00000000..52e22f57
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test27
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%1A%a2%c1%12%60%FF%03%62%6c%61%66%61%73%65%6c%FF%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%FF%62%37%9b%0c%24%FF%FF%FF%FF]hex%%repeat[302 x A]%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%1A%a2%c1%12%60%FF%03%62%6c%61%66%61%73%65%6c%FF%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%FF%62%37%9b%0c%24%FF%FF%FF%FF]hex%%repeat[302 x A]%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Unterminated file name and comment, padding data to fill iob.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test28 b/tests/cts/gzip-compression/data/test28
new file mode 100644
index 00000000..106b0e21
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test28
@@ -0,0 +1,63 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%00%00%00%00%00%03%03%00%00%00%00%00%00%00%00%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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
+
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Valid gzip data, no compressed content
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test3 b/tests/cts/gzip-compression/data/test3
new file mode 100644
index 00000000..020fa63f
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test3
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%08%a2%c1%12%60]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%08%a2%c1%12%60]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Insufficient data to start decompression.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test4 b/tests/cts/gzip-compression/data/test4
new file mode 100644
index 00000000..fab585f9
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test4
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%00%00%00%00%00%00%03%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+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: 36
+
+Blafasel die da
+Some more data here
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Valid gzip data. No embedded file name.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test5 b/tests/cts/gzip-compression/data/test5
new file mode 100644
index 00000000..c5e9944b
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test5
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1G%8b%08%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1G%8b%08%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Invalid gzip header when decompressing 1.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test6 b/tests/cts/gzip-compression/data/test6
new file mode 100644
index 00000000..45a80c47
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test6
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8c%08%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8c%08%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Invalid gzip header when decompressing 2.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test7 b/tests/cts/gzip-compression/data/test7
new file mode 100644
index 00000000..b5488097
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test7
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%FF%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%FF%08%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Invalid gzip header when decompressing 3.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test8 b/tests/cts/gzip-compression/data/test8
new file mode 100644
index 00000000..568dc753
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test8
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%e8%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%e8%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. Invalid gzip header flags.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/data/test9 b/tests/cts/gzip-compression/data/test9
new file mode 100644
index 00000000..31f35b04
--- /dev/null
+++ b/tests/cts/gzip-compression/data/test9
@@ -0,0 +1,64 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+gzip compression
+</keywords>
+</info>
+
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</reply>
+
+<proxy-reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 22 Jul 2010 11:22:33 GMT
+Connection: close
+Content-Type: text/html
+Content-Encoding: gzip
+X-Control: swsclose
+
+%hex[%1f%8b%08%0C%a2%c1%12%60%00%03%62%6c%61%66%61%73%65%6c%00%73%ca%49%4c%4b%2c%4e%cd%51%48%c9%4c%55%48%49%e4%0a%ce%cf%4d%55%c8%cd%2f%02%71%4a%12%15%32%52%8b%52%b9%00%62%37%9b%0c%24%00%00%00%0a]hex%
+</data>
+</proxy-reply>
+
+<client>
+<server>
+http
+</server>
+<name>
+gzip-encoded content. gzip extra fields. Unreasonable amount of bytes to skip.
+</name>
+<features>
+proxy
+</features>
+<command>
+-H "Accept-Encoding: gzip" http://%HOSTIP:%HTTPPORT/gzip-compressed-data/%TESTNUMBER
+</command>
+</client>
+
+<verify>
+<protocol>
+GET /gzip-compressed-data/%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Accept-Encoding: gzip
+
+</protocol>
+<errorcode>
+0
+</errorcode>
+</verify>
+</testcase>
diff --git a/tests/cts/gzip-compression/gzip-compression.action b/tests/cts/gzip-compression/gzip-compression.action
new file mode 100644
index 00000000..0928e192
--- /dev/null
+++ b/tests/cts/gzip-compression/gzip-compression.action
@@ -0,0 +1,3 @@
+# Enable a filter so Privoxy decompresses the content
+{+filter{img-reorder}}
+/
diff --git a/tests/cts/gzip-compression/privoxy.conf b/tests/cts/gzip-compression/privoxy.conf
new file mode 100644
index 00000000..ba95f952
--- /dev/null
+++ b/tests/cts/gzip-compression/privoxy.conf
@@ -0,0 +1,20 @@
+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 ./gzip-compression.action
+
+# Reduce buffer limit so we reach it sooner
+buffer-limit 30
-- 
2.49.0