From c6322f0096d2b07091af82752130c075ce75df07 Mon Sep 17 00:00:00 2001 From: Chris Cahoon Date: Tue, 21 Jul 2009 20:46:49 +0000 Subject: [PATCH] [soc2009/http-wsgi-improvments] ``HttpResponseSendFile`` now works (again?) using the X-SendFile header under the wsgi handler. refs #2131 Tests for other headers (and mod_python) are underway. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/http-wsgi-improvements@11284 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/handlers/wsgi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py index 22e65b8f24..ebf45a6368 100644 --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -240,14 +240,16 @@ class WSGIHandler(base.BaseHandler): response_headers = [(str(k), str(v)) for k, v in response.items()] for c in response.cookies.values(): response_headers.append(('Set-Cookie', str(c.output(header='')))) - start_response(status, response_headers) if isinstance(response, http.HttpResponseSendFile): if settings.HTTPRESPONSE_SENDFILE_METHOD: - response[settings.HTTPRESPONSE_SENDFILE_METHOD] = response.sendfile_filename + response_headers.append((settings.HTTPRESPONSE_SENDFILE_METHOD, + response.sendfile_filename)) elif 'wsgi.file_wrapper' in environ: filelike = open(response.sendfile_filename, 'rb') return environ['wsgi.file_wrapper'](filelike, response.block_size) + + start_response(status, response_headers) return response