(host, port)
| 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 |