summaryrefslogtreecommitdiff
path: root/lib/CGI.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CGI.pm')
-rw-r--r--lib/CGI.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CGI.pm b/lib/CGI.pm
index e93efc08d4..025c83f0df 100644
--- a/lib/CGI.pm
+++ b/lib/CGI.pm
@@ -1435,7 +1435,11 @@ sub header {
($_ = $header) =~ s/^(\w)(.*)/"\u$1\L$2" . ': '.$self->unescapeHTML($value)/e;
}
- $type .= "; charset=$charset" if $type ne '' and $type !~ /\bcharset\b/ and $charset ne '';
+ $type .= "; charset=$charset"
+ if $type ne ''
+ and $type !~ /\bcharset\b/
+ and defined $charset
+ and $charset ne '';
# Maybe future compatibility. Maybe not.
my $protocol = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0';