Commit | Line | Data |
316bf0f0 |
1 | package Catalyst::Engine::Apache::MP13::Base; |
2 | |
3 | use strict; |
4 | use base 'Catalyst::Engine::Apache::Base'; |
5 | |
6 | use Apache (); |
7 | use Apache::Constants (); |
566ee5d7 |
8 | use Apache::File (); |
316bf0f0 |
9 | |
10 | Apache::Constants->import(':common'); |
11 | |
12 | =head1 NAME |
13 | |
14 | Catalyst::Engine::Apache::MP13::Base - Base class for MP 1.3 Engines |
15 | |
16 | =head1 SYNOPSIS |
17 | |
18 | See L<Catalyst>. |
19 | |
20 | =head1 DESCRIPTION |
21 | |
22 | This is a base class for MP 1.3 Engines. |
23 | |
24 | =head1 OVERLOADED METHODS |
25 | |
26 | This class overloads some methods from C<Catalyst::Engine::Apache::Base>. |
27 | |
28 | =over 4 |
29 | |
30 | =item $c->finalize_headers |
31 | |
32 | =cut |
33 | |
34 | sub finalize_headers { |
35 | my $c = shift; |
36 | |
37 | for my $name ( $c->response->headers->header_field_names ) { |
566ee5d7 |
38 | next if $name =~ /^Content-(Length|Type)$/i; |
316bf0f0 |
39 | my @values = $c->response->header($name); |
40 | $c->apache->headers_out->add( $name => $_ ) for @values; |
41 | } |
42 | |
43 | if ( $c->response->header('Set-Cookie') && $c->response->status >= 300 ) { |
44 | my @values = $c->response->header('Set-Cookie'); |
45 | $c->apache->err_headers_out->add( 'Set-Cookie' => $_ ) for @values; |
46 | } |
47 | |
48 | $c->apache->status( $c->response->status ); |
566ee5d7 |
49 | |
50 | if ( my $type = $c->response->header('Content-Type') ) { |
51 | $c->apache->content_type($type); |
52 | } |
53 | |
54 | if ( my $length = $c->response->content_length ) { |
55 | $c->apache->set_content_length($length); |
56 | } |
316bf0f0 |
57 | |
58 | $c->apache->send_http_header; |
59 | |
60 | return 0; |
61 | } |
62 | |
63 | =item $c->handler |
64 | |
65 | =cut |
66 | |
67 | sub handler ($$) { |
68 | shift->SUPER::handler(@_); |
69 | } |
70 | |
71 | =back |
72 | |
73 | =head1 SEE ALSO |
74 | |
75 | L<Catalyst>, L<Catalyst::Engine>, L<Catalyst::Engine::Apache::Base>. |
76 | |
77 | =head1 AUTHOR |
78 | |
79 | Sebastian Riedel, C<sri@cpan.org> |
80 | Christian Hansen C<ch@ngmedia.com> |
81 | |
82 | =head1 COPYRIGHT |
83 | |
84 | This program is free software, you can redistribute it and/or modify it under |
85 | the same terms as Perl itself. |
86 | |
87 | =cut |
88 | |
89 | 1; |