MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _proxy_connect

Function _proxy_connect

e2e/python/test_sandbox_policy.py:78–93  ·  view source on GitHub ↗

Return a closure that sends a raw CONNECT and returns the status line.

()

Source from the content-addressed store, hash-verified

76
77
78def _proxy_connect():
79 """Return a closure that sends a raw CONNECT and returns the status line."""
80
81 def fn(host, port):
82 import socket
83
84 conn = socket.create_connection(("10.200.0.1", 3128), timeout=10)
85 try:
86 conn.sendall(
87 f"CONNECT {host}:{port} HTTP/1.1\r\nHost: {host}\r\n\r\n".encode()
88 )
89 return conn.recv(256).decode("latin1")
90 finally:
91 conn.close()
92
93 return fn
94
95
96def _proxy_connect_then_http():

Calls

no outgoing calls

Tested by

no test coverage detected