You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5398a0b
Browse filesBrowse the repository at this point in the historyBrowse files
* gh-150751: validate http.client Content-Length and chunk-size (GH-150752)
RFC 9112 defines Content-Length as 1*DIGIT and chunk-size as 1*HEXDIG, but int() also accepts a sign, underscores, surrounding whitespace and an 0x prefix, so malformed framing values were parsed instead of rejected.
(cherry picked from commit 2eb2af8)
Co-authored-by: metsw24-max <metsw24@gmail.com>
* gh-150751: Ignore optional whitespace around Content-Length in http.client (GH-159156)
gh-150752 started validating the Content-Length value against the
RFC 9112 grammar (1*DIGIT), but the compat32 header parser keeps
trailing SP/HTAB in the field value, so "Content-Length: 5 " is now
treated as a missing header. HTTPResponse then assumes that the
connection will close and read() blocks until the server closes it,
which never happens on a keep-alive connection.
RFC 9112, section 5.1 says that optional whitespace around a field
value is excluded by parsers. Strip SP/HTAB before the grammar check;
values such as "+5", "5_0" and "5 0" are still rejected.
---------
Co-authored-by: metsw24-max <metsw24@gmail.com>
Co-authored-by: blago1 <74470460+danilablagorodniy37@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
0 commit comments