diff options
author | Guido van Rossum <guido@python.org> | 2001-06-29 13:06:06 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-06-29 13:06:06 (GMT) |
commit | 52b8c29ca7172b4a6821e3e34b293562f3ae9a3f (patch) | |
tree | d776f5f6b8bae673094f310492fbb581ce9d986d /Lib/plat-aix3/IN.py | |
parent | be4f0a7748433fb051f6d67bf24c77a73add6a12 (diff) | |
download | cpython-52b8c29ca7172b4a6821e3e34b293562f3ae9a3f.zip cpython-52b8c29ca7172b4a6821e3e34b293562f3ae9a3f.tar.gz cpython-52b8c29ca7172b4a6821e3e34b293562f3ae9a3f.tar.bz2 |
Solve SF bug #231249: cgi.py opens too many (temporary) files.
class FieldStorage: this patch changes read_lines() and co. to use a
StringIO() instead of a real file. The write() calls are redirected
to a private method that replaces it with a real, external file only
when it gets too big (> 1000 bytes).
This avoids problems in forms using the multipart/form-data encoding
with many fields. The original code created a temporary file for
*every* field (not just for file upload fields), thereby sometimes
exceeding the open file limit of some systems.
Note that the simpler solution "use a real file only for file uploads"
can't be used because the form field parser has no way to tell which
fields correspond to file uploads.
It's *possible* but extremely unlikely that this would break someone's
code; they would have to be stepping way outside the documented
interface for FieldStorage and use f.file.fileno(), or depend on
overriding make_file() to return a file-like object with additional
known properties.
Diffstat (limited to 'Lib/plat-aix3/IN.py')
0 files changed, 0 insertions, 0 deletions