Issue #1160 new

traceback if content header is not integer causes internal server error instead of bad request

space one
created an issue

If the content-length header is not a integer the server responses with 500 instead of 400 Bad Request:

$ curl -i -H 'Content-Length: a' 'http://localhost:8080/'

ENGINE ValueError("invalid literal for int() with base 10: 'a'",) Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 1292, in communicate req.parse_request() File "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 591, in parse_request success = self.read_request_headers() File "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 711, in read_request_headers if mrbs and int(self.inheaders.get("Content-Length", 0)) > mrbs: ValueError: invalid literal for int() with base 10: 'a'