simple cgi program

Aahz aahz at pythoncraft.com
Sun Jan 24 13:14:29 EST 2010


In article <4b531bf9$0$1140$4fafbaef at reader1.news.tin.it>,
superpollo  <utente at esempio.net> wrote:
>
>i would like to submit the following code for review. it is a simple 
>common gateway interface program, which uses the least possible 
>libraries for the sake of mechanism undertanding.

You should probably factor this into two or three functions.  I would
not rename urllib here -- it's too common to want to use "url" for an
actual URL.

You should not use readline() -- just use read().  Which then obviates
the need for the test (there's no real need for using CONTENT_LENGTH for
this purpose IIRC).

The value for "me" is wrong unless your cgi is installed as a top-level
script.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

import antigravity



More information about the Python-list mailing list