mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-18 11:55:46 +08:00
backport If-Modified-Since fix from tornado
See facebook/tornado#713 closes #3177
This commit is contained in:
parent
29b2d7ff95
commit
09913471e7
@ -820,7 +820,7 @@ class FileFindHandler(web.StaticFileHandler):
|
||||
raise HTTPError(403, "%s is not a file", path)
|
||||
|
||||
stat_result = os.stat(abspath)
|
||||
modified = datetime.datetime.fromtimestamp(stat_result[stat.ST_MTIME])
|
||||
modified = datetime.datetime.utcfromtimestamp(stat_result[stat.ST_MTIME])
|
||||
|
||||
self.set_header("Last-Modified", modified)
|
||||
|
||||
@ -844,7 +844,7 @@ class FileFindHandler(web.StaticFileHandler):
|
||||
ims_value = self.request.headers.get("If-Modified-Since")
|
||||
if ims_value is not None:
|
||||
date_tuple = email.utils.parsedate(ims_value)
|
||||
if_since = datetime.datetime.fromtimestamp(time.mktime(date_tuple))
|
||||
if_since = datetime.datetime(*date_tuple[:6])
|
||||
if if_since >= modified:
|
||||
self.set_status(304)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user