X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=71a743dfccbc35a69a92b8c62196a2bd906728a3;hp=56e5b1d259676a7fd0c132d7b1abb0c8b17e17b1;hb=b9d96e27325fd2b5bc7ff2bd28e5c96675b42c7f;hpb=08680694151d666fc2f69c54065e2aa09e175742 diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 56e5b1d..71a743d 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -7,21 +7,36 @@ use CGI::Simple::Cookie; use Data::Dump qw/dump/; use Errno 'EWOULDBLOCK'; use HTML::Entities; -use HTTP::Body; use HTTP::Headers; -use URI::QueryParam; use Plack::Loader; use Catalyst::EngineLoader; -use Encode (); +use Encode 2.21 'decode_utf8'; use Plack::Request::Upload; use Hash::MultiValue; -use utf8; - use namespace::clean -except => 'meta'; # Amount of data to read from input on each pass our $CHUNKSIZE = 64 * 1024; +# XXX - this is only here for compat, do not use! +has env => ( is => 'rw', writer => '_set_env' ); +my $WARN_ABOUT_ENV = 0; +around env => sub { + my ($orig, $self, @args) = @_; + if(@args) { + warn "env as a writer is deprecated, you probably need to upgrade Catalyst::Engine::PSGI" + unless $WARN_ABOUT_ENV++; + return $self->_set_env(@args); + } + return $self->$orig; +}; + +# XXX - Only here for Engine::PSGI compat +sub prepare_connection { + my ($self, $ctx) = @_; + $ctx->request->prepare_connection; +} + =head1 NAME Catalyst::Engine - The Catalyst Engine @@ -574,7 +589,9 @@ sub prepare_query_parameters { # Check for keywords (no = signs) # (yes, index() is faster than a regex :)) if ( index( $query_string, '=' ) < 0 ) { - $c->request->query_keywords($self->unescape_uri($query_string)); + my $keywords = $self->unescape_uri($query_string); + $keywords = decode_utf8 $keywords; + $c->request->query_keywords(); return; } @@ -588,10 +605,13 @@ sub prepare_query_parameters { for my $item ( @params ) { my ($param, $value) - = map { $self->unescape_uri($_) } + = map { decode_utf8($self->unescape_uri($_)) } split( /=/, $item, 2 ); - $param = $self->unescape_uri($item) unless defined $param; + unless(defined $param) { + $param = $self->unescape_uri($item); + $param = decode_utf8 $param; + } if ( exists $query{$param} ) { if ( ref $query{$param} ) { @@ -635,6 +655,7 @@ sub prepare_request { my ($self, $ctx, %args) = @_; $ctx->log->psgienv($args{env}) if $ctx->log->can('psgienv'); $ctx->request->_set_env($args{env}); + $self->_set_env($args{env}); # Nasty back compat! $ctx->response->_set_response_cb($args{response_cb}); }