David Binger wrote:
> On Aug 10, 2005, at 7:20 PM, mso@oz.net wrote:
>
>> Actually it would have to be like this:
>>
>> # In publish.Publisher.try_publish()
>> path = request.get_environ('PATH_INFO', '')
>> if not path:
>> return redirect(request.get_environ('SCRIPT_NAME')+'/',
>> True)
>>
>> Tested on Apache 2.0.52, scgi 1.4, Quixote 2.1.
>
>
> I think the case in question puts the entire path in the SCRIPT_NAME
> on every request. Under those conditions, the strategy you suggest
> can't work since the PATH_INFO would still be empty after a redirect.
>
> Does your test push requests through this redirect?
I don't understand the question. I go to /rl, it redirects to /rl/,
which in my app redirects to /rl/login because the user isn't logged
in. If I type /rl/, it redirects to /rl/login, and the page shows
properly, with stylesheet and logo which are StaticFile's.
> Is mod_scgi's behavior different from what I am assuming?
>
From mod_scgi.c (SCGI 1.5):
if (r->path_info) {
int path_info_start = find_path_info(r->uri, r->path_info);
add_header(t, "SCRIPT_NAME", apr_pstrndup(r->pool, r->uri,
path_info_start));
add_header(t, "PATH_INFO", r->path_info);
}
else {
/* skip PATH_INFO, don't know it */
add_header(t, "SCRIPT_NAME", r->uri);
}
So it tries to handle either case.
From quixote.scgi_server.QuixoteHandler.handle_connection():
if self.script_name is not None:
# mod_scgi doesn't know SCRIPT_NAME :-(
prefix = self.script_name
path = env['SCRIPT_NAME']
assert path[:len(prefix)] == prefix, (
"path %r doesn't start with script_name %r" % (path,
prefix))
env['SCRIPT_NAME'] = prefix
env['PATH_INFO'] = path[len(prefix):] + env.get('PATH_INFO', '')
This looks like it tries to find either case too. I didn't look at what
SCRIPT_NAME and PATH_INFO were before this mangling.
Either there's one problem or two. The
missing-trailing-slash-for-home-page problem is happening in any case.
That's what the original poster mentioned I thought, and it also happens
to me. If PATH_INFO is always blank and .handle_connection() doesn't
fix it, Quixote wouldn't work at all. That would be a separate
problem. I think mod_scgi doesn't set PATH_INFO, but I haven't checked
it specifically. I can check it tomorrow if necessary.
-- Mike Orr