XX-net/XX-Net · warning
http req line fail:%s
Error message
http req line fail:%s
What it means
The plain-HTTP request line did not contain 2 or 3 whitespace-separated tokens, so method/url extraction failed and the request is dropped.
Source
Thrown at code/default/smart_router/local/proxy_handler.py:344
# 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):
req_data = self.conn.recv(65537, socket.MSG_PEEK)
rp = req_data.split(b"\r\n")
req_line = rp[0]
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
if url.lower().startswith(b"http://"):
o = urlparse(url)
host, port = netloc_to_host_port(o.netloc)
url_prex_len = url[7:].find(b"/")
if url_prex_len >= 0:
url_prex_len += 7
path = url[url_prex_len:]
else:
url_prex_len = len(url)
path = b"/"
else:
# not proxy request
parsed_url = urlparse(utils.to_str(url))
kv = parse_qs(parsed_url.query)
if parsed_url.path == "/dns-query":View on GitHub (pinned to cfa5bc17b6)
Solutions
- Inspect the logged req_line to see the raw bytes the client sent
- Verify the client actually speaks HTTP on this port (not TLS bytes)
- Fix client request formatting / add proper CRLF line endings
Defensive patterns
Strategy: validation
Validate before calling
tokens = req_line.split(); assert 2 <= len(tokens) <= 3
Type guard
def is_http_request_line(l):
t = l.split()
return len(t) in (2,3) and t[0].isalpha() Prevention
- Never send TLS bytes to a plain HTTP port
- Use real HTTP client libraries
When it happens
Trigger: Malformed first line such as 'GET' with no path, binary garbage, or a request missing HTTP version delimiters.
Common situations: Health probes or scanners sending non-HTTP bytes, broken clients, encoding corruption, or an HTTPS handshake reaching the HTTP handler.
Related errors
- https req line fail:%s
- 600
- login_session %s json error:%r
- roundtrip time:%f transfer_no:%d send:%d recv:%d unpack_erro
- api:%s fail:%s t:%d
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/a6d045b50d52fcac.
Report an issue: GitHub.