1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +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."""
import gzip
import json
import pathlib
import tempfile
@ -36,7 +37,10 @@ class LoggingHandler(server.BaseHTTPRequestHandler):
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')
else: