bpo-27777: fix cgi.FieldStorage parsing for body with Content-Length and no Content-Disposition#21457
bpo-27777: fix cgi.FieldStorage parsing for body with Content-Length and no Content-Disposition#21457ar45 wants to merge 4 commits into
Conversation
…ent-Length and no Content-Disposition - If content length is present, read at most len bytes. - When reading `read_lines_to_eof` use `read` instead of `readline`. - Use `self.__write` even when content length is present and > 1000.
Renamed `test_fieldstorage_readline` to `test_fieldstorage_read` and test `read` instead of `readline` since we use `read`.
Added mention of FieldStorage
|
Another PR is open: #10771 Long discussion in the bug report. |
See comment on that PR for why I opted to do it differently |
By Aron Podrigal; backported from python/cpython#21457.
|
@ethanfurman Do you mind reviewing this? |
|
We did some internal testing with this patch and found a bug with the following trace: This happens when
Then, in the You can reproduce this simply by sending much bigger body in added |
|
@ar45, thanks for the PR. Unfortunately, the I hope that this does not dissuade you from contributing to CPython in the future 🙂 |
cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition
read_lines_to_eofusereadinstead ofreadline.self.__writeeven when content length is present and > 1000.https://bugs.python.org/issue27777