1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #2560 -- Add close() support to HttpResponse iterators. Thanks, Ivan

Sagalaev.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3791 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2006-09-22 12:32:00 +00:00
parent dc39762fde
commit c3d7aad6d0
3 changed files with 24 additions and 16 deletions

View File

@@ -155,8 +155,11 @@ def populate_apache_request(http_response, mod_python_req):
for c in http_response.cookies.values():
mod_python_req.headers_out.add('Set-Cookie', c.output(header=''))
mod_python_req.status = http_response.status_code
for chunk in http_response.iterator:
mod_python_req.write(chunk)
try:
for chunk in http_response:
mod_python_req.write(chunk)
finally:
http_response.close()
def handler(req):
# mod_python hooks into this function.

View File

@@ -163,4 +163,4 @@ class WSGIHandler(BaseHandler):
for c in response.cookies.values():
response_headers.append(('Set-Cookie', c.output(header='')))
start_response(status, response_headers)
return response.iterator
return response