Browse Source

Bug 3239 - Content-Script-Type and Content-Style-Type

This adds headers to define the default script and style languages.
Please note that this output isn't 100% canonical from CGI yet, but
that is due to a bug in CGI:
  http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3243

So either CGI will perfect it's output, or we can switch to using
HTTP::Headers.  The latter may be desirable anyway, since then we
would not need a CGI $query argument at all.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
3.2.x
Joe Atzberger 15 years ago
committed by Galen Charlton
parent
commit
70c6a9fdf3
  1. 38
      C4/Output.pm

38
C4/Output.pm

@ -373,37 +373,29 @@ sub output_with_http_headers($$$$;$) {
my %content_type_map = (
'html' => 'text/html',
'js' => 'text/javascript',
'js' => 'text/javascript',
'json' => 'application/json',
'xml' => 'text/xml',
'xml' => 'text/xml',
# NOTE: not using application/atom+xml or application/rss+xml because of
# Internet Explorer 6; see bug 2078.
'rss' => 'text/xml',
'rss' => 'text/xml',
'atom' => 'text/xml'
);
die "Unknown content type '$content_type'" if ( !defined( $content_type_map{$content_type} ) );
if ($cookie) {
print $query->header(
-type => $content_type_map{$content_type},
-status => $status,
-charset => 'UTF-8',
-cookie => $cookie,
-Pragma => 'no-cache',
-'Cache-Control' => 'no-cache',
);
} else {
print $query->header(
-type => $content_type_map{$content_type},
-status => $status,
-charset => 'UTF-8',
-Pragma => 'no-cache',
-'Cache-Control' => 'no-cache',
);
my $options = {
type => $content_type_map{$content_type},
status => $status,
charset => 'UTF-8',
Pragma => 'no-cache',
'Cache-Control' => 'no-cache',
};
$options->{cookie} = $cookie if $cookie;
if ($content_type eq 'html') { # guaranteed to be one of the content_type_map keys, else we'd have died
$options->{'Content-Style-Type' } = 'text/css';
$options->{'Content-Script-Type'} = 'text/javascript';
}
print $data;
print $query->header($options), $data;
}
sub output_html_with_http_headers ($$$) {

Loading…
Cancel
Save