X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=a9c3da3b16b7a13a94432d8cb6f2bf7c70afdbd7;hb=65791fc58356d0e6891ff3fdbc0dc6ed92698ee6;hp=35ab188c9bff35acf05fa07ebd3edadc3b634f90;hpb=eebe046fdd1c0b74d65920dd6df6977f470f64a1;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 35ab188..a9c3da3 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -11,6 +11,7 @@ use HTTP::Body; use HTTP::Headers; use URI::QueryParam; use Moose::Util::TypeConstraints; +use Plack::Loader; use namespace::clean -except => 'meta'; @@ -432,7 +433,7 @@ sub prepare_connection { $request->protocol( $env->{SERVER_PROTOCOL} ); $request->remote_user( $env->{REMOTE_USER} ); $request->method( $env->{REQUEST_METHOD} ); - $request->secure( $env->{'psgi.url_scheme'} eq 'https' ); + $request->secure( $env->{'psgi.url_scheme'} eq 'https' ? 1 : 0 ); return; } @@ -518,7 +519,7 @@ sub prepare_path { # set the request URI my $req_uri = $env->{REQUEST_URI}; $req_uri =~ s/\?.*$//; - my $path = $self->unescape_uri($req_uri); + my $path = $req_uri; $path =~ s{^/+}{}; # Using URI directly is way too slow, so we construct the URLs manually @@ -531,10 +532,6 @@ sub prepare_path { $host .= ":$port"; } - # Escape the path - $path =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go; - $path =~ s/\?/%3F/g; # STUPID STUPID SPECIAL CASE - my $query = $env->{QUERY_STRING} ? '?' . $env->{QUERY_STRING} : ''; my $uri = $scheme . '://' . $host . '/' . $path . $query; @@ -751,8 +748,14 @@ Start the engine. Implemented by the various engine classes. =cut sub run { - my ($self, $app) = @_; + my ($self, $app, @args) = @_; + Carp::cluck("Run"); + # FIXME - Do something sensible with the options we're passed + $self->_run_psgi_app($self->_build_psgi_app($app, @args), @args); +} +sub _build_psgi_app { + my ($self, $app, @args) = @_; return sub { my ($env) = @_; @@ -764,6 +767,12 @@ sub run { }; } +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.