mirror of https://gitlab.com/bashrc2/epicyon
Whether to log unknown requests
parent
fbdd9a301b
commit
41e5a9d098
|
|
@ -484,6 +484,7 @@ class EpicyonServer(ThreadingHTTPServer):
|
||||||
robots_txt = None
|
robots_txt = None
|
||||||
last_llm_time = None
|
last_llm_time = None
|
||||||
mitm_servers = []
|
mitm_servers = []
|
||||||
|
log_unknown_requests: bool = False
|
||||||
watermark_width_percent = 0
|
watermark_width_percent = 0
|
||||||
watermark_position = 0
|
watermark_position = 0
|
||||||
watermark_opacity = 0
|
watermark_opacity = 0
|
||||||
|
|
@ -712,6 +713,14 @@ def run_daemon(accounts_data_dir: str,
|
||||||
# the last time when an LLM scraper was replied to
|
# the last time when an LLM scraper was replied to
|
||||||
httpd.last_llm_time = None
|
httpd.last_llm_time = None
|
||||||
|
|
||||||
|
# whether to log unknown requests
|
||||||
|
httpd.log_unknown_requests = \
|
||||||
|
get_config_param(base_dir, 'logUnknownRequests')
|
||||||
|
if httpd.log_unknown_requests is None:
|
||||||
|
httpd.log_unknown_requests = False
|
||||||
|
if not isinstance(httpd.log_unknown_requests, bool):
|
||||||
|
httpd.log_unknown_requests = False
|
||||||
|
|
||||||
# servers with man-in-the-middle transport encryption
|
# servers with man-in-the-middle transport encryption
|
||||||
httpd.mitm_servers = load_mitm_servers(base_dir)
|
httpd.mitm_servers = load_mitm_servers(base_dir)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6147,8 +6147,8 @@ def daemon_http_get(self) -> None:
|
||||||
'_GET', 'arbitrary json',
|
'_GET', 'arbitrary json',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
else:
|
else:
|
||||||
if self.server.debug:
|
if self.server.debug or self.server.log_unknown_requests:
|
||||||
print('DEBUG: GET Unknown file')
|
print('DEBUG: GET Unknown request ' + self.path)
|
||||||
http_404(self, 144)
|
http_404(self, 144)
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1603,6 +1603,11 @@ def _command_options() -> None:
|
||||||
set_config_param(base_dir, 'instanceDescription',
|
set_config_param(base_dir, 'instanceDescription',
|
||||||
'Just another ActivityPub server')
|
'Just another ActivityPub server')
|
||||||
|
|
||||||
|
# whether to log unknown requests
|
||||||
|
log_unknown_requests = get_config_param(base_dir, 'logUnknownRequests')
|
||||||
|
if log_unknown_requests is None:
|
||||||
|
set_config_param(base_dir, 'logUnknownRequests', False)
|
||||||
|
|
||||||
# set the short instance description in config.json
|
# set the short instance description in config.json
|
||||||
desc_short = get_config_param(base_dir, 'instanceDescriptionShort')
|
desc_short = get_config_param(base_dir, 'instanceDescriptionShort')
|
||||||
if not desc_short:
|
if not desc_short:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue