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