X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FApache.pm;h=a6b763c5fa7e34c52b95597198bcb7fdf211b73f;hb=b9e9fff6b976cb138c6d56f10c37ebc20216b74f;hp=a683631284a29ce0284c80ac13e58140e25e7172;hpb=13cafd1af736071eca3b41bd520e29416e2aa68d;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/Apache.pm b/lib/Catalyst/Engine/Apache.pm index a683631..a6b763c 100644 --- a/lib/Catalyst/Engine/Apache.pm +++ b/lib/Catalyst/Engine/Apache.pm @@ -18,7 +18,7 @@ See L. =head1 DESCRIPTION -This is the Catalyst engine specialized for Apache (i.e. for mod_perl). +This is a base class engine specialized for Apache (i.e. for mod_perl). =head1 METHODS @@ -36,13 +36,34 @@ This class overloads some methods from C. =over 4 -=item $c->finalize_output +=item $c->finalize_body =cut -sub finalize_output { +sub finalize_body { my $c = shift; - $c->apache->print( $c->response->output ); + $c->apache->print( $c->response->body ); +} + +=item $c->prepare_body + +=cut + +sub prepare_body { + my $c = shift; + + my $length = $c->request->content_length; + my ( $buffer, $content ); + + while ($length) { + + $c->apache->read( $buffer, ( $length < 8192 ) ? $length : 8192 ); + + $length -= length($buffer); + $content .= $buffer; + } + + $c->request->body($content); } =item $c->prepare_connection @@ -72,10 +93,15 @@ sub prepare_headers { sub prepare_parameters { my $c = shift; - foreach my $key ( $c->apache->param ) { - my @values = $c->apache->param($key); - $c->req->parameters->{$key} = ( @values == 1 ) ? $values[0] : \@values; - } + my @params; + + $c->apache->param->do( sub { + my ( $field, $value ) = @_; + push( @params, $field, $value ); + return 1; + }); + + $c->req->_assign_values( $c->req->parameters, \@params ); } =item $c->prepare_path @@ -99,17 +125,6 @@ sub prepare_path { $c->request->base( $base->as_string ); } -=item $c->prepare_request($r) - -=cut - -sub prepare_request { - my ( $c, $r ) = @_; - $c->apache( $ENV{MOD_PERL_API_VERSION} == 2 - ? Apache2::Request->new($r) - : Apache::Request->new($r) ); -} - =item $c->run =cut @@ -125,6 +140,7 @@ L. =head1 AUTHOR Sebastian Riedel, C +Christian Hansen C =head1 COPYRIGHT