diff options
author | ianb <devnull@localhost> | 2006-07-13 18:01:53 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2006-07-13 18:01:53 +0000 |
commit | 7fd70897412fc58192742a4b1eac2d047fdfec96 (patch) | |
tree | f016722398d9cd51dce0804d5a6bc6f0ea808e56 /paste/httpheaders.py | |
parent | 0c5642be0eb84851267d4e6d868b65ae3c54d053 (diff) | |
download | paste-7fd70897412fc58192742a4b1eac2d047fdfec96.tar.gz |
More permissive parsing for dates in headers. IE in particular will add '; length=200' to If-Modified-Since, and that was producing BadRequest errors. Instead parameters on dates are now simply ignored
Diffstat (limited to 'paste/httpheaders.py')
-rw-r--r-- | paste/httpheaders.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/paste/httpheaders.py b/paste/httpheaders.py index e5bb85a..6af05c3 100644 --- a/paste/httpheaders.py +++ b/paste/httpheaders.py @@ -607,6 +607,8 @@ class _DateHeader(_SingleValueHeader): def parse(self, *args, **kwargs): """ return the time value (in seconds since 1970) """ value = self.__call__(*args, **kwargs) + if ';' in value: + value = value.split(';', 1)[0] if value: try: return mktime_tz(parsedate_tz(value)) @@ -614,7 +616,8 @@ class _DateHeader(_SingleValueHeader): raise HTTPBadRequest(( "Received an ill-formed timestamp for %s: %s\r\n") % (self.name, value)) - + else: + return None # # Following are specific HTTP headers. Since these classes are mostly # singletons, there is no point in keeping the class around once it has |