Changeset 1979

Show
Ignore:
Timestamp:
06/04/07 13:19:30 (20 months ago)
Author:
david
Message:

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)

Location:
branches/0.11
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/src/routing/AgaviWebRouting.class.php

    r1887 r1979  
    111111      $this->input = preg_replace('/' . preg_quote('&' . $ru['query'], '/') . '$/D', '', $qs); 
    112112       
     113      if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Apache/2.2') !== false) { 
     114        // multiple consecutive slashes got lost in our input thanks to an apache bug 
     115        // let's fix that 
     116        // var_dump($this->input, $ru['query'], rawurldecode($_SERVER['REQUEST_URI']), '--------------------'); 
     117        $cqs = preg_replace('#/{2,}#', '/', rawurldecode($ru['query'])); 
     118        $cru = preg_replace('#/{2,}#', '/', rawurldecode($_SERVER['REQUEST_URI'])); 
     119        $tmp = preg_replace('/' . preg_quote($this->input . (($cqs != '') ? '?' . $cqs : ''), '/') . '$/D', '', $cru); 
     120        // var_dump($cqs, $cru, $tmp, '===================='); 
     121        $input = preg_replace('/^' . preg_quote($tmp, '/') . '/', '', $_SERVER['REQUEST_URI']); 
     122        if($ru['query']) { 
     123          $input = preg_replace('/' . preg_quote('?' . $ru['query'], '/') . '$/D', '', $input); 
     124        } 
     125        $this->input = rawurldecode($input); 
     126        // var_dump($this->input, '===================='); 
     127      } 
     128       
    113129      if(!isset($_SERVER['SERVER_SOFTWARE']) || strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) { 
    114130        // don't do that for Apache, it's already rawurldecode()d there 
     
    116132      } 
    117133       
     134      $xrup = rawurldecode($ru['path']); 
    118135      $this->basePath = $this->prefix = preg_replace('/' . preg_quote($this->input, '/') . '$/D', '', rawurldecode($ru['path'])); 
     136      // var_dump($this->input, $xrup, $this->prefix, ''); 
    119137       
    120138      // that was easy. now clean up $_GET and the Request 
  • branches/0.11/tests2/routing/cases/Apache22ModuleSubdir.case.php

    r1978 r1979  
    597597  ), 
    598598  array( 
    599     'message' => 'Sub-directory, rewritten, called path with two slashes', 
    600     'input' => '/fu//bar', 
    601     'prefix' => '/tests/apache2.2-rewrite', 
    602     'basePath' => '/tests/apache2.2-rewrite/', 
    603     'baseHref' => 'http://impl.user.compass.zomglolkthxbai.com/tests/apache2.2-rewrite/', 
    604     '_ENV' => array ( 
    605     ), 
    606     '_GET' => array ( 
    607       '/fu/bar' => '', 
    608     ), 
    609     '_SERVER' => array ( 
    610       'REDIRECT_UNIQUE_ID' => 'xD2m@kI5IZQAAAV9CQYAAAAD', 
    611       'REDIRECT_STATUS' => '200', 
    612       'UNIQUE_ID' => 'xD2m@kI5IZQAAAV9CQYAAAAD', 
    613       'HTTP_ACCEPT' => '*/*', 
    614       'HTTP_ACCEPT_LANGUAGE' => 'de-de', 
    615       'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 
    616       'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', 
    617       'HTTP_CONNECTION' => 'keep-alive', 
    618       'HTTP_HOST' => 'impl.user.compass.zomglolkthxbai.com', 
    619       'PATH' => '/sbin:/bin:/usr/sbin:/usr/bin', 
    620       'SERVER_SIGNATURE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8 Server at impl.user.compass.zomglolkthxbai.com Port 80 
    621     ', 
    622       'SERVER_SOFTWARE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8', 
    623       'SERVER_NAME' => 'impl.user.compass.zomglolkthxbai.com', 
    624       'SERVER_ADDR' => '66.57.33.148', 
    625       'SERVER_PORT' => '80', 
    626       'REMOTE_ADDR' => '80.135.2.151', 
    627       'DOCUMENT_ROOT' => 'www/apache22/data', 
    628       'SERVER_ADMIN' => 'webmaster@compass.zomglolkthxbai.com', 
    629       'SCRIPT_FILENAME' => '/home/impl/public_html/tests/apache2.2-rewrite/index.php', 
    630       'REMOTE_PORT' => '61961', 
    631       'REDIRECT_QUERY_STRING' => '/fu/bar', 
    632       'REDIRECT_URL' => '/tests/apache2.2-rewrite/fu//bar', 
    633       'GATEWAY_INTERFACE' => 'CGI/1.1', 
    634       'SERVER_PROTOCOL' => 'HTTP/1.1', 
    635       'REQUEST_METHOD' => 'GET', 
    636       'QUERY_STRING' => '/fu/bar', 
    637       'REQUEST_URI' => '/tests/apache2.2-rewrite/fu//bar', 
    638       'SCRIPT_NAME' => '/tests/apache2.2-rewrite/index.php', 
    639       'PHP_SELF' => '/tests/apache2.2-rewrite/index.php', 
    640       'REQUEST_TIME' => 1180908845, 
    641     ) 
    642   ), 
    643   array( 
    644     'message' => 'Sub-directory, rewritten, called path with query', 
     599    'message' => 'Sub-directory, rewritten, called path in dir with two slashes', 
    645600    'input' => '/fubar', 
    646     'prefix' => '/tests/apache2.2-rewrite', 
    647     'basePath' => '/tests/apache2.2-rewrite/', 
    648     'baseHref' => 'http://impl.user.compass.zomglolkthxbai.com/tests/apache2.2-rewrite/', 
     601    'prefix' => '/tmp//rewrite', 
     602    'basePath' => '/tmp//rewrite/', 
     603    'baseHref' => 'http://ross.sandbox.zomglolkthxbai.net/tmp//rewrite/', 
    649604    '_ENV' => array ( 
    650605    ), 
    651606    '_GET' => array ( 
    652607      '/fubar' => '', 
    653       'foo' => 'bar', 
    654     ), 
    655     '_SERVER' => array ( 
    656       'REDIRECT_UNIQUE_ID' => 'yeO5JkI5IZQAAAV7BesAAAAB', 
    657       'REDIRECT_STATUS' => '200', 
    658       'UNIQUE_ID' => 'yeO5JkI5IZQAAAV7BesAAAAB', 
    659       'HTTP_ACCEPT' => '*/*', 
    660       'HTTP_ACCEPT_LANGUAGE' => 'de-de', 
    661       'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 
    662       'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', 
    663       'HTTP_CONNECTION' => 'keep-alive', 
    664       'HTTP_HOST' => 'impl.user.compass.zomglolkthxbai.com', 
    665       'PATH' => '/sbin:/bin:/usr/sbin:/usr/bin', 
    666       'SERVER_SIGNATURE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8 Server at impl.user.compass.zomglolkthxbai.com Port 80 
    667     ', 
    668       'SERVER_SOFTWARE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8', 
    669       'SERVER_NAME' => 'impl.user.compass.zomglolkthxbai.com', 
    670       'SERVER_ADDR' => '66.57.33.148', 
    671       'SERVER_PORT' => '80', 
    672       'REMOTE_ADDR' => '80.135.2.151', 
    673       'DOCUMENT_ROOT' => 'www/apache22/data', 
    674       'SERVER_ADMIN' => 'webmaster@compass.zomglolkthxbai.com', 
    675       'SCRIPT_FILENAME' => '/home/impl/public_html/tests/apache2.2-rewrite/index.php', 
    676       'REMOTE_PORT' => '61991', 
    677       'REDIRECT_QUERY_STRING' => '/fubar&foo=bar', 
    678       'REDIRECT_URL' => '/tests/apache2.2-rewrite/fubar', 
    679       'GATEWAY_INTERFACE' => 'CGI/1.1', 
    680       'SERVER_PROTOCOL' => 'HTTP/1.1', 
    681       'REQUEST_METHOD' => 'GET', 
    682       'QUERY_STRING' => '/fubar&foo=bar', 
    683       'REQUEST_URI' => '/tests/apache2.2-rewrite/fubar?foo=bar', 
    684       'SCRIPT_NAME' => '/tests/apache2.2-rewrite/index.php', 
    685       'PHP_SELF' => '/tests/apache2.2-rewrite/index.php', 
    686       'REQUEST_TIME' => 1180908940, 
    687     ) 
    688   ), 
    689   array( 
    690     'message' => 'Sub-directory, rewritten, called path with query that contains two slashes', 
    691     'input' => '/fubar', 
    692     'prefix' => '/tmp/rewrite', 
    693     'basePath' => '/tmp/rewrite/', 
    694     'baseHref' => 'http://ross.sandbox.zomglolkthxbai.net/tmp/rewrite/', 
    695     '_ENV' => array ( 
    696     ), 
    697     '_GET' => array ( 
    698       '/fubar' => '', 
    699       'foo' => 'ba//r', 
    700608    ), 
    701609    '_SERVER' => array ( 
     
    722630      'SERVER_ADMIN' => 'webmaster@localhost', 
    723631      'SCRIPT_FILENAME' => '/home/ross/www/tmp/rewrite/index.php', 
    724       'REMOTE_PORT' => '2560', 
    725       'REDIRECT_QUERY_STRING' => '/fubar&foo=ba//r', 
    726       'REDIRECT_URL' => '/tmp/rewrite/fubar', 
    727       'GATEWAY_INTERFACE' => 'CGI/1.1', 
    728       'SERVER_PROTOCOL' => 'HTTP/1.1', 
    729       'REQUEST_METHOD' => 'GET', 
    730       'QUERY_STRING' => '/fubar&foo=ba//r', 
    731       'REQUEST_URI' => '/tmp/rewrite/fubar?foo=ba//r', 
     632      'REMOTE_PORT' => '2937', 
     633      'REDIRECT_QUERY_STRING' => '/fubar', 
     634      'REDIRECT_URL' => '/tmp//rewrite/fubar', 
     635      'GATEWAY_INTERFACE' => 'CGI/1.1', 
     636      'SERVER_PROTOCOL' => 'HTTP/1.1', 
     637      'REQUEST_METHOD' => 'GET', 
     638      'QUERY_STRING' => '/fubar', 
     639      'REQUEST_URI' => '/tmp//rewrite/fubar', 
    732640      'SCRIPT_NAME' => '/tmp/rewrite/index.php', 
    733641      'PHP_SELF' => '/tmp/rewrite/index.php', 
    734       'REQUEST_TIME' => 1180952406, 
     642      'REQUEST_TIME' => 1180957954, 
    735643      'argv' =>  
    736644      array ( 
    737         0 => '/fubar&foo=ba//r', 
     645        0 => '/fubar', 
    738646      ), 
    739647      'argc' => 1, 
     
    741649  ), 
    742650  array( 
    743     'message' => 'Sub-directory, rewritten, called path with two slashes with query', 
     651    'message' => 'Sub-directory, rewritten, called path with two slashes', 
    744652    'input' => '/fu//bar', 
    745653    'prefix' => '/tests/apache2.2-rewrite', 
     
    750658    '_GET' => array ( 
    751659      '/fu/bar' => '', 
     660    ), 
     661    '_SERVER' => array ( 
     662      'REDIRECT_UNIQUE_ID' => 'xD2m@kI5IZQAAAV9CQYAAAAD', 
     663      'REDIRECT_STATUS' => '200', 
     664      'UNIQUE_ID' => 'xD2m@kI5IZQAAAV9CQYAAAAD', 
     665      'HTTP_ACCEPT' => '*/*', 
     666      'HTTP_ACCEPT_LANGUAGE' => 'de-de', 
     667      'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 
     668      'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', 
     669      'HTTP_CONNECTION' => 'keep-alive', 
     670      'HTTP_HOST' => 'impl.user.compass.zomglolkthxbai.com', 
     671      'PATH' => '/sbin:/bin:/usr/sbin:/usr/bin', 
     672      'SERVER_SIGNATURE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8 Server at impl.user.compass.zomglolkthxbai.com Port 80 
     673    ', 
     674      'SERVER_SOFTWARE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8', 
     675      'SERVER_NAME' => 'impl.user.compass.zomglolkthxbai.com', 
     676      'SERVER_ADDR' => '66.57.33.148', 
     677      'SERVER_PORT' => '80', 
     678      'REMOTE_ADDR' => '80.135.2.151', 
     679      'DOCUMENT_ROOT' => 'www/apache22/data', 
     680      'SERVER_ADMIN' => 'webmaster@compass.zomglolkthxbai.com', 
     681      'SCRIPT_FILENAME' => '/home/impl/public_html/tests/apache2.2-rewrite/index.php', 
     682      'REMOTE_PORT' => '61961', 
     683      'REDIRECT_QUERY_STRING' => '/fu/bar', 
     684      'REDIRECT_URL' => '/tests/apache2.2-rewrite/fu//bar', 
     685      'GATEWAY_INTERFACE' => 'CGI/1.1', 
     686      'SERVER_PROTOCOL' => 'HTTP/1.1', 
     687      'REQUEST_METHOD' => 'GET', 
     688      'QUERY_STRING' => '/fu/bar', 
     689      'REQUEST_URI' => '/tests/apache2.2-rewrite/fu//bar', 
     690      'SCRIPT_NAME' => '/tests/apache2.2-rewrite/index.php', 
     691      'PHP_SELF' => '/tests/apache2.2-rewrite/index.php', 
     692      'REQUEST_TIME' => 1180908845, 
     693    ) 
     694  ), 
     695  array( 
     696    'message' => 'Sub-directory, rewritten, called path with query', 
     697    'input' => '/fubar', 
     698    'prefix' => '/tests/apache2.2-rewrite', 
     699    'basePath' => '/tests/apache2.2-rewrite/', 
     700    'baseHref' => 'http://impl.user.compass.zomglolkthxbai.com/tests/apache2.2-rewrite/', 
     701    '_ENV' => array ( 
     702    ), 
     703    '_GET' => array ( 
     704      '/fubar' => '', 
    752705      'foo' => 'bar', 
    753706    ), 
    754707    '_SERVER' => array ( 
    755       'REDIRECT_UNIQUE_ID' => 'yzjjWEI5IZQAAAV6AtgAAAAA', 
    756       'REDIRECT_STATUS' => '200', 
    757       'UNIQUE_ID' => 'yzjjWEI5IZQAAAV6AtgAAAAA', 
    758       'HTTP_ACCEPT' => '*/*', 
    759       'HTTP_ACCEPT_LANGUAGE' => 'de-de', 
    760       'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 
    761       'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', 
    762       'HTTP_CONNECTION' => 'keep-alive', 
    763       'HTTP_HOST' => 'impl.user.compass.zomglolkthxbai.com', 
    764       'PATH' => '/sbin:/bin:/usr/sbin:/usr/bin', 
    765       'SERVER_SIGNATURE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8 Server at impl.user.compass.zomglolkthxbai.com Port 80 
    766     ', 
    767       'SERVER_SOFTWARE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8', 
    768       'SERVER_NAME' => 'impl.user.compass.zomglolkthxbai.com', 
    769       'SERVER_ADDR' => '66.57.33.148', 
    770       'SERVER_PORT' => '80', 
    771       'REMOTE_ADDR' => '80.135.2.151', 
    772       'DOCUMENT_ROOT' => 'www/apache22/data', 
    773       'SERVER_ADMIN' => 'webmaster@compass.zomglolkthxbai.com', 
    774       'SCRIPT_FILENAME' => '/home/impl/public_html/tests/apache2.2-rewrite/index.php', 
    775       'REMOTE_PORT' => '62002', 
    776       'REDIRECT_QUERY_STRING' => '/fu/bar&foo=bar', 
    777       'REDIRECT_URL' => '/tests/apache2.2-rewrite/fu//bar', 
    778       'GATEWAY_INTERFACE' => 'CGI/1.1', 
    779       'SERVER_PROTOCOL' => 'HTTP/1.1', 
    780       'REQUEST_METHOD' => 'GET', 
    781       'QUERY_STRING' => '/fu/bar&foo=bar', 
    782       'REQUEST_URI' => '/tests/apache2.2-rewrite/fu//bar?foo=bar', 
    783       'SCRIPT_NAME' => '/tests/apache2.2-rewrite/index.php', 
    784       'PHP_SELF' => '/tests/apache2.2-rewrite/index.php', 
    785       'REQUEST_TIME' => 1180908962, 
    786     ) 
    787   ), 
    788   array( 
    789     'message' => 'Sub-directory, rewritten, called path with two slashes with query that contains two slashes', 
    790     'input' => '/fu//bar', 
     708      'REDIRECT_UNIQUE_ID' => 'yeO5JkI5IZQAAAV7BesAAAAB', 
     709      'REDIRECT_STATUS' => '200', 
     710      'UNIQUE_ID' => 'yeO5JkI5IZQAAAV7BesAAAAB', 
     711      'HTTP_ACCEPT' => '*/*', 
     712      'HTTP_ACCEPT_LANGUAGE' => 'de-de', 
     713      'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 
     714      'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', 
     715      'HTTP_CONNECTION' => 'keep-alive', 
     716      'HTTP_HOST' => 'impl.user.compass.zomglolkthxbai.com', 
     717      'PATH' => '/sbin:/bin:/usr/sbin:/usr/bin', 
     718      'SERVER_SIGNATURE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8 Server at impl.user.compass.zomglolkthxbai.com Port 80 
     719    ', 
     720      'SERVER_SOFTWARE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8', 
     721      'SERVER_NAME' => 'impl.user.compass.zomglolkthxbai.com', 
     722      'SERVER_ADDR' => '66.57.33.148', 
     723      'SERVER_PORT' => '80', 
     724      'REMOTE_ADDR' => '80.135.2.151', 
     725      'DOCUMENT_ROOT' => 'www/apache22/data', 
     726      'SERVER_ADMIN' => 'webmaster@compass.zomglolkthxbai.com', 
     727      'SCRIPT_FILENAME' => '/home/impl/public_html/tests/apache2.2-rewrite/index.php', 
     728      'REMOTE_PORT' => '61991', 
     729      'REDIRECT_QUERY_STRING' => '/fubar&foo=bar', 
     730      'REDIRECT_URL' => '/tests/apache2.2-rewrite/fubar', 
     731      'GATEWAY_INTERFACE' => 'CGI/1.1', 
     732      'SERVER_PROTOCOL' => 'HTTP/1.1', 
     733      'REQUEST_METHOD' => 'GET', 
     734      'QUERY_STRING' => '/fubar&foo=bar', 
     735      'REQUEST_URI' => '/tests/apache2.2-rewrite/fubar?foo=bar', 
     736      'SCRIPT_NAME' => '/tests/apache2.2-rewrite/index.php', 
     737      'PHP_SELF' => '/tests/apache2.2-rewrite/index.php', 
     738      'REQUEST_TIME' => 1180908940, 
     739    ) 
     740  ), 
     741  array( 
     742    'message' => 'Sub-directory, rewritten, called path with query that contains two slashes', 
     743    'input' => '/fubar', 
    791744    'prefix' => '/tmp/rewrite', 
    792745    'basePath' => '/tmp/rewrite/', 
    793     'baseHref' => 'http://ross.sandbox.zomglolkthxbai.net/tmp/rewrite/apache2.2-rewrite/', 
    794     '_ENV' => array ( 
    795     ), 
    796     '_GET' => array ( 
    797       '/fu/bar' => '', 
     746    'baseHref' => 'http://ross.sandbox.zomglolkthxbai.net/tmp/rewrite/', 
     747    '_ENV' => array ( 
     748    ), 
     749    '_GET' => array ( 
     750      '/fubar' => '', 
    798751      'foo' => 'ba//r', 
    799752    ), 
     
    821774      'SERVER_ADMIN' => 'webmaster@localhost', 
    822775      'SCRIPT_FILENAME' => '/home/ross/www/tmp/rewrite/index.php', 
     776      'REMOTE_PORT' => '2560', 
     777      'REDIRECT_QUERY_STRING' => '/fubar&foo=ba//r', 
     778      'REDIRECT_URL' => '/tmp/rewrite/fubar', 
     779      'GATEWAY_INTERFACE' => 'CGI/1.1', 
     780      'SERVER_PROTOCOL' => 'HTTP/1.1', 
     781      'REQUEST_METHOD' => 'GET', 
     782      'QUERY_STRING' => '/fubar&foo=ba//r', 
     783      'REQUEST_URI' => '/tmp/rewrite/fubar?foo=ba//r', 
     784      'SCRIPT_NAME' => '/tmp/rewrite/index.php', 
     785      'PHP_SELF' => '/tmp/rewrite/index.php', 
     786      'REQUEST_TIME' => 1180952406, 
     787      'argv' =>  
     788      array ( 
     789        0 => '/fubar&foo=ba//r', 
     790      ), 
     791      'argc' => 1, 
     792    ) 
     793  ), 
     794  array( 
     795    'message' => 'Sub-directory, rewritten, called path with two slashes with query', 
     796    'input' => '/fu//bar', 
     797    'prefix' => '/tests/apache2.2-rewrite', 
     798    'basePath' => '/tests/apache2.2-rewrite/', 
     799    'baseHref' => 'http://impl.user.compass.zomglolkthxbai.com/tests/apache2.2-rewrite/', 
     800    '_ENV' => array ( 
     801    ), 
     802    '_GET' => array ( 
     803      '/fu/bar' => '', 
     804      'foo' => 'bar', 
     805    ), 
     806    '_SERVER' => array ( 
     807      'REDIRECT_UNIQUE_ID' => 'yzjjWEI5IZQAAAV6AtgAAAAA', 
     808      'REDIRECT_STATUS' => '200', 
     809      'UNIQUE_ID' => 'yzjjWEI5IZQAAAV6AtgAAAAA', 
     810      'HTTP_ACCEPT' => '*/*', 
     811      'HTTP_ACCEPT_LANGUAGE' => 'de-de', 
     812      'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 
     813      'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', 
     814      'HTTP_CONNECTION' => 'keep-alive', 
     815      'HTTP_HOST' => 'impl.user.compass.zomglolkthxbai.com', 
     816      'PATH' => '/sbin:/bin:/usr/sbin:/usr/bin', 
     817      'SERVER_SIGNATURE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8 Server at impl.user.compass.zomglolkthxbai.com Port 80 
     818    ', 
     819      'SERVER_SOFTWARE' => 'Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 proxy_html/2.5 PHP/5.2.2 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-03-13) mod_python/3.3.1 Python/2.4.4 mod_perl/2.0.3 Perl/v5.8.8', 
     820      'SERVER_NAME' => 'impl.user.compass.zomglolkthxbai.com', 
     821      'SERVER_ADDR' => '66.57.33.148', 
     822      'SERVER_PORT' => '80', 
     823      'REMOTE_ADDR' => '80.135.2.151', 
     824      'DOCUMENT_ROOT' => 'www/apache22/data', 
     825      'SERVER_ADMIN' => 'webmaster@compass.zomglolkthxbai.com', 
     826      'SCRIPT_FILENAME' => '/home/impl/public_html/tests/apache2.2-rewrite/index.php', 
     827      'REMOTE_PORT' => '62002', 
     828      'REDIRECT_QUERY_STRING' => '/fu/bar&foo=bar', 
     829      'REDIRECT_URL' => '/tests/apache2.2-rewrite/fu//bar', 
     830      'GATEWAY_INTERFACE' => 'CGI/1.1', 
     831      'SERVER_PROTOCOL' => 'HTTP/1.1', 
     832      'REQUEST_METHOD' => 'GET', 
     833      'QUERY_STRING' => '/fu/bar&foo=bar', 
     834      'REQUEST_URI' => '/tests/apache2.2-rewrite/fu//bar?foo=bar', 
     835      'SCRIPT_NAME' => '/tests/apache2.2-rewrite/index.php', 
     836      'PHP_SELF' => '/tests/apache2.2-rewrite/index.php', 
     837      'REQUEST_TIME' => 1180908962, 
     838    ) 
     839  ), 
     840  array( 
     841    'message' => 'Sub-directory, rewritten, called path with two slashes with query that contains two slashes', 
     842    'input' => '/fu//bar', 
     843    'prefix' => '/tmp/rewrite', 
     844    'basePath' => '/tmp/rewrite/', 
     845    'baseHref' => 'http://ross.sandbox.zomglolkthxbai.net/tmp/rewrite/', 
     846    '_ENV' => array ( 
     847    ), 
     848    '_GET' => array ( 
     849      '/fu/bar' => '', 
     850      'foo' => 'ba//r', 
     851    ), 
     852    '_SERVER' => array ( 
     853      'REDIRECT_STATUS' => '200', 
     854      'HTTP_USER_AGENT' => 'Opera/9.21 (Windows NT 5.1; U; en)', 
     855      'HTTP_HOST' => 'ross.sandbox.zomglolkthxbai.net', 
     856      'HTTP_ACCEPT' => 'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1', 
     857      'HTTP_ACCEPT_LANGUAGE' => 'en-GB,en;q=0.9', 
     858      'HTTP_ACCEPT_CHARSET' => 'iso-8859-1, utf-8, utf-16, *;q=0.1', 
     859      'HTTP_ACCEPT_ENCODING' => 'deflate, gzip, x-gzip, identity, *;q=0', 
     860      'HTTP_CONNECTION' => 'Keep-Alive, TE', 
     861      'HTTP_TE' => 'deflate, gzip, chunked, identity, trailers', 
     862      'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin', 
     863      'SERVER_SIGNATURE' => ' 
     864    Apache/2.2.4 (Unix) DAV/2 SVN/1.4.3 PHP/5.2.1 Server at ross.sandbox.zomglolkthxbai.net Port 80 
     865 
     866    ', 
     867      'SERVER_SOFTWARE' => 'Apache/2.2.4 (Unix) DAV/2 SVN/1.4.3 PHP/5.2.1', 
     868      'SERVER_NAME' => 'ross.sandbox.zomglolkthxbai.net', 
     869      'SERVER_ADDR' => '10.42.2.223', 
     870      'SERVER_PORT' => '80', 
     871      'REMOTE_ADDR' => '10.42.2.128', 
     872      'DOCUMENT_ROOT' => '/home/ross/www/', 
     873      'SERVER_ADMIN' => 'webmaster@localhost', 
     874      'SCRIPT_FILENAME' => '/home/ross/www/tmp/rewrite/index.php', 
    823875      'REMOTE_PORT' => '2553', 
    824876      'REDIRECT_QUERY_STRING' => '/fu/bar&foo=ba//r', 
     
    841893  array( 
    842894    'message' => 'Sub-directory, rewritten, called path with three slashes', 
    843     'input' => '/fu///bar', 
     895    'input' => '/foo///bar', 
    844896    'prefix' => '/tests/apache2.2-rewrite', 
    845897    'basePath' => '/tests/apache2.2-rewrite/', 
     
    10251077    ) 
    10261078  ), 
     1079  array( 
     1080    'message' => 'Sub-directory, rewritten, called special path with two slashes and an uber complicated query with, yeah, two slashes', 
     1081    'input' => '/fu//bar', 
     1082    'prefix' => '/tmp/rewrite', 
     1083    'basePath' => '/tmp/rewrite/', 
     1084    'baseHref' => 'http://ross.sandbox.zomglolkthxbai.net/tmp/rewrite/', 
     1085    '_ENV' => array ( 
     1086    ), 
     1087    '_GET' => array ( 
     1088      '/fu/bar' => '', 
     1089      'foo' => 'bar ba//z lol', 
     1090    ), 
     1091    '_SERVER' => array ( 
     1092      'REDIRECT_STATUS' => '200', 
     1093      'HTTP_USER_AGENT' => 'Opera/9.21 (Windows NT 5.1; U; en)', 
     1094      'HTTP_HOST' => 'ross.sandbox.zomglolkthxbai.net', 
     1095      'HTTP_ACCEPT' => 'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1', 
     1096      'HTTP_ACCEPT_LANGUAGE' => 'en-GB,en;q=0.9', 
     1097      'HTTP_ACCEPT_CHARSET' => 'iso-8859-1, utf-8, utf-16, *;q=0.1', 
     1098      'HTTP_ACCEPT_ENCODING' => 'deflate, gzip, x-gzip, identity, *;q=0', 
     1099      'HTTP_CONNECTION' => 'Keep-Alive, TE', 
     1100      'HTTP_TE' => 'deflate, gzip, chunked, identity, trailers', 
     1101      'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin', 
     1102      'SERVER_SIGNATURE' => ' 
     1103    Apache/2.2.4 (Unix) DAV/2 SVN/1.4.3 PHP/5.2.1 Server at ross.sandbox.zomglolkthxbai.net Port 80 
     1104 
     1105    ', 
     1106      'SERVER_SOFTWARE' => 'Apache/2.2.4 (Unix) DAV/2 SVN/1.4.3 PHP/5.2.1', 
     1107      'SERVER_NAME' => 'ross.sandbox.zomglolkthxbai.net', 
     1108      'SERVER_ADDR' => '10.42.2.223', 
     1109      'SERVER_PORT' => '80', 
     1110      'REMOTE_ADDR' => '10.42.2.128', 
     1111      'DOCUMENT_ROOT' => '/home/ross/www/', 
     1112      'SERVER_ADMIN' => 'webmaster@localhost', 
     1113      'SCRIPT_FILENAME' => '/home/ross/www/tmp/rewrite/index.php', 
     1114      'REMOTE_PORT' => '2947', 
     1115      'REDIRECT_QUERY_STRING' => '/fu/bar&foo=bar%20ba//z+lol', 
     1116      'REDIRECT_URL' => '/tmp/rewrite/fu//bar', 
     1117      'GATEWAY_INTERFACE' => 'CGI/1.1', 
     1118      'SERVER_PROTOCOL' => 'HTTP/1.1', 
     1119      'REQUEST_METHOD' => 'GET', 
     1120      'QUERY_STRING' => '/fu/bar&foo=bar%20ba//z+lol', 
     1121      'REQUEST_URI' => '/tmp/rewrite/fu//bar?foo=bar%20ba//z+lol', 
     1122      'SCRIPT_NAME' => '/tmp/rewrite/index.php', 
     1123      'PHP_SELF' => '/tmp/rewrite/index.php', 
     1124      'REQUEST_TIME' => 1180958000, 
     1125      'argv' =>  
     1126      array ( 
     1127        0 => '/fu/bar&foo=bar%20ba//z', 
     1128        1 => 'lol', 
     1129      ), 
     1130      'argc' => 2, 
     1131    ) 
     1132  ), 
    10271133);