{"record":{"id":"e987c6023f1d242e","repo":"XX-net/XX-Net","slug":"socks-version-s-s-not-supported","errorCode":null,"errorMessage":"socks version:%s[%s] not supported","messagePattern":"socks version:(.+?)\\[(.+?)\\] not supported","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/smart_router/local/proxy_handler.py","lineNumber":81,"sourceCode":"        if not self.try_redirect():\n            self.handle_request()\n\n    def handle_request(self):\n        try:\n            socks_version = self.conn.recv(1, socket.MSG_PEEK)\n            if not socks_version:\n                return\n\n            if socks_version == b\"\\x04\":\n                self.socks4_handler()\n            elif socks_version == b\"\\x05\":\n                self.socks5_handler()\n            elif socks_version == b\"C\":\n                self.https_handler()\n            elif socks_version in [b\"G\", b\"P\", b\"D\", b\"O\", b\"H\", b\"T\"]:\n                self.http_handler()\n            else:\n                xlog.warn(\"socks version:%s[%s] not supported\", socks_version, utils.str2hex(socks_version))\n                return\n\n        except socket.error as e:\n            xlog.warn('socks handler read error:%r', e)\n            self.conn.close()\n        except Exception as e:\n            xlog.exception(\"any err:%r\", e)\n            self.conn.close()\n\n    def read_null_end_line(self):\n        sock = self.conn\n        sock.setblocking(0)\n        try:\n            while True:\n                n1 = self.read_buffer.find(b\"\\x00\", self.buffer_start)\n                if n1 > -1:\n                    line = self.read_buffer[self.buffer_start:n1]\n                    self.buffer_start = n1 + 1","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/smart_router/local/proxy_handler.py#L63-L99","documentation":"The first byte read from an incoming connection did not match any known protocol signature: 0x05 (SOCKS5), 0x04 (SOCKS4), 'C' (CONNECT/HTTPS), or HTTP method initials (G/P/D/O/H/T). The handler drops the request.","triggerScenarios":"Pointing a non-proxy client at the local proxy port, sending garbage/bytes before a protocol handshake, or an ASCII protocol whose first byte is not in the recognized set.","commonSituations":"Sending plain HTTP to a SOCKS-only port configuration mismatch, port scanners, health probes, or misconfigured browser proxy settings.","solutions":["Check what the client actually sends (the hex dump in the message) and fix the client protocol/port","Ensure the client uses SOCKS5/SOCKS4/HTTP CONNECT as supported by this proxy","Filter health-check/scanner traffic hitting the proxy port","Do not point raw TCP apps at the proxy listener"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert first_byte in (b'\\x05', b'\\x04', b'C', b'G', b'P', b'D', b'O', b'H', b'T') before dispatching","typeGuard":"def is_supported_protocol(b): return b in {b'\\x05', b'\\x04'} or chr(b[0]) in 'CGPDOHT'","tryCatchPattern":null,"preventionTips":["Point protocol-correct clients at the proxy port","Document supported protocols per port"],"tags":["protocol","socks","http-proxy","handshake"],"backgroundTag":"unsupported-protocol-version","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}