CGI File Size Limit?

Ed elb at cfdrc.com
Tue May 2 10:19:58 EDT 2000


Thanks, the advice you pointed to looked relevant, so I gave
"#!/Software/Python/python -u" a try.  Unfortunately, that caused the
following crash in rfc822.py.....but I'll keep trying.

Premature end of script headers:
d:/users/elb/cfd-expert-dev/database/database.py
 Traceback (innermost last):
 File "d:/users/elb/cfd-expert-dev/database/database.py", line 223, in ?
form = cgi.FieldStorage()
File "C:\Software\Python\Lib\cgi.py", line 869, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "C:\Software\Python\Lib\cgi.py", line 954, in read_multi
  headers = rfc822.Message(self.fp)
File "C:\Software\Python\Lib\rfc822.py", line 92, in __init__
 self.readheaders()
File "C:\Software\Python\Lib\rfc822.py", line 135, in readheaders
 startofline = tell()
IOError: (0, 'Error')



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