1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 00:30:33 +03:00

fix gzip support in debug_webserver

This commit is contained in:
A_D 2022-01-27 16:02:06 +02:00
parent d6dcebf545
commit 38f35403c9
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -1,4 +1,5 @@
"""Simple HTTP listener to be used with debugging various EDMC sends.""" """Simple HTTP listener to be used with debugging various EDMC sends."""
import gzip
import json import json
import pathlib import pathlib
import tempfile import tempfile
@ -36,7 +37,10 @@ class LoggingHandler(server.BaseHTTPRequestHandler):
encoding = self.headers.get('Content-Encoding') encoding = self.headers.get('Content-Encoding')
if encoding in ('gzip', 'deflate'): if encoding == 'gzip':
data = gzip.decompress(data_raw).decode('utf-8', errors='replace')
elif encoding == 'deflate':
data = zlib.decompress(data_raw).decode('utf-8', errors='replace') data = zlib.decompress(data_raw).decode('utf-8', errors='replace')
else: else: