utils_proxy.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:cockatiel 作者: raphaelm 项目源码 文件源码
def response_to_proxy_response(self, response, response_content):
        proxy_response = aiohttp.Response(self.writer, response.status, http_version=response.version)

        # Copy response headers, except for Content-Encoding header,
        # since unfortunately aiohttp transparently decodes content.
        proxy_response_headers = [(name, value)
                                  for name, value
                                  in response.headers.items() if name not in ('CONTENT-ENCODING',)]
        proxy_response.add_headers(*proxy_response_headers)
        proxy_response.send_headers()

        proxy_response.write(response_content)
        yield from proxy_response.write_eof()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号