]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
header.pl: Allow passing more HTTP headers to showhttpheaders()
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Apr 2024 15:34:28 +0000 (17:34 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Apr 2024 15:34:28 +0000 (17:34 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/header.pl

index f61c5f7316aeb63721dec9d715cfb23ab06a8fd2..33aab68258129031d2271cb651894cefcecbfcf9 100644 (file)
@@ -496,10 +496,24 @@ sub genmenu {
   }
 }
 
-sub showhttpheaders
-{
-       print "Cache-control: private\n";
-       print "Content-type: text/html; charset=UTF-8\n\n";
+sub showhttpheaders($) {
+       my $overwrites = shift;
+
+       my %headers = (
+               "Content-Type"  => "text/html; charset=UTF-8",
+               "Cache-Control" => "private",
+
+               # Overwrite anything passed
+               %$overwrites,
+       );
+
+       # Print all headers
+       foreach my $header (keys %headers) {
+               print "$header: $headers{$header}\n";
+       }
+
+       # End headers
+       print "\n";
 }
 
 sub is_menu_visible($) {