]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix erroneous 304 of StaticFileHandler 2270/head
authorJan Dohl <jan@legxaro.de>
Sat, 3 Feb 2018 22:58:19 +0000 (23:58 +0100)
committerJan Dohl <jan@legxaro.de>
Sat, 3 Feb 2018 22:58:19 +0000 (23:58 +0100)
StaticFileHandler would return a 304 despite the client sending
a non-matching Etag header when If-Modified-Since matches

tornado/web.py

index 5fa3abd8b5e6d5d2fbd4dcdf3d98723309fca1be..7bf5415d0b43b21de0949bd0f77c8946c1bc69d1 100644 (file)
@@ -2499,8 +2499,9 @@ class StaticFileHandler(RequestHandler):
 
         .. versionadded:: 3.1
         """
-        if self.check_etag_header():
-            return True
+        # If client sent If-None-Match, use it, ignore If-Modified-Since
+        if self.request.headers.get('If-None-Match'):
+            return self.check_etag_header()
 
         # Check the If-Modified-Since, and don't send the result if the
         # content has not been modified