Skip to content

Commit

Permalink
backport If-Modified-Since fix from tornado
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Apr 15, 2013
1 parent 994dfc2 commit d4efed3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IPython/frontend/html/notebook/handlers.py
Expand Up @@ -820,7 +820,7 @@ def get(self, path, include_body=True):
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)

Expand All @@ -844,7 +844,7 @@ def get(self, path, include_body=True):
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
Expand Down

0 comments on commit d4efed3

Please sign in to comment.