[Twisted-web] return the full (absolute) request URI
manlio_perillo at libero.it
Tue Jan 15 09:44:02 EST 2008
Christopher Armstrong ha scritto:
> On Jan 15, 2008 9:24 AM, Manlio Perillo <manlio_perillo at libero.it> wrote:
>> I need to do a redirect to the same URI the client requested, however it
>> seems that Twisted Web has no support for this.
>> request.prePathURL() is an absolute URI, but is not good and request.uri
>> is not an absolute URI
>> (an absolute URI is required in the Location header
> Just to clarify:
> The URI that the client requested is only the path; they do not give a
> full absolute URI on the "GET" (or "POST", or whatever method) line.
Well, according to the HTTP protocol specification, a client *can* send
an absolute URI:
Request-URI = "*" | absoluteURI | abs_path | authority
> Therefore the "same URI the client requested" is really request.uri.
>> Do I need to write a fullPathURL function by myself?
> If you need an absolute URI, you'll have to construct it, perhaps
> using the "Host" header sent by the client, or perhaps using a
> pre-configured hostname setting in your application.
More information about the Twisted-web