Merge branch 'master' into psgi
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine.pm
index 4cc8c6d..ee4477a 100644 (file)
@@ -304,7 +304,8 @@ sub finalize_error {
 </html>
 
 
-    # Trick IE
+    # Trick IE. Old versions of IE would display their own error page instead
+    # of ours if we'd give it less than 512 bytes.
     $c->res->{body} .= ( ' ' x 512 );
 
     # Return 500
@@ -537,7 +538,7 @@ sub prepare_path {
     my $query = $env->{QUERY_STRING} ? '?' . $env->{QUERY_STRING} : '';
     my $uri   = $scheme . '://' . $host . '/' . $path . $query;
 
-    $ctx->request->uri( bless \$uri, $uri_class );
+    $ctx->request->uri( (bless \$uri, $uri_class)->canonical );
 
     # set the base URI
     # base must end in a slash
@@ -750,13 +751,12 @@ Start the engine. Implemented by the various engine classes.
 =cut
 
 sub run {
-    my ($self, $app, @args) = @_;
-    Carp::cluck("Run");
+    my ($self, $app, $server, @args) = @_;
     # FIXME - Do something sensible with the options we're passed
-    $self->_run_psgi_app($self->_build_psgi_app($app, @args), @args);
+    $server->run($self->build_psgi_app($app, @args));
 }
 
-sub _build_psgi_app {
+sub build_psgi_app {
     my ($self, $app, @args) = @_;
 
     my $psgi_app = sub {
@@ -782,12 +782,6 @@ sub _build_psgi_app {
     return $psgi_app;
 }
 
-sub _run_psgi_app {
-    my ($self, $psgi_app, @args);
-    # FIXME - Need to be able to specify engine and pass options..
-    Plack::Loader->auto()->run($psgi_app);
-}
-
 =head2 $self->write($c, $buffer)
 
 Writes the buffer to the client.