X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FCGI.pm;h=6d0fd12e5c91864167a22094ba64dad43df90007;hb=329a7e51e457b3cd30d88ddea13c596cff298d55;hp=af26d08e9c20dd017a708c09a0a14387d4e8be6f;hpb=e7c0c583d6e12e822dd26bf1282eb610c9a59351;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/CGI.pm b/lib/Catalyst/Engine/CGI.pm index af26d08..6d0fd12 100644 --- a/lib/Catalyst/Engine/CGI.pm +++ b/lib/Catalyst/Engine/CGI.pm @@ -57,6 +57,17 @@ This class overloads some methods from C. =over 4 +=item $c->finalize_body + +Prints the response output to STDOUT. + +=cut + +sub finalize_body { + my $c = shift; + print $c->response->output; +} + =item $c->finalize_headers =cut @@ -70,15 +81,18 @@ sub finalize_headers { print "\015\012"; } -=item $c->finalize_output - -Prints the response output to STDOUT. +=item $c->prepare_body =cut -sub finalize_output { +sub prepare_body { my $c = shift; - print $c->response->output; + + # XXX this is undocumented in CGI.pm. If Content-Type is not + # application/x-www-form-urlencoded or multipart/form-data + # CGI.pm will read STDIN into a param, POSTDATA. + + $c->request->body( $c->cgi->param('POSTDATA') ); } =item $c->prepare_connection @@ -116,11 +130,22 @@ sub prepare_headers { sub prepare_parameters { my $c = shift; + + my ( @params ); - for my $param ( $c->cgi->param ) { - my @values = $c->cgi->param($param); - $c->req->parameters->{$param} = ( @values > 1 ) ? \@values : $values[0]; + for my $param ( $c->cgi->url_param ) { + for my $value ( $c->cgi->url_param($param) ) { + push ( @params, $param, $value ); + } + } + + for my $param ( $c->cgi->param ) { + for my $value ( $c->cgi->param($param) ) { + push ( @params, $param, $value ); + } } + + $c->req->_assign_values( $c->req->parameters, \@params ); } =item $c->prepare_path @@ -189,13 +214,12 @@ sub prepare_uploads { my $disposition = $info->{'Content-Disposition'}; my $filename = ( $disposition =~ / filename="([^;]*)"/ )[0]; - my $upload = { - fh => $fh, + my $upload = Catalyst::Request::Upload->new( filename => $filename, size => $size, tempname => $tempname, type => $type - }; + ); push( @uploads, $param, $upload ); }