Parse Transfer-Encoding as a coding list instead of a substring
readHeader() decided chunked framing with
headerField("transfer-encoding").toLower().contains("chunked").
A substring match treats values like "xchunked", "chunked" inside a
parameter, or "chunked" not in final position as chunked, and never
rejects unknown codings so the parser can disagree with an
intermediary on how a message is framed (request smuggling when behind
a re-parsing or connection-pooling front-end).
Tokenize the header into transfer-codings, strip parameters and OWS,
and accept chunked framing only when "chunked" is the sole coding.
Any other coding is unsupported (501 Not Implemented). "chunked"
combined with or repeated among other codings is malformed
(400 Bad Request).
[ChangeLog][QHttpServerParser] Transfer-Encoding is now parsed as a
list of transfer-codings rather than matched as a substring. Requests
are rejected when the header contains a coding other than "chunked"
(including "identity") with 501 Not Implemented, or when "chunked" is
combined with another coding or appears more than once with 400 Bad
Request. Previously such requests were accepted.
Fixes: QTBUG-150514
Pick-to: 6.12 6.12.0 6.11 6.8
Change-Id: I02a0a93054b51d43fc6857e61d5f849bd60b5d12
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>