durusmail: quixote-users: Fix Trailing Slash bug?
Fix Trailing Slash bug?
2002-06-19
2002-06-19
2002-06-19
Fix Trailing Slash bug?
Greg Ward
2002-06-19
On 19 June 2002, Patrick K. O'Brien said:
> The fix trailing slash feature results in a redirect to an ugly URL.
>
> For example, I've got Apache directing http://www.orbtech.com/web/ to my
> Quixote cgi program. If I let Quixote fix a trailing slash, such as
> http://www.orbtech.com/web/pobrien, I get redirected to
> http://www.orbtech.com/cgi-bin/web.py/pobrien/ instead of
> http://www.orbtech.com/web/pobrien/.

Hmmm.  The code in question is in Publisher.traverse_url():

    if path[-1] != '/':
        if not request.form and self.config.fix_trailing_slash:
            # This is for the convenience of users who type in paths.
            # Repair the path and redirect.  This should not happen for
            # URLs within the site.
            request.redirect(request.get_path() + "/", permanent=1)
            return

(traverse_url() also checks fix_trailing_slash at the start, but that's
for the root URL only -- eg. "/web" -> "/web/" in your case.)

Anyways, to debug this: I would add
  print "request.get_path() =", request.get_path()

right before the redirect() call.  Then start adding print statements to
HTTPRequest.get_path() to see what it's doing.

Note that Quixote depends on the setting of SCRIPT_NAME supplied by the
web server.  With our Apache setup, that would be "/web" -- apparently
with yours, its "/cgi-bin/web.py".  Perhaps your Apache config is wrong
-- which Apache version are you using?  Can you post the config that
does rewrites /web to /cgi-bin/web.py?

        Greg



reply