From fcd0b0b544f59d5a4bd9a5132d7a124cca78d4a0 Mon Sep 17 00:00:00 2001 From: Jan Dohl Date: Sat, 3 Feb 2018 23:58:19 +0100 Subject: [PATCH] Fix erroneous 304 of StaticFileHandler StaticFileHandler would return a 304 despite the client sending a non-matching Etag header when If-Modified-Since matches --- tornado/web.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tornado/web.py b/tornado/web.py index 5fa3abd8b..7bf5415d0 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -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 -- 2.47.2