sqlmapproject/sqlmap · error · H2ProtocolError

content-length does not match request body

Error message

content-length does not match request body

What it means

Error "content-length does not match request body" thrown in sqlmapproject/sqlmap.

Source

Thrown at lib/request/http2.py:745

        if name == b"host" or name == b"proxy-authorization":
            continue
        if name in _CONNECTION_FIELDS or name in connection_tokens:
            continue
        if name == b"te" and value.strip().lower() != b"trailers":
            raise H2ProtocolError("HTTP/2 permits TE only with value 'trailers'")
        if name == b"content-length":
            content_lengths.append(value.strip())
            if content_length_added:
                continue
            content_length_added = True
        normalized.append((name, value))

    if content_lengths:
        if len(set(content_lengths)) != 1 or not content_lengths[0].isdigit():
            raise H2ProtocolError("invalid or conflicting content-length fields")
        expected = len(body)
        if int(content_lengths[0]) != expected:
            raise H2ProtocolError("content-length does not match request body")
    return normalized


def _request_header_list(method, path, authority, headers, body):
    method = _as_bytes(method)
    authority = _as_bytes(authority)
    path = _as_bytes(path)
    _validate_method(method)
    if not authority:
        raise H2ProtocolError("authority is required")
    _validate_pseudo_value(":authority", authority)
    if method == b"CONNECT":
        request = [(b":method", method), (b":authority", authority)]
    else:
        if not path:
            raise H2ProtocolError("non-CONNECT requests require a non-empty :path")
        _validate_pseudo_value(":path", path)
        request = [(b":method", method), (b":scheme", b"https"), (b":path", path), (b":authority", authority)]

View on GitHub (pinned to 0a35b20e39)

When it happens

Trigger: Thrown at lib/request/http2.py:745 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/ec4df74070afa32a. Report an issue: GitHub.