Commits

ianb  committed e1536a4

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

  • Participants
  • Parent commits 5900c11

Comments (0)

Files changed (1)

File paste/httpheaders.py

     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))
                 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