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