Commits

Ian Bicking  committed 1c339d3

Fix http://trac.pythonpaste.org/pythonpaste/ticket/398 -- properly reject dates that have out-of-range values

  • Participants
  • Parent commits 84664ab

Comments (0)

Files changed (2)

File paste/httpheaders.py

         if value:
             try:
                 return mktime_tz(parsedate_tz(value))
-            except TypeError:
+            except (TypeError, OverflowError):
                 raise HTTPBadRequest((
                     "Received an ill-formed timestamp for %s: %s\r\n") %
                     (self.name, value))

File tests/test_httpheaders.py

      ('Expires', 'Entity An-Expiration-Date'),
      ('Unknown-Header', 'Unknown Sorted Last')]
 
+def test_if_modified_since():
+    from paste.httpexceptions import HTTPBadRequest
+    date = 'Thu, 34 Jul 3119 29:34:18 GMT'
+    try:
+        x = IF_MODIFIED_SINCE.parse({'HTTP_IF_MODIFIED_SINCE': date,
+                                     'wsgi.version': (1, 0)})
+    except HTTPBadRequest:
+        pass
+    else:
+        assert 0