mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-02 00:21:05 +03:00
Applied requested changes
This commit is contained in:
parent
f609545fdc
commit
2e5e55af9a
@ -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
|
`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`.
|
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.
|
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:
|
The simplest way to go about adding support is:
|
||||||
|
@ -47,6 +47,7 @@ class LoggingHandler(server.BaseHTTPRequestHandler):
|
|||||||
self.send_response_only(200, "OK")
|
self.send_response_only(200, "OK")
|
||||||
if response is not None:
|
if response is not None:
|
||||||
self.send_header('Content-Length', str(len(response)))
|
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>
|
self.end_headers() # This is needed because send_response_only DOESN'T ACTUALLY SEND THE RESPONSE </rant>
|
||||||
if response is not None:
|
if response is not None:
|
||||||
self.wfile.write(response.encode())
|
self.wfile.write(response.encode())
|
||||||
@ -63,7 +64,7 @@ class LoggingHandler(server.BaseHTTPRequestHandler):
|
|||||||
target_file = output_data_path / (safe_file_name(target_path) + '.log')
|
target_file = output_data_path / (safe_file_name(target_path) + '.log')
|
||||||
if target_file.parent != output_data_path:
|
if target_file.parent != output_data_path:
|
||||||
logger.warning(f"REFUSING TO WRITE FILE THAT ISN'T IN THE RIGHT PLACE! {target_file=}")
|
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
|
return
|
||||||
|
|
||||||
with output_lock, target_file.open('a') as f:
|
with output_lock, target_file.open('a') as f:
|
||||||
|
@ -536,7 +536,7 @@ if 'edsm' in debug_senders:
|
|||||||
# Worker thread
|
# Worker thread
|
||||||
|
|
||||||
|
|
||||||
def worker() -> None:
|
def worker() -> None: # noqa: CCR001 C901 # Cant be broken up currently
|
||||||
"""
|
"""
|
||||||
Handle uploading events to EDSM API.
|
Handle uploading events to EDSM API.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user