X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FApache%2FMP13.pm;h=b0a7d1c2f3eb4a0ad1c8df53869fbf4b67e498b7;hb=fc88e4951e53e4492c168fc5ffd2a0516e50346b;hp=b7b9e74407ebfc6dec433e322e4c8534b97ab780;hpb=111728e3d4b1ebfa3e80ec469d03616a45571fa1;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/Apache/MP13.pm b/lib/Catalyst/Engine/Apache/MP13.pm index b7b9e74..b0a7d1c 100644 --- a/lib/Catalyst/Engine/Apache/MP13.pm +++ b/lib/Catalyst/Engine/Apache/MP13.pm @@ -1,18 +1,11 @@ package Catalyst::Engine::Apache::MP13; use strict; -use base 'Catalyst::Engine::Apache'; - -use Apache (); -use Apache::Constants (); -use Apache::Request (); -use Apache::Cookie (); - -Apache::Constants->import(':common'); +use base qw[Catalyst::Engine::Apache::MP13::Base Catalyst::Engine::CGI]; =head1 NAME -Catalyst::Engine::Apache::MP1 - Catalyst Apache MP1 Engine +Catalyst::Engine::Apache::MP13 - Catalyst Apache MP13 Engine =head1 SYNOPSIS @@ -20,81 +13,77 @@ See L. =head1 DESCRIPTION -This is the Catalyst engine specialized for Apache mod_perl version 1. +This is the Catalyst engine specialized for Apache mod_perl version 1.3x. =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') ); - - $c->apache->send_http_header; - - return 0; +sub prepare_body { + shift->Catalyst::Engine::CGI::prepare_body(@_); } -=item $c->handler +=item $c->prepare_parameters =cut -sub handler ($$) { - 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; + unless ( $ENV{REQUEST_METHOD} ) { - for my $upload ( $c->apache->upload ) { + $ENV{CONTENT_TYPE} = $r->header_in("Content-Type"); + $ENV{CONTENT_LENGTH} = $r->header_in("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, $upload->name, $object ); + $r->register_cleanup($cleanup); } - $c->req->_assign_values( $c->req->uploads, \@uploads ); + $c->SUPER::prepare_request($r); + $c->Catalyst::Engine::CGI::prepare_request( $r, @arguments ); +} + +=item $c->prepare_uploads + +=cut + +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