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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2005-11-27.17:47:58.000>labels= ['type-bug', 'library']
title='maximum length not enforced in cgi.parse()'updated_at=<Date2014-02-03.19:54:39.486>user='https://bugs.python.org/adr26'
I was expecting that cgi.pm would then throw an
exception if I send a file > 50 bytes long to it. If
I construct a FieldStorage object, it certainly
does:
form=cgi.FieldStorage()
printform
The issue is that in parse_multipart() in cgi.pm, if
a part of a multi-part message does not have the
Content-Length header, you read lines until you
get to the next boundary "--...", but don't honour
maxlen whilst doing so. I'd consider this to be a bug
and would even be happy to have a go at fixing
it as my first contribution to Python, should others
concur with me... :-)
Activity
adr26 commentedon Nov 27, 2005
I have a simple form in HTML to upload a file:
<form action="http://foo/cgi-bin/test.py"
enctype="multipart/form-data" method="post">
<p>
Please specify a file:<br>
<input type="file" name="file_1" size="40">
</p>
<p>
<input type="submit" value="Send">
</p>
</form>
I use this to post to a CGI python script that looks
like this:
print "Content-type: text/plain"
print
I was expecting that cgi.pm would then throw an
exception if I send a file > 50 bytes long to it. If
I construct a FieldStorage object, it certainly
does:
The issue is that in parse_multipart() in cgi.pm, if
a part of a multi-part message does not have the
Content-Length header, you read lines until you
get to the next boundary "--...", but don't honour
maxlen whilst doing so. I'd consider this to be a bug
and would even be happy to have a go at fixing
it as my first contribution to Python, should others
concur with me... :-)
BreamoreBoy commentedon Jul 10, 2010
Andrew could you please provide a patch.
BreamoreBoy commentedon Aug 30, 2010
No reply to msg109880.
hugovk commentedon Apr 11, 2022
Let's close this old issue, the cgi module is deprecated in 3.11 and set for removal in 3.13.
See PEP 594 – Removing dead batteries from the standard library, #91217 and #32410.
There's a fork at https://pypi.org/project/legacy-cgi/.
AlexWaygood commentedon Apr 12, 2022
Cc. @adr26