mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user