Subject: | AxKit::XSP::WebUtils->header() does not set outgoing Content-Type |
Date: | Tue, 8 Aug 2006 17:21:08 +0100 |
To: | bug-AxKit [...] rt.cpan.org |
From: | Mark Charter <mark [...] nctr.co.uk> |
AxKit::XSP::WebUtils->header() uses the Apache->header_out()
function to set all outgoing headers, but the Apache documentation
states that "Content-XXX" headers should not be set with this method,
but should be set with the specific content_type(), content_encoding()
or content_languages() methods.
So replacing
sub header ($;$) {
my $name = shift;
my $r = AxKit::Apache->request;
if (@_) {
return $r->header_out($name, $_[0]);
}
else {
return $r->header_in($name);
}
}
in WebUtils.pm with
sub header ($;$) {
my $name = shift;
my $r = AxKit::Apache->request;
if (@_) {
if ($name eq 'Content-Type') {
return $r->content_type($_[0]);
}
elsif ($name eq 'Content-Encoding') {
return $r->content_encoding($_[0]);
}
else {
return $r->header_out($name, $_[0]);
}
}
else {
return $r->header_in($name);
}
}
fixes the problem for Content-Type and Content-Encoding.
--
Mark Charter, Tel: +44 (0) 1223 312562
Non-Cooperative Target Recognition Ltd., Mobile: +44 (0) 7818 414351
20 Cockcroft Place,
CAMBRIDGE E-mail: mark@nctr.co.uk
CB3 0HF WWW: http://www.nctr.co.uk
United Kingdom