Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [Andy] change HTTP Response Header: Edit Log

Here is the list of edits for this post
Re: [Andy] change HTTP Response Header
Hi Andy,

changing e.g.

Code:
sub generate_home_page {
# --------------------------------------------------------
# Display the home page.
#
print $IN->header();
print Links::Build::build(home => {});
}

to

Code:
sub generate_home_page {
# --------------------------------------------------------
# Display the home page.
#
print $IN->header(-charset => $CFG->{header_charset});
print Links::Build::build(home => {});
}

works.
Your Dumper hint showed me that I have been hanging around in the wrong sub. I should have been to ./admin/GT/CGI.pm

Code:
# Add the Content-type header.
my $type = @_ == 1 && !ref($_[0]) ? $_[0] : delete($p{-type}) || 'text/html';
my $charset = delete $p{-charset};
if ($charset and $type =~ /^text\// and $type !~ /\bcharset\b/) {
$type .= "; charset=$charset";
}
#++ start new code
# had to use plain text charset because $CFG->{header_charset}
# is not yet defined as far as I can see
elsif ($type =~ /^text\// and $type !~ /\bcharset\b/) {
$type .= "; charset=windows-1252";
}
#++ end new code
push @headers, "Content-type: $type";
This looked more familiar. Now I still cannot remember what I did, but the above works. Not sure if I can cause trouble with that approach.
The first approach seems a little cleaner and maybe the way GT would have taken for an improvement.
What do you think?

Thanks and get well soon!

Niko

Last edited by:

el noe: Oct 10, 2016, 8:54 AM

Edit Log: