1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-05-30 07:09:39 +03:00

Applied requested changes

This commit is contained in:
A_D 2021-06-20 17:44:29 +02:00
parent f609545fdc
commit 2e5e55af9a
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4
3 changed files with 4 additions and 3 deletions

View File

@ -1055,7 +1055,7 @@ If said string exists, `DEBUG_WEBSERVER_HOST` and `DEBUG_WEBSERVER_PORT` in
`edmc_data` will contain the host and port for the currently running local webserver. Simply redirect your requests
there, and your requests will be logged to disk. For organisation, rewrite your request path to simply be `/pluginname`.
logs exist in `$TEMP/EDMarketConnector/http_debug/$path.log`. If somehow you manage to cause a directory traversal, your
Logs exist in `$TEMP/EDMarketConnector/http_debug/$path.log`. If somehow you manage to cause a directory traversal, your
data will not be saved to disk at all. You will see this in EDMCs log.
The simplest way to go about adding support is:

View File

@ -47,6 +47,7 @@ class LoggingHandler(server.BaseHTTPRequestHandler):
self.send_response_only(200, "OK")
if response is not None:
self.send_header('Content-Length', str(len(response)))
self.end_headers() # This is needed because send_response_only DOESN'T ACTUALLY SEND THE RESPONSE </rant>
if response is not None:
self.wfile.write(response.encode())
@ -63,7 +64,7 @@ class LoggingHandler(server.BaseHTTPRequestHandler):
target_file = output_data_path / (safe_file_name(target_path) + '.log')
if target_file.parent != output_data_path:
logger.warning(f"REFUSING TO WRITE FILE THAT ISN'T IN THE RIGHT PLACE! {target_file=}")
logger.warn(f'DATA FOLLOWS\n{data}')
logger.warning(f'DATA FOLLOWS\n{data}')
return
with output_lock, target_file.open('a') as f:

View File

@ -536,7 +536,7 @@ if 'edsm' in debug_senders:
# Worker thread
def worker() -> None:
def worker() -> None: # noqa: CCR001 C901 # Cant be broken up currently
"""
Handle uploading events to EDSM API.