{"record":{"id":"23eaaf3a8fdcfdb6","repo":"XX-net/XX-Net","slug":"http-req-line-fail-s-23eaaf","errorCode":null,"errorMessage":"http req line fail:%s","messagePattern":"http req line fail:(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/x_tunnel/local/proxy_handler.py","lineNumber":341,"sourceCode":"            sock.send(b'HTTP/1.1 200 OK\\r\\n\\r\\n')\n        except:\n            xlog.warn(\"https %r connect to %s:%d conn:%d closed.\", self.client_address, host, port, conn_id)\n\n        if (len(self.read_buffer) - self.buffer_start) > 0:\n            g.session.conn_list[conn_id].transfer_received_data(self.read_buffer[self.buffer_start:])\n\n        g.session.conn_list[conn_id].start(block=True)\n\n    def http_handler(self, first_char):\n        req_line = self.read_crlf_line()\n        words = req_line.split()\n        if len(words) == 3:\n            method, url, http_version = words\n        elif len(words) == 2:\n            method, url = words\n            http_version = b\"HTTP/1.1\"\n        else:\n            xlog.warn(\"http req line fail:%s\", req_line)\n            return\n\n        method = first_char + method\n        # if method not in [\"GET\", \"HEAD\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\", \"TRACE\", \"PATCH\"]:\n        #    xlog.warn(\"https req method not known:%s\", method)\n\n        if url.startswith(b\"http://\") or url.startswith(b\"HTTP://\"):\n            o = urlparse(url)\n            host, port = netloc_to_host_port(o.netloc)\n\n            p = url[7:].find(b\"/\")\n            if p >= 0:\n                path = url[7+p:]\n            else:\n                path = b\"/\"\n        else:\n            header_block = self.read_headers()\n            lines = header_block.split(b\"\\r\\n\")","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/x_tunnel/local/proxy_handler.py#L323-L359","documentation":"The plain-HTTP request line could not be split into 2 or 3 words (method [url [version]]), so the HTTP handler drops the request.","triggerScenarios":"Sending a malformed request line to the local proxy in HTTP mode: empty line, too many/few tokens, or binary garbage.","commonSituations":"Health checks or scanners writing raw bytes; clients speaking non-HTTP protocols on the proxy port.","solutions":["Use a real HTTP client pointed at the local proxy","Verify the port is the HTTP/SOCKS proxy port and not something else","Ignore scanner noise"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"words = req_line.split()\nif not 2 <= len(words) <= 3: skip_request()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use well-formed HTTP clients","Keep health-check probes off the proxy port"],"tags":["x-tunnel","http-proxy","malformed-request"],"backgroundTag":"malformed-http-request","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}