mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
commit
a4266c9690
2 changed files with 8 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
* Improve: disable fsync during storage verification
|
* Improve: disable fsync during storage verification
|
||||||
* Improve: suppress duplicate log lines on startup
|
* Improve: suppress duplicate log lines on startup
|
||||||
* Contrib: logwatch config and script
|
* Contrib: logwatch config and script
|
||||||
|
* Improve: log precondition result on PUT request
|
||||||
|
|
||||||
## 3.3.2
|
## 3.3.2
|
||||||
* Fix: debug logging in rights/from_file
|
* Fix: debug logging in rights/from_file
|
||||||
|
|
|
@ -198,15 +198,22 @@ class ApplicationPartPut(ApplicationBase):
|
||||||
etag = environ.get("HTTP_IF_MATCH", "")
|
etag = environ.get("HTTP_IF_MATCH", "")
|
||||||
if not item and etag:
|
if not item and etag:
|
||||||
# Etag asked but no item found: item has been removed
|
# Etag asked but no item found: item has been removed
|
||||||
|
logger.warning("Precondition failed on PUT request for %r (HTTP_IF_MATCH: %s, item not existing)", path, etag)
|
||||||
return httputils.PRECONDITION_FAILED
|
return httputils.PRECONDITION_FAILED
|
||||||
if item and etag and item.etag != etag:
|
if item and etag and item.etag != etag:
|
||||||
# Etag asked but item not matching: item has changed
|
# Etag asked but item not matching: item has changed
|
||||||
|
logger.warning("Precondition failed on PUT request for %r (HTTP_IF_MATCH: %s, item has different etag: %s)", path, etag, item.etag)
|
||||||
return httputils.PRECONDITION_FAILED
|
return httputils.PRECONDITION_FAILED
|
||||||
|
if item and etag:
|
||||||
|
logger.debug("Precondition passed on PUT request for %r (HTTP_IF_MATCH: %s, item has etag: %s)", path, etag, item.etag)
|
||||||
|
|
||||||
match = environ.get("HTTP_IF_NONE_MATCH", "") == "*"
|
match = environ.get("HTTP_IF_NONE_MATCH", "") == "*"
|
||||||
if item and match:
|
if item and match:
|
||||||
# Creation asked but item found: item can't be replaced
|
# Creation asked but item found: item can't be replaced
|
||||||
|
logger.warning("Precondition failed on PUT request for %r (HTTP_IF_NONE_MATCH: *, creation requested but item found with etag: %s)", path, item.etag)
|
||||||
return httputils.PRECONDITION_FAILED
|
return httputils.PRECONDITION_FAILED
|
||||||
|
if match:
|
||||||
|
logger.debug("Precondition passed on PUT request for %r (HTTP_IF_NONE_MATCH: *)", path)
|
||||||
|
|
||||||
if (tag != prepared_tag or
|
if (tag != prepared_tag or
|
||||||
prepared_write_whole_collection != write_whole_collection):
|
prepared_write_whole_collection != write_whole_collection):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue