[Twisted-web] Redirecting

Syver Enstad syver at inout.no
Tue Jul 13 07:00:34 MDT 2004

After reading up on the HTTP spec I found that one had to present a
complete URL for the location header, although the browsers I use to
test with (IE and Firefox) seems to accept just the path without
protocol and hostname, there are tools (httpsession) that I am
thinking of using for automated testing that doesn't.

I thought of using request.prePathURL() but this seems to loose the
session cookie if the hostname of the initial client request is
something else than what prePathURL() returns. Example: an request for
http://localhost/something/ will make request.prePathURL() answer
http://myhostname/something/ and following the redirect loses the

Is it generally accepted these days to not include hostname and
protocol in location headers, if not how do I get the hostname from
the request?

More information about the Twisted-web mailing list