MCPcopy
hub / github.com/urllib3/urllib3 / start_proxy_handler

Method start_proxy_handler

test/test_ssltransport.py:280–296  ·  view source on GitHub ↗

Socket handler for the proxy. Terminates the first TLS layer and tunnels any bytes needed for client <-> server communicatin.

(self)

Source from the content-addressed store, hash-verified

278 self.server_ctx, _ = server_client_ssl_contexts()
279
280 def start_proxy_handler(self) -> None:
281 """
282 Socket handler for the proxy. Terminates the first TLS layer and tunnels
283 any bytes needed for client <-> server communicatin.
284 """
285
286 def proxy_handler(listener: socket.socket) -> None:
287 sock = listener.accept()[0]
288 with self.server_ctx.wrap_socket(sock, server_side=True) as client_sock:
289 upstream_sock = socket.create_connection(
290 (self.destination_server_host, self.destination_server_port)
291 )
292 self._read_write_loop(client_sock, upstream_sock)
293 upstream_sock.close()
294 client_sock.close()
295
296 self._start_server(proxy_handler)
297
298 def _read_write_loop(
299 self,

Callers 1

start_proxy_serverMethod · 0.80

Calls 1

_start_serverMethod · 0.45

Tested by

no test coverage detected