mirror of
https://github.com/EDCD/EDDN.git
synced 2026-11-18 01:32:25 +03:00
Gateway: typing: get_decompressed_message()
This commit is contained in:
1 parent
2a2017ed51
commit
2e64ac2e9b
1 file changed
+4
-4
+4
-4
@@ -143,18 +143,18 @@ def push_message(parsed_message: Dict, topic: str) -> None:
|
||||
stats_collector.tally("outbound")
|
||||
|
||||
|
||||
def get_remote_address():
|
||||
def get_remote_address() -> str:
|
||||
"""
|
||||
Determine the address of the uploading client.
|
||||
|
||||
First checks the for proxy-forwarded headers, then falls back to
|
||||
request.remote_addr.
|
||||
:rtype: str
|
||||
:returns: Best attempt at remote address.
|
||||
"""
|
||||
return request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||
|
||||
|
||||
def get_decompressed_message():
|
||||
def get_decompressed_message() -> bytes:
|
||||
"""
|
||||
Detect gzip Content-Encoding headers and de-compress on the fly.
|
||||
|
||||
@@ -189,7 +189,7 @@ def get_decompressed_message():
|
||||
# This is a form-encoded POST. The value of the data attrib will
|
||||
# be the body we're looking for.
|
||||
try:
|
||||
message_body = form_enc_parsed['data'][0]
|
||||
message_body = form_enc_parsed[b'data'][0]
|
||||
|
||||
except (KeyError, IndexError):
|
||||
logger.error('form-encoded, compressed, upload did not contain a "data" key. From %s', get_remote_address())
|
||||
|
||||
Reference in new issue
Block a user