Apache::Constants->
import
(
':common'
);
sub
finalize_headers {
my
$c
=
shift
;
for
my
$name
(
$c
->response->headers->header_field_names ) {
next
if
$name
=~ /^Content-(Length|Type)$/i;
my
@values
=
$c
->response->header(
$name
);
$c
->apache->headers_out->add(
$name
=>
$_
)
for
@values
;
}
if
(
$c
->response->header(
'Set-Cookie'
) &&
$c
->response->status >= 300 ) {
my
@values
=
$c
->response->header(
'Set-Cookie'
);
$c
->apache->err_headers_out->add(
'Set-Cookie'
=>
$_
)
for
@values
;
}
$c
->apache->status(
$c
->response->status );
if
(
my
$type
=
$c
->response->header(
'Content-Type'
) ) {
$c
->apache->content_type(
$type
);
}
if
(
my
$length
=
$c
->response->content_length ) {
$c
->apache->set_content_length(
$length
);
}
$c
->apache->send_http_header;
return
0;
}
sub
handler ($$) {
shift
->SUPER::handler(
@_
);
}
1;