Fixed MP2, removed dependency of libapreq in MP engines, fixed C::E::C::APR
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache / MP20 / Base.pm
1 package Catalyst::Engine::Apache::MP20::Base;
2
3 use strict;
4 use base 'Catalyst::Engine::Apache::Base';
5
6 use Apache2::Connection  ();
7 use Apache2::Const       ();
8 use Apache2::RequestIO   ();
9 use Apache2::RequestRec  ();
10 use Apache2::RequestUtil ();
11
12 Apache2::Const->import( -compile => ':common' );
13
14 =head1 NAME
15
16 Catalyst::Engine::Apache::MP20::Base - Base class for MP 2.0 Engines
17
18 =head1 SYNOPSIS
19
20 See L<Catalyst>.
21
22 =head1 DESCRIPTION
23
24 This is a base class for MP 2.0 Engines.
25
26 =head1 OVERLOADED METHODS
27
28 This class overloads some methods from C<Catalyst::Engine::Apache::Base>.
29
30 =over 4
31
32 =item $c->finalize_headers
33
34 =cut
35
36 sub finalize_headers {
37     my $c = shift;
38
39     for my $name ( $c->response->headers->header_field_names ) {
40         next if $name =~ /Content-Type/i;
41         my @values = $c->response->header($name);
42         $c->apache->headers_out->add( $name => $_ ) for @values;
43     }
44
45     if ( $c->response->header('Set-Cookie') && $c->response->status >= 300 ) {
46         my @values = $c->response->header('Set-Cookie');
47         $c->apache->err_headers_out->add( 'Set-Cookie' => $_ ) for @values;
48     }
49
50     $c->apache->status( $c->response->status );
51     $c->apache->content_type( $c->response->header('Content-Type') );
52
53     return 0;
54 }
55
56 =item $c->handler
57
58 =cut
59
60 sub handler : method {
61     shift->SUPER::handler(@_);
62 }
63
64 =back
65
66 =head1 SEE ALSO
67
68 L<Catalyst>, L<Catalyst::Engine>, L<Catalyst::Engine::Apache::Base>.
69
70 =head1 AUTHOR
71
72 Sebastian Riedel, C<sri@cpan.org>
73 Christian Hansen C<ch@ngmedia.com>
74
75 =head1 COPYRIGHT
76
77 This program is free software, you can redistribute it and/or modify it under
78 the same terms as Perl itself.
79
80 =cut
81
82 1;