Fixed MP19 uploads. Added request/response body. Added support in all Engines for...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache.pm
index a683631..7d11ea4 100644 (file)
@@ -36,15 +36,36 @@ This class overloads some methods from C<Catalyst::Engine>.
 
 =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 );
 }
 
+=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->input($content);
+}
+
 =item $c->prepare_connection
 
 =cut
@@ -99,17 +120,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