• Guido van Rossum's avatar
    Solve SF bug #231249: cgi.py opens too many (temporary) files. · 52b8c29c
    Guido van Rossum yazdı
    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.
    52b8c29c
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
acconfig.h Loading commit data...
config.h.in Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
setup.py Loading commit data...