mirror of
https://github.com/Kozea/Radicale.git
synced 2025-07-23 17:48:30 +00:00
add option to log bad PUT request content
This commit is contained in:
parent
96b63ed65f
commit
4678612194
4 changed files with 10 additions and 0 deletions
3
config
3
config
|
@ -120,6 +120,9 @@
|
||||||
# Don't include passwords in logs
|
# Don't include passwords in logs
|
||||||
#mask_passwords = True
|
#mask_passwords = True
|
||||||
|
|
||||||
|
# Log bad PUT request content
|
||||||
|
#bad_put_request_content = False
|
||||||
|
|
||||||
|
|
||||||
[headers]
|
[headers]
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
|
||||||
"""
|
"""
|
||||||
super().__init__(configuration)
|
super().__init__(configuration)
|
||||||
self._mask_passwords = configuration.get("logging", "mask_passwords")
|
self._mask_passwords = configuration.get("logging", "mask_passwords")
|
||||||
|
self._bad_put_request_content = configuration.get("logging", "bad_put_request_content")
|
||||||
self._auth_delay = configuration.get("auth", "delay")
|
self._auth_delay = configuration.get("auth", "delay")
|
||||||
self._internal_server = configuration.get("server", "_internal_server")
|
self._internal_server = configuration.get("server", "_internal_server")
|
||||||
self._max_content_length = configuration.get(
|
self._max_content_length = configuration.get(
|
||||||
|
|
|
@ -146,6 +146,8 @@ class ApplicationPartPut(ApplicationBase):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Bad PUT request on %r (read_components): %s", path, e, exc_info=True)
|
"Bad PUT request on %r (read_components): %s", path, e, exc_info=True)
|
||||||
|
if self._bad_put_request_content:
|
||||||
|
logger.warning("Bad PUT request content of %r:\n%s", path, content)
|
||||||
return httputils.BAD_REQUEST
|
return httputils.BAD_REQUEST
|
||||||
(prepared_items, prepared_tag, prepared_write_whole_collection,
|
(prepared_items, prepared_tag, prepared_write_whole_collection,
|
||||||
prepared_props, prepared_exc_info) = prepare(
|
prepared_props, prepared_exc_info) = prepare(
|
||||||
|
|
|
@ -247,6 +247,10 @@ DEFAULT_CONFIG_SCHEMA: types.CONFIG_SCHEMA = OrderedDict([
|
||||||
"value": "info",
|
"value": "info",
|
||||||
"help": "threshold for the logger",
|
"help": "threshold for the logger",
|
||||||
"type": logging_level}),
|
"type": logging_level}),
|
||||||
|
("bad_put_request_content", {
|
||||||
|
"value": "False",
|
||||||
|
"help": "log bad PUT request content",
|
||||||
|
"type": bool}),
|
||||||
("mask_passwords", {
|
("mask_passwords", {
|
||||||
"value": "True",
|
"value": "True",
|
||||||
"help": "mask passwords in logs",
|
"help": "mask passwords in logs",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue