Location HTTP Header

ptn tn.pablo at gmail.com
Thu Dec 18 18:07:03 CET 2008


On Dec 17, 6:47 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Wed, 17 Dec 2008 20:52:42 -0200, ptn <tn.pa... at gmail.com> escribió:
>
> > I tried this stupid script on my server:
>
> >    #! /usr/bin/env python
>
> >    print 'Location:http://www.google.com\n'
>
> > and it didn't work, I get a blank page.  I first tried the Location
> > header in another script, and when execution got to that point, it
> > would
> > just sort of ignore it, because the script would keep running to the
> > end
> > of the code (or stop at some unhandled exception).
>
> I assume this is a cgi script. For the Location field to be relevant, the  
> Status should be a 3xx (like 307 Temporary Redirect, or 302 Found)
> In your case, your server probably has already sent a 200 OK response, so  
> Location is ignored.
> Try adding a Status line -before Location above- like:
> print 'Status: 302 Found"
>
> > Any ideas?
>
> I'd use a different protocol other than CGI...
>
> --
> Gabriel Genellina

Mmmmm no, that didn't do it.  The script now is:

    #! /usr/bin/env python

    print 'Status: 302 Found'
    print 'Location: http://www.google.com\n'

but still nothing happens, I get the same blank page.
Since the sscript is so simple, maybe it is a matter of server
configuration?  Is that possible?



More information about the Python-list mailing list