From b5454c3dd9c98c96de63862e784f249fbc3fb42d Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 11 Sep 2020 16:14:54 -0700 Subject: [PATCH] Girocco/CGI.pm: allow the output header to be suppressed When attempting to pre-format output pages, it's most inconvenient to have to strip off the response header(s). Provide a new function Girocco::CGI::enableHeader that can be called with a "false" value prior to calling the Girocco::CGI::new function that will suppress output of any response headers. Signed-off-by: Kyle J. McKay --- Girocco/CGI.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Girocco/CGI.pm b/Girocco/CGI.pm index 23713e2..79449b6 100644 --- a/Girocco/CGI.pm +++ b/Girocco/CGI.pm @@ -18,6 +18,9 @@ BEGIN { unless CGI->can("multi_param"); } +my $_suppress_header; +BEGIN {$_suppress_header = 0} + my @_randlens; my @_randchars; BEGIN { @@ -81,6 +84,10 @@ sub _vulnpad { return $vulnrandpad; } +sub enableHeader { + $_suppress_header = $_[0] ? 0 : 1; +} + sub new { my $class = shift; my ($heading, $section, $extraheadhtml, $sectionlink) = @_; @@ -100,7 +107,8 @@ sub new { ($gcgi->{srcname}) = ($cgiurl =~ m#^.*/\([a-zA-Z0-9_.\/-]+?\.cgi\)$#); # $gcgi->{srcname} = "cgi/".$gcgi->{srcname} if $gcgi->{srcname}; - print $gcgi->{cgi}->header(-type=>'text/html', -charset => 'utf-8'); + print $gcgi->{cgi}->header(-type=>'text/html', -charset => 'utf-8') + unless $_suppress_header; print < -- 2.11.4.GIT