Reject conflicting duplicate Content-Length header fields


QHttpHeaderParser preserves every header field it parses, and
contentLength() reads only the first Content-Length via
firstHeaderField(). So a request with two differing Content-Length
fields (Content-Length: 5 and Content-Length: 6) was accepted first-
wins, which is an invalid framing an intermediary may resolve
differently (a request-smuggling vector behind a re-parsing or
connection-pooling front-end).

Repeated fields are equivalent to a single comma-separated value
(RFC 9110 5.2-5.3). When those values differ the combined
Content-Length is invalid and RFC 9112 6.3.5 requires a 400
(Bad Request). Reject that case, identical duplicates remain
valid and collapse to the single value.

Fixes: QTBUG-150549
Pick-to: 6.12 6.12.0 6.11 6.8
Change-Id: Ieab7b8cb9d18b7b378dfe5336a65413fe50e4b24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
commit55565ed79a0546b030f63996622216d94f1d4af9
parent3a31addce93845fe2bad9bd49edeff0699c208ea
authorMate Barany <mate.barany@qt.io>
committerMate Barany <mate.barany@qt.io>
commit timeThu, 24 Sep 2026 07:36:36 +0000