Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Fix for invalid IfModifiedSince header format from IE8.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jai Sharma authored and Arachnid committed Jan 27, 2010
1 parent 844926d commit 1c1e167
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions static.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ def get(self, path):

serve = True
if 'If-Modified-Since' in self.request.headers:
last_seen = datetime.datetime.strptime(
self.request.headers['If-Modified-Since'],
HTTP_DATE_FMT)
if last_seen >= content.last_modified.replace(microsecond=0):
serve = False
try:
last_seen = datetime.datetime.strptime(
self.request.headers['If-Modified-Since'].split(';')[0],# IE8 '; length=XXXX' as extra arg bug
HTTP_DATE_FMT)
if last_seen >= content.last_modified.replace(microsecond=0):
serve = False
except ValueError, e:
import logging
logging.error('StaticContentHandler in static.py, ValueError:' + self.request.headers['If-Modified-Since'])
if 'If-None-Match' in self.request.headers:
etags = [x.strip('" ')
for x in self.request.headers['If-None-Match'].split(',')]
Expand Down

0 comments on commit 1c1e167

Please sign in to comment.