{"record":{"id":"631ddeefa0e8e590","repo":"XX-net/XX-Net","slug":"chunk-ext-s","errorCode":null,"errorMessage":"chunk ext: %s","messagePattern":"chunk ext: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"code/default/gae_proxy/local/proxy_handler.py","lineNumber":317,"sourceCode":"\n        payload = b''\n        if b'Content-Length' in self.headers:\n            try:\n                payload_len = int(self.headers.get(b'Content-Length', 0))\n                #xlog.debug(\"payload_len:%d %s %s\", payload_len, self.command, self.path)\n                payload = self.rfile.read(payload_len)\n            except NetWorkIOError as e:\n                xlog.error('handle_method_urlfetch read payload failed:%s', e)\n                return\n        elif b'Transfer-Encoding' in self.headers:\n            # chunked, used by facebook android client\n            payload = \"\"\n            while True:\n                chunk_size_str = self.rfile.readline(65537)\n                chunk_size_list = chunk_size_str.split(b\";\")\n                chunk_size = int(b\"0x\"+chunk_size_list[0], 0)\n                if len(chunk_size_list) > 1 and chunk_size_list[1] != b\"\\r\\n\":\n                    xlog.warn(\"chunk ext: %s\", chunk_size_str)\n                if chunk_size == 0:\n                    while True:\n                        line = self.rfile.readline(65537)\n                        if line == b\"\\r\\n\":\n                            break\n                        else:\n                            xlog.warn(\"entity header:%s\", line)\n                    break\n                payload += self.rfile.read(chunk_size)\n                get_crlf(self.rfile)\n\n        self.req_payload = payload\n        return payload\n\n# called by smart_router\ndef wrap_ssl(sock, host, port, client_address):\n    certfile = CertUtil.get_cert(host or b'www.google.com')\n    ssl_sock = ssl.wrap_socket(sock, keyfile=CertUtil.cert_keyfile,","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/gae_proxy/local/proxy_handler.py#L299-L335","documentation":"While reading a chunked request body, read_payload found extension data after the chunk size (chunk_size_str contains a ';'). Chunk extensions are legal per RFC 7230 but this proxy doesn't process them, so it logs them as a warning and proceeds using only the size.","triggerScenarios":"A client sends chunk extensions such as '5;ext=val\\r\\nhello' — e.g. trailers hints, gzip-per-chunk markers, or library-generated metadata (some HTTP/2-to-1.1 converters, grpc-web clients). The split on b';' finds a second token that isn't the bare CRLF.","commonSituations":"Clients/libraries that append chunk extensions (e.g. '0;chrome' from some browsers, trailer declarations); traffic converted from HTTP/2; custom test harnesses. Purely informational — parsing continues with the correct size.","solutions":["No action needed if the request otherwise succeeds — the size is still parsed correctly","If a client misbehaves, disable chunk extensions in the sending library or use Content-Length","Upgrade the proxy version if a later one silently ignores or processes extensions","Inspect one raw request to confirm extensions (not corruption) are the cause"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"parts = chunk_size_str.split(b';')\nif len(parts) > 1 and parts[1] != b'\\r\\n':\n    xlog.warn('chunk ext: %s', chunk_size_str)  # known-benign; proceed with size","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable chunk extensions in client libraries when possible","Treat this warning as informational; parsing uses only the size field","Log one instance per connection rather than per chunk to reduce noise"],"tags":["http-proxy","chunked-encoding","chunk-extensions"],"backgroundTag":"malformed-chunked-encoding","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}