XX-net/XX-Net · info

chunk ext: %s

Error message

chunk ext: %s

What it means

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.

Source

Thrown at code/default/gae_proxy/local/proxy_handler.py:317

        payload = b''
        if b'Content-Length' in self.headers:
            try:
                payload_len = int(self.headers.get(b'Content-Length', 0))
                #xlog.debug("payload_len:%d %s %s", payload_len, self.command, self.path)
                payload = self.rfile.read(payload_len)
            except NetWorkIOError as e:
                xlog.error('handle_method_urlfetch read payload failed:%s', e)
                return
        elif b'Transfer-Encoding' in self.headers:
            # chunked, used by facebook android client
            payload = ""
            while True:
                chunk_size_str = self.rfile.readline(65537)
                chunk_size_list = chunk_size_str.split(b";")
                chunk_size = int(b"0x"+chunk_size_list[0], 0)
                if len(chunk_size_list) > 1 and chunk_size_list[1] != b"\r\n":
                    xlog.warn("chunk ext: %s", chunk_size_str)
                if chunk_size == 0:
                    while True:
                        line = self.rfile.readline(65537)
                        if line == b"\r\n":
                            break
                        else:
                            xlog.warn("entity header:%s", line)
                    break
                payload += self.rfile.read(chunk_size)
                get_crlf(self.rfile)

        self.req_payload = payload
        return payload

# called by smart_router
def wrap_ssl(sock, host, port, client_address):
    certfile = CertUtil.get_cert(host or b'www.google.com')
    ssl_sock = ssl.wrap_socket(sock, keyfile=CertUtil.cert_keyfile,

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. No action needed if the request otherwise succeeds — the size is still parsed correctly
  2. If a client misbehaves, disable chunk extensions in the sending library or use Content-Length
  3. Upgrade the proxy version if a later one silently ignores or processes extensions
  4. Inspect one raw request to confirm extensions (not corruption) are the cause
Defensive patterns

Strategy: validation

Validate before calling

parts = chunk_size_str.split(b';')
if len(parts) > 1 and parts[1] != b'\r\n':
    xlog.warn('chunk ext: %s', chunk_size_str)  # known-benign; proceed with size

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/631ddeefa0e8e590. Report an issue: GitHub.