updated routing to fix several issues.

This commit is contained in:
Taylor Otwell
2012-02-12 14:48:36 -06:00
parent 31cf44c374
commit 3a92facc76
31 changed files with 960 additions and 772 deletions

View File

@@ -132,15 +132,25 @@ Input::$input = $input;
Bundle::start(DEFAULT_BUNDLE);
/**
* Start all of the bundles that are specified in the configuration
* array of auto-loaded bundles. This lets the developer have an
* easy way to load bundles for every request.
* Auto-start any bundles configured to start on every request.
* This is especially useful for debug bundles or bundles that
* are used throughout the application.
*/
foreach (Config::get('application.bundle.auto') as $bundle)
foreach (Bundle::$bundles as $bundle => $config)
{
Bundle::start($bundle);
if ($config['auto']) Bundle::start($bundle);
}
/**
* Register the "catch-all" route that handles 404 responses for
* routes that can not be matched to any other route within the
* application. We'll just raise the 404 event.
*/
Routing\Router::register('*', '(:all)', function()
{
return Event::first('404');
});
/**
* If the requset URI has too many segments, we will bomb out of
* the request. This is too avoid potential DDoS attacks against
@@ -162,16 +172,6 @@ if (count(URI::$segments) > 15)
*/
Request::$route = Routing\Router::route(Request::method(), $uri);
if (is_null(Request::$route))
{
Request::$route = new Routing\Route('GET /404', array(function()
{
return Response::error('404');
}));
$response = Response::error('404');
}
$response = Request::$route->call();
/**