Skip Menu |

This queue is for tickets about the AxKit CPAN distribution.

Report information
The Basics
Id: 20897
Status: new
Priority: 0/
Queue: AxKit

People
Owner: Nobody in particular
Requestors: mark [...] nctr.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
Subject: [rt.cpan.org #20897] AxKit::XSP::WebUtils->header() does not set outgoing Content-Type
Date: Sat, 12 Aug 2006 16:01:35 +0100
To: bug-AxKit [...] rt.cpan.org
From: Mark Charter <mark [...] nctr.co.uk>
Apache->content_type() returns the old value of the Content-Type, so my previous bug fix results in this old value (typically "changeme") being inserted into the body of the outgoing document. The following avoids this: sub header ($;$) { my $name = shift; my $r = AxKit::Apache->request; if (@_) { if ($name eq 'Content-Type') { $r->content_type($_[0]); return; } elsif ($name eq 'Content-Encoding') { return $r->content_encoding($_[0]); } else { return $r->header_out($name, $_[0]); } } else { return $r->header_in($name); } }