sqlmapproject/sqlmap · error · H2ProtocolError
HTTP/2 field values may not have leading/trailing whitespace
Error message
HTTP/2 field values may not have leading/trailing whitespace
What it means
_validate_field_value whitespace guard: the header value has leading or trailing SP/HTAB, which HTTP/2 (RFC 7540/9113) prohibits because field values are transmitted without such padding; the value is rejected before framing.
Solutions
- Strip leading/trailing whitespace from header values
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/request/http2.py:687 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/0236e5c2da2d5849.
Report an issue: GitHub.
Appendix: source
Thrown at lib/request/http2.py:687
return []
if hasattr(headers, "items"):
return list(headers.items())
return list(headers)
def _validate_regular_name(name):
if not name or name.startswith(b":"):
raise H2ProtocolError("invalid regular field name")
for item in bytearray(name):
if item not in _TOKEN_BYTES:
raise H2ProtocolError("invalid HTTP field name %r" % name)
def _validate_field_value(value):
if b"\x00" in value or b"\r" in value or b"\n" in value:
raise H2ProtocolError("invalid control character in HTTP field value")
if value[:1] in (b" ", b"\t") or value[-1:] in (b" ", b"\t"):
raise H2ProtocolError("HTTP/2 field values may not have leading/trailing whitespace")
def _validate_pseudo_value(name, value):
_validate_field_value(value)
for item in bytearray(value):
if item < 0x21 or item > 0x7e:
raise H2ProtocolError("invalid octet in %s pseudo-field" % name)
def _validate_method(method):
if not method:
raise H2ProtocolError("method is required")
for item in bytearray(method):
if item not in _METHOD_TOKEN_BYTES:
raise H2ProtocolError("invalid HTTP method token")
def _normalize_request_headers(headers, body):View on GitHub (pinned to 0a35b20e39)