durusmail: qp: Publisher.complete_url(), and running behind a script
Publisher.complete_url(), and running behind a script
2007-01-24
2007-01-24
2007-01-25
Publisher.complete_url(), and running behind a script
mario ruggier
2007-01-25
On Jan 24, 2007, at 3:27 PM, David Binger wrote:
> On Jan 24, 2007, at 7:18 AM, mario ruggier wrote:
>
>> Hi,
>>
>> stumbled onto this issue on a site running behind a cgi script
>> instead of mod_scgi.
>>
>> Given my url path is something like "/app.cgi/component",
>> then doing publisher.redirect("/app.cgi/component")
>> will send to the location "/app.cgi/app.cgi/component".
>
> I think that is the correct behavior.  The redirect should
> be to /component if you want the redirect response's location
> header to be /app.cgi/component.  This allows the application
> to operate without changes, even if the SCRIPT_NAME changes.

OK. that kind of makes sense.

I find it can be annoying though to keep track of the conceptual
distinction between "internal" (app-root-abs) url paths and "external"
(domain-root-abs) url paths. It is another thing I would rather not
have to think about. Request get_path() and get_path_query() return the
"external" path. I guess to get the "internal" path i'd need
get_path_info() and, if it existed, get_path_info_query(). That of
itself is no big deal, but need to think of it...

> Within the application, you should use redirect as if the
> application were running at the root of the url space.

I think in all cases I came across, I know whether the abs url path I
am dealing with has had the script_name prepended to it or not, so I
know how to redirect to it correctly. But I am not sure if this will
stay true should a url path get passed around a few times before it is
redirected to... it would be nice to have some sort of
external/internal escaped/unescaped indication...

> If you need urls for generated javascript or css, you should
> call complete_url() or build the path directly using
> get_script_name().

I build calling get_script_name(), because base url/filesystem
locations of those files
is a config param.

> This has always been a confusing issue, here and in
> Quixote history.

It happens rarely enough that it is guaranteed to always be confusing ;)

mario

reply