home / django_tickets / tickets

tickets: 112

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
112 2005-07-20 15:25:13 2006-09-14 00:37:53 2022-03-06 03:19:46.931692 Unreviewed closed Core (Other) defect normal   fixed WSGI requires a HTTP reason in the status The WSGI-spec clearly requires a reason-phrase when calling start_response, and Apache breaks proxied responses that are missing the reason phrase. So the Django wsgi-adapter is quite broken in the respect. Below is a patch which fixes this. The mapping of HTTP reason-phrases is incomplete, but at least now Django works when being proxied by Apache. {{{ Index: core/handlers/wsgi.py =================================================================== --- core/handlers/wsgi.py (revision 241) +++ core/handlers/wsgi.py (working copy) @@ -1,6 +1,12 @@ from django.utils import datastructures, httpwrappers from pprint import pformat +reasons = { + 200: 'Ok', + 404: 'Not found', + 500: 'Internal Server Error', +} + class WSGIRequest(httpwrappers.HttpRequest): def __init__(self, environ): self.environ = environ @@ -121,7 +127,7 @@ for middleware_method in self._response_middleware: response = middleware_method(request, response) - status = str(response.status_code) + ' ' # TODO: Extra space here is a hack. + status = '%d %s' % (response.status_code, reasons.get(response.status_code, 'Unknown status-code')) response_headers = response.headers if response.cookies: response_headers['Set-Cookie'] = response.cookies.output(header='') }}} adrian sune.kirkeby@gmail.com wsgi 0 0 0 0 0 0
Powered by Datasette · Queries took 0.928ms