Ticket #502 (closed defect: fixed)

Opened 20 months ago

Last modified 14 months ago

[Patch] AgaviWebRouting.class.php double slash fix for Apache 2.2

Reported by: ross Owned by: david
Priority: normal Milestone: 0.11
Component: routing Version: 0.11.0RC4
Severity: normal Keywords:
Cc: Patch attached:

Description (last modified by ross) (diff)

Currently with mod_rewrite turned on if I goto: http://mysite.com/search/content//1

$_SERVER['QUERY_STRING'] converts it to: http://mysite.com/search/content/1

Which has a number of issues, it messes up routing and my baseHref!

$_SERVER['REQUEST_URI'] however does contain the original url: http://mysite.com/search/content//1

Solution: If the URL is rewritten - use the REQUEST_URI as the basis for the $qs. Automatically converting the first ? if any to & as done automatically in the Query_String.

Attachments

AgaviWebRouting.patch (0.6 KB) - added by ross 20 months ago.
Pacth for AgaviWebRouting?

Change History

Changed 20 months ago by ross

Pacth for AgaviWebRouting?

Changed 20 months ago by ross

  • description modified (diff)

Changed 20 months ago by ross

  • description modified (diff)

Changed 20 months ago by david

  • owner changed from dominik to david
  • description modified (diff)
  • summary changed from [Patch] AgaviWebRouting.class.php to [Patch] AgaviWebRouting.class.php double slash fix for Apache 2.2

That's not really gonna help as far as I can tell, the query string and the request uri aren't the same thing!?

Changed 20 months ago by ross

  • description modified (diff)

Changed 20 months ago by ross

Ok - will add some mod_rewrite logging / tests next week - as it seems to stem from there!

I'll report any findings here

Changed 20 months ago by david

Doesn't seem to be related to rewrites by the way - rather a PATH_INFO problem, as it happens with index.php/foo//bar as well.

Changed 20 months ago by ross

Hmm - works fine for me when using index.php directly.

Added logging to mod_rewrite - it *is* automatically removing the double // - see below:

URL: http://mysite.com/search/content//19

10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] add path info postfix: /home/ross/www/mysite/pub/search -> /home/ross/www/mysite/pub/search/content/19
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] strip per-dir prefix: /home/ross/www/mysite/pub/search/content/19 -> search/content/19
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] applying pattern '^$' to uri 'search/content/19'
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] add path info postfix: /home/ross/www/mysite/pub/search -> /home/ross/www/mysite/pub/search/content/19
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] strip per-dir prefix: /home/ross/www/mysite/pub/search/content/19 -> search/content/19
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] applying pattern '(.*)' to uri 'search/content/19'
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (4) [perdir /home/ross/www/mysite/pub/] RewriteCond: input='/home/ross/www/mysite/pub/search' pattern='!-f' => matched
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (4) [perdir /home/ross/www/mysite/pub/] RewriteCond: input='/home/ross/www/mysite/pub/search' pattern='!-d' => matched
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (2) [perdir /home/ross/www/mysite/pub/] rewrite 'search/content/19' -> 'index.php?/search/content/19'
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) split uri=index.php?/search/content/19 -> uri=index.php, args=/search/content/19
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (3) [perdir /home/ross/www/mysite/pub/] add per-dir prefix: index.php -> /home/ross/www/mysite/pub/index.php
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (2) [perdir /home/ross/www/mysite/pub/] trying to replace prefix /home/ross/www/mysite/pub/ with /
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (5) strip matching prefix: /home/ross/www/mysite/pub/index.php -> index.php
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (4) add subst prefix: index.php -> /index.php
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#836d470/initial] (1) [perdir /home/ross/www/mysite/pub/] internal redirect with /index.php [INTERNAL REDIRECT]
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#8379958/initial/redir#1] (3) [perdir /home/ross/www/mysite/pub/] strip per-dir prefix: /home/ross/www/mysite/pub/index.php -> index.php
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#8379958/initial/redir#1] (3) [perdir /home/ross/www/mysite/pub/] applying pattern '^$' to uri 'index.php'
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#8379958/initial/redir#1] (3) [perdir /home/ross/www/mysite/pub/] strip per-dir prefix: /home/ross/www/mysite/pub/index.php -> index.php
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#8379958/initial/redir#1] (3) [perdir /home/ross/www/mysite/pub/] applying pattern '(.*)' to uri 'index.php'
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#8379958/initial/redir#1] (4) [perdir /home/ross/www/mysite/pub/] RewriteCond: input='/home/ross/www/mysite/pub/index.php' pattern='!-f' => not-matched
10.42.2.128 - - [10/Apr/2007:10:04:42 +0100] [mysite.com/sid#80b44c0][rid#8379958/initial/redir#1] (1) [perdir /home/ross/www/mysite/pub/] pass through /home/ross/www/mysite/pub/index.php

Changed 18 months ago by david

(In [1979]) fixes all but one problems with multiple slashes and apache 2.2, refs #502 (outstanding issue affects slashes in existing directories, not in path info)

Changed 17 months ago by ross

Changed 14 months ago by david

  • status changed from new to closed
  • resolution set to wontfix

Judging from the comments in Apache Bugzilla issue #20036 (link above), this seems to be against the CGI spec and thus needs to be considered an issue with Apache2, so no fix on our side (I've tried, but it cannot be done; it's just too ambiguous, and I cannot make code "guess" reliably).

Changed 14 months ago by david

(In [2129]) Added note to apache 2.2 multi-slash test failure, see #502

Changed 14 months ago by david

  • status changed from closed to reopened
  • resolution wontfix deleted

Changed 14 months ago by david

  • status changed from reopened to closed
  • resolution set to fixed

I just realized that this is, pretty much, a fix. The only issue left is one where the double slashes appear in an _existing directory_ portion of the URL, which is rarely the case for most applications as they run in the document root - plus, it can easily be fixed with an external redirect. Hooray!

Changed 14 months ago by david

To clarify, this fix was in RC4.

Add/Change #502 ([Patch] AgaviWebRouting.class.php double slash fix for Apache 2.2)

Author



Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.