mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-08 11:22:13 +03:00
scripts: Make it obvious that test-bad-gzip.py doesn't work
This commit is contained in:
parent
a8098f45b9
commit
495e27861e
@ -1,9 +1,22 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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 json
|
||||||
import requests
|
import requests
|
||||||
import sys
|
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:
|
if len(sys.argv) != 2:
|
||||||
print('test-sender.py <filename>')
|
print('test-sender.py <filename>')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
@ -13,6 +26,7 @@ with open(sys.argv[1], 'r') as f:
|
|||||||
|
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
|
|
||||||
|
# This apparently causes compression to actually happen
|
||||||
s.headers['Content-Encoding'] = 'gzip'
|
s.headers['Content-Encoding'] = 'gzip'
|
||||||
r = s.post(
|
r = s.post(
|
||||||
'https://beta.eddn.edcd.io:4431/upload/',
|
'https://beta.eddn.edcd.io:4431/upload/',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user