From fec3b27bc797824496201e61a0b554331c2cedd5 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 06:59:38 +0200 Subject: Bug 1446236 - Generate static error pages --- Bugzilla/Install/Filesystem.pm | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'Bugzilla/Install') diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 2f4beee4d..2333f18e4 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -115,6 +115,51 @@ sub HTTPD_ENV_CONF { return join( "\n", map { "PerlPassEnv " . $_ } @env ) . "\n"; } +sub _error_page { + my ($code, $title, $description) = @_; + my $host = Bugzilla->urlbase->host; + + return < + + + $title + + + + buggie +
+

$title

+

$description

+

Error $code

+

$host

+
+ + +EOT +} + ############### # Permissions # ############### @@ -429,6 +474,39 @@ sub FILESYSTEM { contents => \&HTTPD_ENV_CONF }, ); + # Create static error pages. + $create_files{"errors/401.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 401, 'Authentication Required', + "This server could not verify that you are authorized to access + that url. you either supplied the wrong credentials (e.g., bad + password), or your browser doesn't understand how to supply the + credentials required.") + }; + $create_files{"errors/403.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 403, 'Access Denied', + "Access to the requested resource has been denied.") + }; + $create_files{"errors/404.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 404, 'Object Not Found', + "The requested URL was not found on this server.") + }; + $create_files{"errors/500.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 500, 'Internal Server Error', + "The server encountered an internal error and was unable to complete your request.") + }; + # Because checksetup controls the creation of index.html separately # from all other files, it gets its very own hash. my %index_html = ( -- cgit v1.2.3-24-g4f1b