cgi problem

Kent Johnson kent at kentsjohnson.com
Wed Mar 8 06:15:00 EST 2006


Paul Rubin wrote:
> I'm trying to write a simple cgi that reads a post from the user's
> browser, does some stuff with the form data, and redirects the browser
> back to the originating url, i.e. I want the cgi to send a 302
> redirect.
> 
> There's no obvious way in the cgi module to set the response code to
> anything but 200.  I.e. the run_cgi method automatically sends the 200
> response without giving any way to suppress it (like nph-whatever in
> Apache).  Is that a missing feature that I should add, or am I trying
> to do something dumb?

Set the Location: header to the new URL.
http://hoohoo.ncsa.uiuc.edu/cgi/out.html
http://www.algonet.se/~ug/html+pycgi/redirect.html

Kent



More information about the Python-list mailing list