X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FApache%2FMP19.pm;h=a3e2da32342a9441794454af25ea73bbf4ace933;hp=a14718a390cbd700862201328c3c6a84a6c5eb6e;hb=21465c884872c1ec8c30acd72796445f9eaacb31;hpb=06e1b6164a2c9d7b463f358b0d1934ef83a82845 diff --git a/lib/Catalyst/Engine/Apache/MP19.pm b/lib/Catalyst/Engine/Apache/MP19.pm index a14718a..a3e2da3 100644 --- a/lib/Catalyst/Engine/Apache/MP19.pm +++ b/lib/Catalyst/Engine/Apache/MP19.pm @@ -1,21 +1,7 @@ package Catalyst::Engine::Apache::MP19; use strict; -use base 'Catalyst::Engine::Apache'; - -use Apache2 (); -use Apache::Connection (); -use Apache::Const (); -use Apache::RequestIO (); -use Apache::RequestRec (); -use Apache::RequestUtil (); -use Apache::Request (); -use Apache::Cookie (); -use Apache::Upload (); -use Apache::URI (); -use APR::URI (); - -Apache::Const->import( -compile => ':common' ); +use base qw[Catalyst::Engine::Apache::MP19::Base Catalyst::Engine::CGI]; =head1 NAME @@ -31,87 +17,73 @@ This is the Catalyst engine specialized for Apache mod_perl version 1.9x. =head1 OVERLOADED METHODS -This class overloads some methods from C. +This class overloads some methods from C +and C. =over 4 -=item $c->finalize_headers +=item $c->prepare_body =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') ); - - return 0; +sub prepare_body { + shift->Catalyst::Engine::CGI::prepare_body(@_); } -=item $c->handler +=item $c->prepare_parameters =cut -sub handler : method { - shift->SUPER::handler(@_); +sub prepare_parameters { + shift->Catalyst::Engine::CGI::prepare_parameters(@_); } -=item $c->prepare_uploads +=item $c->prepare_request =cut -sub prepare_uploads { - my $c = shift; +sub prepare_request { + my ( $c, $r, @arguments ) = @_; - my @uploads; - - for my $field ( $c->request->param ) { + unless ( $ENV{REQUEST_METHOD} ) { - for my $upload ( $c->apache->upload($field) ) { + $ENV{CONTENT_TYPE} = $r->headers_in->get("Content-Type"); + $ENV{CONTENT_LENGTH} = $r->headers_in->get("Content-Length"); + $ENV{QUERY_STRING} = $r->args; + $ENV{REQUEST_METHOD} = $r->method; - my $object = Catalyst::Request::Upload->new( - filename => $upload->filename, - size => $upload->size, - tempname => $upload->tempname, - type => $upload->type - ); + my $cleanup = sub { + delete( $ENV{$_} ) for qw( CONTENT_TYPE + CONTENT_LENGTH + QUERY_STRING + REQUEST_METHOD ); + }; - push( @uploads, $field, $object ); - } + $r->pool->cleanup_register($cleanup); } - $c->request->_assign_values( $c->req->uploads, \@uploads ); + $c->SUPER::prepare_request($r); + $c->Catalyst::Engine::CGI::prepare_request( $r, @arguments ); } -=item $c->prepare_request($r) +=item $c->prepare_uploads =cut -sub prepare_request { - my ( $c, $r ) = @_; - $c->apache( Apache::Request->new($r) ); +sub prepare_uploads { + shift->Catalyst::Engine::CGI::prepare_uploads(@_); } =back =head1 SEE ALSO -L, L, L. +L, L, L. =head1 AUTHOR Sebastian Riedel, C +Christian Hansen C =head1 COPYRIGHT