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=a5c177a15e70393a907b32fe5e2c4c5c1c0e1afb;hp=9f97a42859185782ddd51926d48248cc09899b9c;hb=78acc1f779d3c6992f3331a7bf61b3febc255162;hpb=191665f3c88f4b1f81e4198717077ac08d06bdb7 diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 9f97a42..a5c177a 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -59,16 +59,17 @@ See L. Finalize body. Prints the response output as blocking stream if it looks like a filehandle, otherwise write it out all in one go. If there is no body in the response, we assume you are handling it 'manually', such as for nonblocking -style or asynchronous streaming responses. You do this by calling L<\write> -several times (which sends HTTP headers if needed) or you close over C<$response->write_fh>. +style or asynchronous streaming responses. You do this by calling L +several times (which sends HTTP headers if needed) or you close over +C<< $response->write_fh >>. -See L and L for more. +See L and L for more. =cut sub finalize_body { my ( $self, $c ) = @_; - return if $c->response->has_write_fh; + return if $c->response->_has_write_fh; my $body = $c->response->body; no warnings 'uninitialized'; @@ -489,8 +490,16 @@ process the query string and extract query parameters. sub prepare_query_parameters { my ($self, $c) = @_; - my $env = $c->request->env; + + if(my $query_obj = $env->{'plack.request.query'}) { + $c->request->query_parameters( + $c->request->_use_hash_multivalue ? + $query_obj->clone : + $query_obj->as_hashref_mixed); + return; + } + my $query_string = exists $env->{QUERY_STRING} ? $env->{QUERY_STRING} : ''; @@ -498,7 +507,7 @@ 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) ); + $c->request->query_keywords($self->unescape_uri($query_string)); return; } @@ -529,7 +538,11 @@ sub prepare_query_parameters { $query{$param} = $value; } } - $c->request->query_parameters( \%query ); + + $c->request->query_parameters( + $c->request->_use_hash_multivalue ? + Hash::MultiValue->from_mixed(\%query) : + \%query); } =head2 $self->prepare_read($c) @@ -571,7 +584,6 @@ sub prepare_uploads { my $uploads = $request->_body->upload; my $parameters = $request->parameters; - my @plack_uploads; foreach my $name (keys %$uploads) { my $files = $uploads->{$name}; my @uploads; @@ -586,14 +598,9 @@ sub prepare_uploads { filename => $upload->{filename}, ); push @uploads, $u; - - # Plack compatibility. - my %copy = (%$upload, headers=>$headers); - push @plack_uploads, $name, Plack::Request::Upload->new(%copy); } $request->uploads->{$name} = @uploads > 1 ? \@uploads : $uploads[0]; - # support access to the filename as a normal param my @filenames = map { $_->{filename} } @uploads; # append, if there's already params with this name @@ -609,8 +616,6 @@ sub prepare_uploads { $parameters->{$name} = @filenames > 1 ? \@filenames : $filenames[0]; } } - - $self->env->{'plack.request.upload'} ||= Hash::MultiValue->new(@plack_uploads); } =head2 $self->write($c, $buffer)