Handle "If-None-Match: *" HTTP headers for PUT requests
This commit is contained in:
parent
237f42909a
commit
e06cfa4de0
@ -474,8 +474,9 @@ class Application(object):
|
|||||||
|
|
||||||
# Evolution bug workaround
|
# Evolution bug workaround
|
||||||
etag = environ.get("HTTP_IF_MATCH", "").replace("\\", "")
|
etag = environ.get("HTTP_IF_MATCH", "").replace("\\", "")
|
||||||
|
match = environ.get("HTTP_IF_NONE_MATCH", "") == "*"
|
||||||
if (not item and not etag) or (
|
if (not item and not etag) or (
|
||||||
item and ((etag or item.etag) == item.etag)):
|
item and ((etag or item.etag) == item.etag) and not match):
|
||||||
# PUT allowed in 3 cases
|
# PUT allowed in 3 cases
|
||||||
# Case 1: No item and no ETag precondition: Add new item
|
# Case 1: No item and no ETag precondition: Add new item
|
||||||
# Case 2: Item and ETag precondition verified: Modify item
|
# Case 2: Item and ETag precondition verified: Modify item
|
||||||
|
Loading…
Reference in New Issue
Block a user