CGI File Size Limit?

Ed elb at cfdrc.com
Tue May 2 10:33:49 EDT 2000


I wrote a simple test program to verify that, on the command line, I do
indeed need the -u flag to read binary data from stdin.  Funny,
though....now the server barfs on TEXT files, too, using
"#!/Software/Python/python.exe -u".  Before, without the -u, it processed
both text and binary files...it just didn't read the binary data correctly.
Now it doesn't upload even text files....(gives the error I showed in the
previous post).

Lyle Johnson wrote:

> Ed,
>
> Don't know if this is the answer or not, but doing a search for "cgi" on
> the Python FAQ (http://www.python.org/search/search_faq.html) yielded
> this hit:
>
> 7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or
> win95!
>
> Be sure you have the latest python.exe, that you are using python.exe
> rather than a GUI version of python and that you have configured the
> server to execute
>
>      "...\python.exe -u ..."
>
> for the cgi execution. The -u (unbuffered) option on NT and win95
> prevents the interpreter from altering newlines in the standard input
> and output. Without it post/multipart requests will seem to have the
> wrong length and binary (eg, GIF) responses may get garbled (resulting
> in, eg, a "broken image").
>
> Hope this helps,
>
> Lyle
>
> Ed wrote:
> >
> > More information:
> > If I test the len(form["userfile"].value), it is only 3134 instead of
> > 18k (the "CONTENT_LENGTH").  That means the CGI.py module is not
> > getting the data.  Something wrong with CGI module reading binary data
> > off of the standard input stream.
> >
> > Have I confirmed that it is a problem with the cgi.py module?
> >
> > Ed wrote:
> >
> > >  I'm having trouble uploading an 18K file via CGI and saving it to a
> > > file from my Python script.  The file gets saved, but the file size
> > > is only 1k.  I'm assuming that the cgi module is only reading the
> > > first 1k bytes.  I'd like to know if this sounds reasonable and how
> > > to solve the problem....and if not reasonable, where else I might
> > > look for the problem. Thanks....




More information about the Python-list mailing list