]> 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>
Sat, 27 Apr 2024 17:28:25 +0000 (19:28 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/header.pl

index 5164e9731b4057bceb30cc8f9ba93409cae33e34..99ec7a6bfa753559a57800b8d0cd5734de6d74b1 100644 (file)
@@ -232,10 +232,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($) {