mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-26 13:12:13 +03:00
Gateway: Put remote_addr in [], as it could be multiple, comma-separated
This commit is contained in:
parent
b137d8c234
commit
82ad3d54c7
@ -190,7 +190,7 @@ def get_decompressed_message() -> bytes:
|
|||||||
# body. If it's not form-encoded, this will return an empty dict.
|
# body. If it's not form-encoded, this will return an empty dict.
|
||||||
form_enc_parsed = parse_qs(message_body)
|
form_enc_parsed = parse_qs(message_body)
|
||||||
if form_enc_parsed:
|
if form_enc_parsed:
|
||||||
logger.info("Request is form-encoded, compressed, from %s", get_remote_address())
|
logger.info("Request is form-encoded, compressed, from [%s]", get_remote_address())
|
||||||
# This is a form-encoded POST. The value of the data attrib will
|
# This is a form-encoded POST. The value of the data attrib will
|
||||||
# be the body we're looking for.
|
# be the body we're looking for.
|
||||||
try:
|
try:
|
||||||
@ -216,7 +216,7 @@ def get_decompressed_message() -> bytes:
|
|||||||
# POST key/vals, or un-encoded body.
|
# POST key/vals, or un-encoded body.
|
||||||
data_key = request.forms.get("data")
|
data_key = request.forms.get("data")
|
||||||
if data_key:
|
if data_key:
|
||||||
logger.info("Request is form-encoded, uncompressed, from %s", get_remote_address())
|
logger.info("Request is form-encoded, uncompressed, from [%s]", get_remote_address())
|
||||||
# This is a form-encoded POST. Support the silly people.
|
# This is a form-encoded POST. Support the silly people.
|
||||||
message_body = data_key
|
message_body = data_key
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ def parse_and_error_handle(data: bytes) -> str:
|
|||||||
# semi-useful error message, so do so.
|
# semi-useful error message, so do so.
|
||||||
try:
|
try:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Error - JSON parse failed (%d, '%s', '%s', '%s', '%s', '%s') from %s:\n%s\n",
|
"Error - JSON parse failed (%d, '%s', '%s', '%s', '%s', '%s') from [%s]:\n%s\n",
|
||||||
request.content_length,
|
request.content_length,
|
||||||
"<<UNKNOWN>>",
|
"<<UNKNOWN>>",
|
||||||
"<<UNKNOWN>>",
|
"<<UNKNOWN>>",
|
||||||
@ -286,7 +286,7 @@ def parse_and_error_handle(data: bytes) -> str:
|
|||||||
parsed_message
|
parsed_message
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
"Accepted (%d, '%s', '%s', '%s', '%s', '%s') from %s",
|
"Accepted (%d, '%s', '%s', '%s', '%s', '%s') from [%s]",
|
||||||
request.content_length,
|
request.content_length,
|
||||||
uploader_id,
|
uploader_id,
|
||||||
software_name,
|
software_name,
|
||||||
@ -309,7 +309,7 @@ def parse_and_error_handle(data: bytes) -> str:
|
|||||||
parsed_message
|
parsed_message
|
||||||
)
|
)
|
||||||
logger.error(
|
logger.error(
|
||||||
"Failed Validation '%s' (%d, '%s', '%s', '%s', '%s', '%s') from %s",
|
"Failed Validation '%s' (%d, '%s', '%s', '%s', '%s', '%s') from [%s]",
|
||||||
str(validation_results.messages),
|
str(validation_results.messages),
|
||||||
request.content_length,
|
request.content_length,
|
||||||
uploader_id,
|
uploader_id,
|
||||||
@ -349,7 +349,7 @@ def upload() -> str:
|
|||||||
try:
|
try:
|
||||||
logger.error(
|
logger.error(
|
||||||
f"gzip error ({request.content_length}, '<<UNKNOWN>>', '<<UNKNOWN>>', '<<UNKNOWN>>'"
|
f"gzip error ({request.content_length}, '<<UNKNOWN>>', '<<UNKNOWN>>', '<<UNKNOWN>>'"
|
||||||
", '<<UNKNOWN>>', '<<UNKNOWN>>') from {get_remote_address()}"
|
", '<<UNKNOWN>>', '<<UNKNOWN>>') from [{get_remote_address()}]"
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -363,7 +363,7 @@ def upload() -> str:
|
|||||||
# They probably sent an encoded POST, but got the key/val wrong.
|
# They probably sent an encoded POST, but got the key/val wrong.
|
||||||
response.status = 400
|
response.status = 400
|
||||||
# TODO: Maybe just `{exc}` ?
|
# TODO: Maybe just `{exc}` ?
|
||||||
logger.error("MalformedUploadError from %s: %s", get_remote_address(), str(exc))
|
logger.error("MalformedUploadError from [%s]: %s", get_remote_address(), str(exc))
|
||||||
|
|
||||||
return "FAIL: Malformed Upload: " + str(exc)
|
return "FAIL: Malformed Upload: " + str(exc)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user