-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
bpo-27777: fix cgi.FieldStorage parsing for body with Content-Length and no Content-Disposition #21457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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