Lines Matching refs:self
31 def __init__(self, *args, **kwargs):
37 self._connections = {}
39 super(RequestHandler, self).__init__(*args, **kwargs)
41 def _proxy_request(self):
49 target = urllib.parse.urlparse(self.path)
53 conn = self._connections.get(target.netloc, None)
60 for header_name in self.headers:
63 for header_value in self.headers.get_all(header_name):
67 client_address = '{}:{}'.format(*self.client_address)
68 x_forwarded_for_header = self.headers.get('X-Forwarded-For', None)
76 request_body_length = int(self.headers.get('Content-Length', '0'))
77 request_body = self.rfile.read(request_body_length)
84 conn.request(self.command, target_path, request_body, client_headers)
88 self.send_response_only(response.status, response.reason)
90 self.send_header(header_name, header_value)
91 self.end_headers()
98 self.wfile.write(response.read(response_content_length))
102 connection_header_value = self.headers.get('Connection', None)
105 self.close_connection = True
109 self._connections[target.netloc] = conn
111 self.log_message(
114 self.path)
116 def do_GET(self):
117 self._proxy_request()
119 def do_HEAD(self):
120 self._proxy_request()
122 def do_POST(self):
123 self._proxy_request()
125 def do_PUT(self):
126 self._proxy_request()
128 def do_DELETE(self):
129 self._proxy_request()
131 def do_PATCH(self):
132 self._proxy_request()
134 def do_OPTIONS(self):
135 self._proxy_request()