pluf2

pluf2 Commit Details


Date:2009-02-16 14:30:38 (15 years 10 months ago)
Author:Loic d'Anterroches
Branch:master
Commit:eb9dd9a39a47533338b50319cba92c02ac5bcbcb
Parents: 87e1528eb760aefe24f77a0b498275fc21de8b03
Message:Added smarter 404 handling with trailing slash testing.

As normally the pages have a trailing slash, if the application is getting a 404 error with an URL not
having a trailing slash, we test with an added trailing slash.
Changes:

File differences

src/Pluf/Dispatcher.php
110110
111111
112112
113
113
114114
115115
116116
......
161161
162162
163163
164
165
166
167
164168
165169
166170
* @param Pluf_HTTP_Request Request object
* @return Pluf_HTTP_Response Response object
*/
public static function match($req)
public static function match($req, $firstpass=true)
{
// Order the controllers by priority
foreach ($GLOBALS['_PX_views'] as $key => $control) {
// Need to add a 404 error handler
// something like Pluf::f('404_handler', 'class::method')
}
if ($firstpass and substr($req->query, -1) != '/') {
$req->query .= '/';
return self::match($req, false);
}
return new Pluf_HTTP_Response_NotFound($req);
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05360s using 13 queries.