Question : How do I forward a http request?

Hi,
How do I forward a http request?
What http headers do I need to set?

This is what I have so far, but it's not working

            self.response.headers['Content-Type'] = 'text/html'
            self.response.headers['Status'] = '302 Moved Temporarily'
            self.response.headers['Location'] = url
            self.response.headers['Content-Type'] = 'text/html'
            self.response.headers['Pragma'] = 'text/html'
            self.response.headers['Content-Type'] = 'no-cache'
            self.response.out.write( 'Moved</html>')

Thanks
Jamie

Answer : How do I forward a http request?

You try some thing like this:

def print_redirect(url):
        print 'Status: 302 Moved Temporarily'
        print 'Location:', url
        print 'Pragma: no-cache'
        print 'Content-Type: text/html'
        print
        print ''
        print 'Redirect (302)'
        print '

302 Moved Temporarily

'
        print '

The answer to your request is located at'
        hurl = cgi.escape(url, 1)
        print '%s.' % (hurl, hurl)

note that the url must be absolute.

http://mail.python.org/pipermail/python-list/2001-March/075917.html

Random Solutions  
 
programming4us programming4us