{"record":{"id":"5508a2835678462a","repo":"XX-net/XX-Net","slug":"socks-version-s-not-supported","errorCode":null,"errorMessage":"socks version:%s not supported","messagePattern":"socks version:(.+?) not supported","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/x_tunnel/local/proxy_handler.py","lineNumber":61,"sourceCode":"\n    def handle(self):\n        self.__class__.handle_num += 1\n        try:\n            socks_version = self.read_bytes(1)\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(socks_version)\n                return\n            else:\n                xlog.warn(\"socks version:%s not supported\",  utils.str2hex(socks_version))\n                return\n\n        except socket.error as e:\n            xlog.warn('proxy handler read error %r', e)\n            self.connection.close()\n        except Exception as e:\n            xlog.exception(\"proxy handler err:%r\", e)\n            self.connection.close()\n\n    def read_null_end_line(self):\n        sock = self.connection\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":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/x_tunnel/local/proxy_handler.py#L43-L79","documentation":"The SOCKS/HTTP multiplexed listener read a first byte that is neither a SOCKS5 greeting (\\x05), SOCKS4 code, 'C' (CONNECT) nor a plain HTTP method letter, so the connection is dropped with this warning.","triggerScenarios":"Connecting a non-SOCKS/non-HTTP client to the local x-tunnel proxy port, or sending garbage/binary before a valid greeting.","commonSituations":"Wrong port used (e.g. pointing an SMTP or arbitrary TCP client at the proxy), or a health-checker probing the port.","solutions":["Point your client at the correct local proxy port with SOCKS5 or HTTP mode","If health checks cause it, exclude the proxy port from probing","Ignore — the handler closes the socket safely"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"first = sock.recv(1)\nif first not in (b'\\x05', b'\\x04', b'C', b'G', b'P', b'D', b'O', b'H', b'T'):\n    sock.close()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only point SOCKS5/HTTP clients at the proxy port"],"tags":["x-tunnel","socks","protocol"],"backgroundTag":"unsupported-protocol-version","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}