]> git.ipfire.org Git - thirdparty/tornado.git/commit
httputil: Improve handling of trailing whitespace in headers 3477/head
authorBen Darnell <ben@bendarnell.com>
Wed, 19 Feb 2025 19:06:22 +0000 (14:06 -0500)
committerBen Darnell <ben@bendarnell.com>
Wed, 2 Apr 2025 17:07:43 +0000 (13:07 -0400)
commit002f3a174bd8817c9b63c06d89c8c16ea5f94205
tree15ee35e0cdd86fd79170e4f74724a58791352f07
parent0b7e700c1fe90f387602ad3305598b23833c30f9
httputil: Improve handling of trailing whitespace in headers

HTTPHeaders had undocumented assumptions about trailing whitespace,
leading to an unintentional regression in Tornado 6.4.1 in which
passing the arguments of an AsyncHTTPClient header_callback to
HTTPHeaders.parse_line would result in errors.

This commit moves newline parsing from parse to parse_line.
It also strips trailing whitespace from continuation lines (trailing
whitespace is not allowed in HTTP headers, but we didn't reject it
in continuation lines).

This commit also deprecates continuation lines and the legacy
handling of LF without CR.

Fixes #3321
tornado/httputil.py
tornado/test/httpclient_test.py