Gateway: Put remote_addr in [], as it could be multiple, comma-separated

# Conflicts:
#	src/eddn/Gateway.py

# Conflicts:
#	src/eddn/Gateway.py
This commit is contained in:
Athanasius 2022-08-18 15:20:12 +01:00
parent 9bf24f9a05
commit d5dbc3262f
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62

View File

@ -208,7 +208,7 @@ def parse_and_error_handle(data: bytes) -> str:
# semi-useful error message, so do so.
try:
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,
"<<UNKNOWN>>",
"<<UNKNOWN>>",
@ -251,7 +251,7 @@ def parse_and_error_handle(data: bytes) -> str:
parsed_message
)
logger.info(
"Accepted (%d, '%s', '%s', '%s', '%s', '%s') from %s",
"Accepted (%d, '%s', '%s', '%s', '%s', '%s') from [%s]",
request.content_length,
uploader_id,
software_name,
@ -274,7 +274,7 @@ def parse_and_error_handle(data: bytes) -> str:
parsed_message
)
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),
request.content_length,
uploader_id,
@ -314,7 +314,7 @@ def upload() -> str:
try:
logger.error(
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:
@ -328,7 +328,7 @@ def upload() -> str:
# They probably sent an encoded POST, but got the key/val wrong.
response.status = 400
# 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)