Renamed C::E::A::MPXX::APR to ::Apreq
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache / MP13 / Base.pm
index ca38f40..e22e408 100644 (file)
@@ -5,6 +5,7 @@ use base 'Catalyst::Engine::Apache::Base';
 
 use Apache            ();
 use Apache::Constants ();
+use Apache::File      ();
 
 Apache::Constants->import(':common');
 
@@ -34,7 +35,7 @@ sub finalize_headers {
     my $c = shift;
 
     for my $name ( $c->response->headers->header_field_names ) {
-        next if $name =~ /Content-Type/i;
+        next if $name =~ /^Content-(Length|Type)$/i;
         my @values = $c->response->header($name);
         $c->apache->headers_out->add( $name => $_ ) for @values;
     }
@@ -45,7 +46,14 @@ sub finalize_headers {
     }
 
     $c->apache->status( $c->response->status );
-    $c->apache->content_type( $c->response->header('Content-Type') );
+
+    if ( my $type = $c->response->header('Content-Type') ) {
+        $c->apache->content_type($type);
+    }
+
+    if ( my $length = $c->response->content_length ) {
+        $c->apache->set_content_length($length);
+    }
 
     $c->apache->send_http_header;