netliomax25-code opened PR #13636 from netliomax25-code:wasi-http-content-length-digits to bytecodealliance:main:
get_content_lengthand the p3parse_header_valuereadContent-Lengthwithu64'sFromStr, which also accepts a leading+, so a value like+5is parsed as5.- RFC 9110 defines the field value as
1*DIGIT, so a value like that is accepted here while a strict parser (a proxy or the peer) would reject it. The parsed value drives the p2 and p3 request/response body framing, andparse_header_valueruns when a guest builds a field map.Reject any
content-lengthvalue that is not a non-empty run of ASCII decimal digits before parsing, at both sites. Added unit tests covering+5,-5, a leading space, and the empty value.
netliomax25-code requested pchickey for a review on PR #13636.
netliomax25-code requested wasmtime-wasi-reviewers for a review on PR #13636.
:thumbs_up: alexcrichton submitted PR review:
Thanks!
alexcrichton added PR #13636 validate content-length is decimal digits in wasi-http to the merge queue.
:check: alexcrichton merged PR #13636.
alexcrichton removed PR #13636 validate content-length is decimal digits in wasi-http from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC