From 20c1dbebae25818af68e68b77b8e33b76720c3c4 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 11 May 2017 18:19:45 -0400 Subject: Bug 1363736 - Ensure http configs (.htaccess) are forward-compatible with newer versions of apache (#77) --- Bugzilla/ModPerl.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Bugzilla/ModPerl.pm') diff --git a/Bugzilla/ModPerl.pm b/Bugzilla/ModPerl.pm index 22be8e678..42048a5c5 100644 --- a/Bugzilla/ModPerl.pm +++ b/Bugzilla/ModPerl.pm @@ -50,6 +50,15 @@ sub apache_config { cgi_path => $cgi_path, ); $template->process(\*DATA, \%vars, \$conf); + my $apache_version = Apache2::ServerUtil::get_server_version(); + if ($apache_version =~ m!Apache/(\d+)\.(\d+)\.(\d+)!) { + my ($major, $minor, $patch) = ($1, $2, $3); + if ($major > 2 || $major == 2 && $minor >= 4) { + $conf =~ s{^\s+deny\s+from\s+all.*$}{Require all denied}gmi; + $conf =~ s{^\s+allow\s+from\s+all.*$}{Require all granted}gmi; + $conf =~ s{^\s+allow\s+from\s+(\S+).*$}{Require host $1}gmi; + } + } return $conf; } -- cgit v1.2.3-24-g4f1b