XX-net/XX-Net · warning

https %r connect to %s:%d conn:%d closed.

Error message

https %r connect to %s:%d conn:%d closed.

What it means

After a successful CONNECT and tunnel creation, sending 'HTTP/1.1 200 OK' back to the client failed (client closed/reset). The bare except logs this and the tunnel data flow continues/terminates accordingly.

Source

Thrown at code/default/x_tunnel/local/proxy_handler.py:325

        host, _, port = path.rpartition(':')
        host = host.encode()
        port = int(port)

        header_block = self.read_headers()

        sock = self.connection
        conn_id = proxy_session.create_conn(sock, host, port)
        if not conn_id:
            xlog.warn("https create conn to %s:%d fail", host, port)
            sock.send(b'HTTP/1.1 500 Fail\r\n\r\n')
            return

        xlog.info("https %r connect to %s:%d conn:%d", self.client_address, host, port, conn_id)
        try:
            sock.send(b'HTTP/1.1 200 OK\r\n\r\n')
        except:
            xlog.warn("https %r connect to %s:%d conn:%d closed.", self.client_address, host, port, conn_id)

        if (len(self.read_buffer) - self.buffer_start) > 0:
            g.session.conn_list[conn_id].transfer_received_data(self.read_buffer[self.buffer_start:])

        g.session.conn_list[conn_id].start(block=True)

    def http_handler(self, first_char):
        req_line = self.read_crlf_line()
        words = req_line.split()
        if len(words) == 3:
            method, url, http_version = words
        elif len(words) == 2:
            method, url = words
            http_version = b"HTTP/1.1"
        else:
            xlog.warn("http req line fail:%s", req_line)
            return

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Benign in most cases; increase client connect timeout if frequent
  2. Ensure local firewall/AV isn't killing the socket
Defensive patterns

Strategy: try-catch

Try / catch

try:
    sock.send(b'HTTP/1.1 200 OK\r\n\r\n')
except OSError:
    pass  # client went away; tunnel cleaned up

Prevention

When it happens

Trigger: Client aborts the CONNECT between request and reply (timeout, cancel, tab close).

Common situations: Short client timeouts, cancelled navigations, flaky local connections.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/47b34821f8be41ae. Report an issue: GitHub.