Created
April 30, 2015 14:33
-
-
Save moisseev/f27aaa9a771b3d66830e to your computer and use it in GitHub Desktop.
BackupPC CGI: Set 404 status code to HTTP header for all objects returned on error.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./lib/BackupPC/CGI/Lib.pm.orig 2015-04-30 16:04:21.000000000 +0300 | |
+++ ./lib/BackupPC/CGI/Lib.pm 2015-04-30 17:04:54.000000000 +0300 | |
@@ -289,7 +289,12 @@ | |
Trailer(); | |
} else { | |
my $content = eval("qq{$Lang->{Error____head}}"); | |
- Header(eval("qq{$Lang->{Error}}"), $content); | |
+ Header( | |
+ eval("qq{$Lang->{Error}}"), | |
+ $content, | |
+ (undef) x 3, | |
+ '404 Not Found' | |
+ ); | |
Trailer(); | |
} | |
exit(1); | |
@@ -435,7 +440,7 @@ | |
sub Header | |
{ | |
- my($title, $content, $noBrowse, $contentSub, $contentPost) = @_; | |
+ my($title, $content, $noBrowse, $contentSub, $contentPost, $status) = @_; | |
my @adminLinks = ( | |
{ link => "", name => $Lang->{Status}}, | |
{ link => "?action=summary", name => $Lang->{PC_Summary}}, | |
@@ -459,7 +464,7 @@ | |
my $host = $In{host}; | |
binmode(STDOUT, ":utf8"); | |
- print $Cgi->header(-charset => "utf-8"); | |
+ print $Cgi->header(-charset => "utf-8", -status=> $status); | |
print <<EOF; | |
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html><head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This patch in not against source code but against installed FreeBSD package backuppc-3.3.0_7.
404 status code for every error is stupid, but quick and easy.