diff --git a/python/samba/tests/blackbox/http_chunk.py b/python/samba/tests/blackbox/http_chunk.py index 150ab2a3153..6745c8cb392 100644 --- a/python/samba/tests/blackbox/http_chunk.py +++ b/python/samba/tests/blackbox/http_chunk.py @@ -46,7 +46,10 @@ class ChunkHTTPRequestHandler(BaseHTTPRequestHandler): self.send_response(200) self.send_header('content-type', 'application/json; charset=UTF-8') - self.send_header('Transfer-Encoding', 'chunked') + if self.path == "usegziptransferencoding": + self.send_header('Transfer-Encoding', 'gzip') + else: + self.send_header('Transfer-Encoding', 'chunked') self.end_headers() resp = bytes() for chunk in chunks: @@ -114,3 +117,13 @@ class HttpChunkBlackboxTests(BlackboxTestCase): except BlackboxProcessError as e: print("Failed with: %s" % e) self.fail(str(e)) + + def test_gzip_transfer_encoding(self): + try: + msg = "usegziptransferencoding" + resp = self.check_output("%s -U%% -I%s --rsize 50 --uri %s" % (COMMAND, os.getenv("SERVER_IP", "localhost"), msg)) + self.assertEqual(msg, resp.decode('utf-8')) + self.fail("unexpected success") + except BlackboxProcessError as e: + if "http_response_needs_body: Unsupported transfer encoding type gzip" not in e.stderr.decode('utf-8'): + self.fail(str(e)) diff --git a/selftest/knownfail.d/http_chunk b/selftest/knownfail.d/http_chunk new file mode 100644 index 00000000000..9fa71d64fb4 --- /dev/null +++ b/selftest/knownfail.d/http_chunk @@ -0,0 +1 @@ +^samba.tests.blackbox.http_chunk.samba.tests.blackbox.http_chunk.HttpChunkBlackboxTests.test_gzip_transfer_encoding