Commits

Robert Brewer committed da3299f

cherrypy-3.0.x: Fix for #868 (traceback returned when CherryPy receives invalid cookie).

  • Participants
  • Parent commits 49b22a7
  • Branches cherrypy-3.0.x

Comments (0)

Files changed (1)

cherrypy/_cprequest.py

             # Handle cookies differently because on Konqueror, multiple
             # cookies come on different lines with the same key
             if name == 'Cookie':
-                self.cookie.load(value)
+                try:
+                    self.cookie.load(value)
+                except Cookie.CookieError:
+                    msg = "Illegal cookie name %s" % value.split('=')[0]
+                    raise cherrypy.HTTPError(400, msg)
         
         if not dict.__contains__(headers, 'Host'):
             # All Internet-based HTTP/1.1 servers MUST respond with a 400