X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FApache%2FMP1.pm;h=7405269e7adbd4c9eb4e483b45e450d3a2272792;hb=e7c0c583d6e12e822dd26bf1282eb610c9a59351;hp=842a4deaf31ece53a14e3eca758f85d718d9cd45;hpb=597d4987a6929a19b18743ba111a6b55f2b3b496;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/Apache/MP1.pm b/lib/Catalyst/Engine/Apache/MP1.pm index 842a4de..7405269 100644 --- a/lib/Catalyst/Engine/Apache/MP1.pm +++ b/lib/Catalyst/Engine/Apache/MP1.pm @@ -3,12 +3,12 @@ package Catalyst::Engine::Apache::MP1; use strict; use base 'Catalyst::Engine::Apache'; -use Apache (); -use Apache::Constants qw(:common); -use Apache::Request (); -use Apache::Cookie (); +use Apache (); +use Apache::Constants (); +use Apache::Request (); +use Apache::Cookie (); -sub handler ($$) { shift->SUPER::handler(@_) } +Apache::Constants->import(':common'); =head1 NAME @@ -28,8 +28,65 @@ This class overloads some methods from C. =over 4 +=item $c->finalize_headers + +=cut + +sub finalize_headers { + my $c = shift; + + for my $name ( $c->response->headers->header_field_names ) { + next if $name =~ /Content-Type/i; + my @values = $c->response->header($name); + $c->apache->headers_out->add( $name => $_ ) for @values; + } + + if ( $c->response->header('Set-Cookie') && $c->response->status >= 300 ) { + my @values = $c->response->header('Set-Cookie'); + $c->apache->err_headers_out->add( 'Set-Cookie' => $_ ) for @values; + } + + $c->apache->status( $c->response->status ); + $c->apache->content_type( $c->response->header('Content-Type') ); + + $c->apache->send_http_header; + + return 0; +} + =item $c->handler +=cut + +sub handler ($$) { + shift->SUPER::handler(@_); +} + +=item $c->prepare_uploads + +=cut + +sub prepare_uploads { + my $c = shift; + + my @uploads; + + for my $upload ( $c->apache->upload ) { + + my $hash = { + fh => $upload->fh, + filename => $upload->filename, + size => $upload->size, + tempname => $upload->tempname, + type => $upload->type + }; + + push( @uploads, $upload->name, $hash ); + } + + $c->req->_assign_values( $c->req->uploads, \@uploads ); +} + =back =head1 SEE ALSO