From 495e27861e3ae36bcd5bd92bd29f0d38eee6b871 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 10 Jan 2022 15:53:44 +0000 Subject: [PATCH] scripts: Make it obvious that test-bad-gzip.py doesn't work --- scripts/testing/gateway-responses/test-bad-gzip.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/testing/gateway-responses/test-bad-gzip.py b/scripts/testing/gateway-responses/test-bad-gzip.py index 598d4af..ff5ff11 100644 --- a/scripts/testing/gateway-responses/test-bad-gzip.py +++ b/scripts/testing/gateway-responses/test-bad-gzip.py @@ -1,9 +1,22 @@ #!/usr/bin/env python3 +# +# 2022-01-10: THIS SCRIPT DOES NOT PERFORM THE INTENDED PURPOSE +# BECAUSE IT SEEMS THAT `requests` (or underlying modules) IS TOO CLEVER +# AND APPLIES COMPRESSION WHEN WE SET THE `Content-Encoding: gzip` +# HEADER import json import requests import sys +print(''' +DO NOT USE THIS SCRIPT, IT DOES NOT PERFORM THE INTENDED PURPOSE. + +USE THE `test-bad-gzip.sh` SCRIPT INSTEAD. + +''') +sys.exit(-1) + if len(sys.argv) != 2: print('test-sender.py ') sys.exit(-1) @@ -13,6 +26,7 @@ with open(sys.argv[1], 'r') as f: s = requests.Session() + # This apparently causes compression to actually happen s.headers['Content-Encoding'] = 'gzip' r = s.post( 'https://beta.eddn.edcd.io:4431/upload/',