| 163 | | populate_apache_request(response, req) |
|---|
| | 163 | req.content_type = response['Content-Type'] |
|---|
| | 164 | for key, value in response.headers.items(): |
|---|
| | 165 | if key != 'Content-Type': |
|---|
| | 166 | req.headers_out[key] = value |
|---|
| | 167 | for c in response.cookies.values(): |
|---|
| | 168 | req.headers_out.add('Set-Cookie', c.output(header='')) |
|---|
| | 169 | req.status = response.status_code |
|---|
| | 170 | try: |
|---|
| | 171 | for chunk in response: |
|---|
| | 172 | req.write(chunk) |
|---|
| | 173 | finally: |
|---|
| | 174 | response.close() |
|---|
| | 175 | |
|---|
| 165 | | |
|---|
| 166 | | def populate_apache_request(http_response, mod_python_req): |
|---|
| 167 | | "Populates the mod_python request object with an HttpResponse" |
|---|
| 168 | | mod_python_req.content_type = http_response['Content-Type'] |
|---|
| 169 | | for key, value in http_response.headers.items(): |
|---|
| 170 | | if key != 'Content-Type': |
|---|
| 171 | | mod_python_req.headers_out[key] = value |
|---|
| 172 | | for c in http_response.cookies.values(): |
|---|
| 173 | | mod_python_req.headers_out.add('Set-Cookie', c.output(header='')) |
|---|
| 174 | | mod_python_req.status = http_response.status_code |
|---|
| 175 | | try: |
|---|
| 176 | | for chunk in http_response: |
|---|
| 177 | | mod_python_req.write(chunk) |
|---|
| 178 | | finally: |
|---|
| 179 | | http_response.close() |
|---|