XX-net/XX-Net · warning

https req line fail:%s

Error message

https req line fail:%s

What it means

The CONNECT request line in https_handler could not be parsed into 2 or 3 whitespace-separated tokens. The handler aborts the tunnel setup.

Source

Thrown at code/default/smart_router/local/proxy_handler.py:314

        reply = b"\x05\x00\x00" + addrtype_pack + addr_pack + struct.pack(">H", port)
        sock.send(reply)

        if addrtype in [1, 4]:
            handle_ip_proxy(sock, addr, port, self.client_address)
        else:
            handle_domain_proxy(sock, addr, port, self.client_address)

    def https_handler(self):
        line = self.read_crlf_line()
        line = line
        words = line.split()
        if len(words) == 3:
            command, path, version = words
        elif len(words) == 2:
            command, path = words
            version = b"HTTP/1.1"
        else:
            xlog.warn("https req line fail:%s", line)
            return

        if command != b"CONNECT":
            xlog.warn("https req line fail:%s", line)
            return

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

        header_block = self.read_headers()
        sock = self.conn

        # xlog.debug("https %r connect to %s:%d", self.client_address, host, port)
        sock.send(b'HTTP/1.1 200 OK\r\n\r\n')

        handle_domain_proxy(sock, host, port, self.client_address)

    def http_handler(self):

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Log the offending line and fix the client to send a proper CONNECT request
  2. Ensure the connection is routed to http_handler for non-CONNECT methods
  3. Check for leading garbage/newline corruption before the request line
Defensive patterns

Strategy: validation

Validate before calling

parts = line.split(); assert 2 <= len(parts) <= 3 and parts[0] == b'CONNECT'

Type guard

def is_connect_line(line):
    w = line.split()
    return len(w) in (2,3) and w[0] == b'CONNECT'

Prevention

When it happens

Trigger: First line of the request is malformed (not 'CONNECT host:port HTTP/x.y'), e.g. wrong method spelling or missing target.

Common situations: A client sending a plain GET to the HTTPS-tunnel path, manual telnet/netcat testing with typos, or a protocol detector misrouting the connection.

Related errors


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