Upload text file?

jepler at unpythonic.net jepler at unpythonic.net
Wed Aug 14 01:10:28 CEST 2002


When a CGI gets a POSTed request, the "message-body" appears on standard
input:

  6.2. Request Message-Bodies                                                                                                                                          
                                                                                                                                                                       
   As there may be a data entity attached to the request, there MUST be a
   system defined method for the script to read these data. Unless defined
   otherwise, this will be via the 'standard input' file descriptor.

   If the CONTENT_LENGTH value (see section 6.1.2) is non-NULL, the server
   MUST supply at least that many bytes to scripts on the standard input
   stream. Scripts are not obliged to read the data. Servers MAY signal
   an EOF condition after CONTENT_LENGTH bytes have been read, but are
   not obligated to do so. Therefore, scripts MUST NOT attempt to read
   more than CONTENT_LENGTH bytes, even if more data are available.

   For non-parsed header (NPH) scripts (see section 7.1 below), servers
   SHOULD attempt to ensure that the data supplied to the script are
   precisely as supplied by the client and unaltered by the server.

http://cgi-spec.golux.com/draft-coar-cgi-v11-03-clean.html

If you use the python 'cgi' module, this input will be read and processed
"in the normal way", which is apparently not what you're looking for.  So,
don't use it!

Jeff




More information about the Python-list mailing list