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:
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))