未验证 提交 24d2ebd8 编写于 作者: B Ben Darnell 提交者: GitHub

Merge pull request #2270 from polygon/fix/etag304

Fix/etag304
......@@ -1081,6 +1081,13 @@ class StaticFileTest(WebTestCase):
'If-None-Match': response1.headers['Etag']})
self.assertEqual(response2.code, 304)
def test_static_304_etag_modified_bug(self):
response1 = self.get_and_head("/static/robots.txt")
response2 = self.get_and_head("/static/robots.txt", headers={
'If-None-Match': '"MISMATCH"',
'If-Modified-Since': response1.headers['Last-Modified']})
self.assertEqual(response2.code, 200)
def test_static_if_modified_since_pre_epoch(self):
# On windows, the functions that work with time_t do not accept
# negative values, and at least one client (processing.js) seems
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册