You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible that a change to file/directory causes a etag change and no last modified time change. For example:
Create folder A.
Create folder B.
Visit folder B.
Rename folder B to C, and then A to B.
Visit folder B (previous folder A).
At step 5, the client sents HTTP_IF_MODIFIED_SINCE header with the last modified time of folder B in step 2. Since the last modified time of folder A is less than B, the server will send 304 back, which is an error since the folder is actually changed.
To fix this, we should skip checking for 304 if the client already sends an etag which does not return 304. Here's a patch to fix this:
diff --git a/bottle.py b/bottle.py
index 0b22f2e..9ac9ee5 100755
--- a/bottle.py
+++ b/bottle.py
@@ -2914,11 +2914,12 @@ def static_file(filename, root,
if check and check == etag:
return HTTPResponse(status=304, **headers)
- ims = getenv('HTTP_IF_MODIFIED_SINCE')
- if ims:
- ims = parse_date(ims.split(";")[0].strip())
- if ims is not None and ims >= int(stats.st_mtime):
- return HTTPResponse(status=304, **headers)
+ if not (etag and check):
+ ims = getenv('HTTP_IF_MODIFIED_SINCE')
+ if ims:
+ ims = parse_date(ims.split(";")[0].strip())
+ if ims is not None and ims >= int(stats.st_mtime):
+ return HTTPResponse(status=304, **headers)
body = '' if request.method == 'HEAD' else open(filename, 'rb')
The text was updated successfully, but these errors were encountered:
defnull
added
the
Bug
This issue is an actual confirmed bug that needs fixing
label
May 28, 2019
It is possible that a change to file/directory causes a etag change and no last modified time change. For example:
At step 5, the client sents HTTP_IF_MODIFIED_SINCE header with the last modified time of folder B in step 2. Since the last modified time of folder A is less than B, the server will send 304 back, which is an error since the folder is actually changed.
To fix this, we should skip checking for 304 if the client already sends an etag which does not return 304. Here's a patch to fix this:
The text was updated successfully, but these errors were encountered: