Ticket #561 (defect)
Opened 2 years ago
Last modified 2 years ago
_cpwsgiserver.py should coerce response header values to strings
Status: closed (wontfix)
| Reported by: | wes@oxona.com | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | CherryPy code | Keywords: | |
| Cc: |
While using _cpwsgiserver.py with my pylons WSGI application I am getting an exception raised at http://www.cherrypy.org/browser/trunk/cherrypy/_cpwsgiserver.py#L326 stating "TypeError?: cannot concatenate 'str' and 'int' objects" because my Content-Length response header is an int.
I looked in the WSGI PEP and couldn't find a requirement that header values be strings and I did a quick survey of several WSGI apps and they all seem to use an int for the Content-Length header; so I think the response header values should be automatically coerced to strings in _cpwsgiserver.
I've only been using _cpwsgiserver for a total of 30 minutes so hopefully I'm not missing something obvious.
Thanks,
Wes Augur wes@oxona.com
Change History
09/08/06 02:25:57: Modified by fumanchu
09/08/06 13:40:24: Modified by fumanchu
- status changed from new to closed.
- resolution set to wontfix.
- milestone set to 3.0.
And here's the answer: http://mail.python.org/pipermail/web-sig/2006-September/002239.html
"I would urge you to have CherryPy reject servers or middleware providing integer content-length as broken, preferably with an error that indicates the application is not WSGI-compliant."
I added the error message in [1341].
09/11/06 13:24:40: Modified by bbangert
This bug is occuringin Paste's FileApp? which serves static files. It's been fixed in Paste trunk.


Although the PEP is arguably vague on this point, wsgiref and paste.lint are not; for example:
It would be in everyone's best interest for you to fix the application(s). However, we should probably decide this on web-sig, so I'm going to keep this open for now.