Python, cgi and redirect

Fredrik Lundh fredrik at pythonware.com
Wed May 10 11:36:17 CEST 2000


Teemu Keskinarkaus <teemu.keskinarkaus at ramk.fi> wrote:
> Is there simple cgi module for python that can do redirect?? Now I'm
> doing redirect in cgi-script like this:
> 
> print "Status: 302 Moved"
> print "Location: http://url.to.somewhere"
> 
> That works fine except I get 'Premature end of script headers' errors
> in apache error_log everytime I use that script.

here's what the apache FAQ has to say about this message:

    http://www.apache.org/docs/misc/FAQ.html#premature-script-headers

    "What does it mean when my CGIs fail with "Premature
    end of script headers"? 

    "It means just what it says: the server was expecting a complete
    set of HTTP headers (one or more followed by a blank line), and
    didn't get them."

so adding an extra print statement might help.  if it doesn't,
ignore me ;-)

</F>





More information about the Python-list mailing list