Added C::Utils and C::E::A::MP2 to MANIFEST. Reorderd subs in C::E::A::* to be in...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache / MP19.pm
CommitLineData
111728e3 1package Catalyst::Engine::Apache::MP19;
479d2af4 2
3use strict;
4use base 'Catalyst::Engine::Apache';
5
e7c0c583 6use Apache2 ();
7use Apache::Connection ();
8use Apache::Const ();
9use Apache::RequestIO ();
10use Apache::RequestRec ();
479d2af4 11use Apache::RequestUtil ();
e7c0c583 12use Apache::Request ();
13use Apache::Cookie ();
14use Apache::Upload ();
15use Apache::URI ();
16use APR::URI ();
479d2af4 17
e7c0c583 18Apache::Const->import( -compile => ':common' );
479d2af4 19
20=head1 NAME
21
22a23d06 22Catalyst::Engine::Apache::MP19 - Catalyst Apache MP19 Engine
479d2af4 23
24=head1 SYNOPSIS
25
26See L<Catalyst>.
27
28=head1 DESCRIPTION
29
06e1b616 30This is the Catalyst engine specialized for Apache mod_perl version 1.9x.
479d2af4 31
32=head1 OVERLOADED METHODS
33
34This class overloads some methods from C<Catalyst::Engine::Apache>.
35
36=over 4
37
e7c0c583 38=item $c->finalize_headers
39
40=cut
41
42sub finalize_headers {
43 my $c = shift;
44
45 for my $name ( $c->response->headers->header_field_names ) {
46 next if $name =~ /Content-Type/i;
47 my @values = $c->response->header($name);
48 $c->apache->headers_out->add( $name => $_ ) for @values;
49 }
50
51 if ( $c->response->header('Set-Cookie') && $c->response->status >= 300 ) {
52 my @values = $c->response->header('Set-Cookie');
53 $c->apache->err_headers_out->add( 'Set-Cookie' => $_ ) for @values;
54 }
55
56 $c->apache->status( $c->response->status );
57 $c->apache->content_type( $c->response->header('Content-Type') );
58
59 return 0;
60}
61
479d2af4 62=item $c->handler
63
e7c0c583 64=cut
65
66sub handler : method {
67 shift->SUPER::handler(@_);
68}
69
329a7e51 70=item $c->prepare_request($r)
71
72=cut
73
74sub prepare_request {
75 my ( $c, $r ) = @_;
76 $c->apache( Apache::Request->new($r) );
77}
78
e7c0c583 79=item $c->prepare_uploads
80
81=cut
82
83sub prepare_uploads {
84 my $c = shift;
85
86 my @uploads;
06e1b616 87
88 for my $field ( $c->request->param ) {
e7c0c583 89
90 for my $upload ( $c->apache->upload($field) ) {
91
146554c5 92 my $object = Catalyst::Request::Upload->new(
e7c0c583 93 filename => $upload->filename,
94 size => $upload->size,
95 tempname => $upload->tempname,
96 type => $upload->type
146554c5 97 );
e7c0c583 98
146554c5 99 push( @uploads, $field, $object );
e7c0c583 100 }
101 }
102
06e1b616 103 $c->request->_assign_values( $c->req->uploads, \@uploads );
104}
105
479d2af4 106=back
107
108=head1 SEE ALSO
109
110L<Catalyst>, L<Catalyst::Engine>, L<Catalyst::Engine::Apache>.
111
112=head1 AUTHOR
113
114Sebastian Riedel, C<sri@cpan.org>
329a7e51 115Christian Hansen C<ch@ngmedia.com>
479d2af4 116
117=head1 COPYRIGHT
118
119This program is free software, you can redistribute it and/or modify it under
120the same terms as Perl itself.
121
122=cut
123
1241;