def handle_http_proxy(self):
if self.is_tunnel_http_proxy():
logger.debug("{0} proxy tunnel to {1}".format(self, self.req.path))
scheme, host, port = parse_tunnel_proxy_path(self.req.path)
yield self.connect_to_dest(scheme, (host, port))
self.src_conn.send_response(HttpResponse(
code="200",
reason="OK", version="HTTP/1.1"))
raise SwitchToTunnelHttpProxy
elif self.is_normal_http_proxy():
logger.debug("{0} proxy to {1}".format(self, self.req.path))
scheme, host, port, path = parse_proxy_path(self.req.path)
self.req.path = path
yield self.connect_to_dest(scheme, (host, port))
self.dest_conn.io_stream = self.dest_stream
else:
raise gen.Return(None)
评论列表
文章目录