summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-05-12 00:19:45 +0200
committerGitHub <noreply@github.com>2017-05-12 00:19:45 +0200
commit20c1dbebae25818af68e68b77b8e33b76720c3c4 (patch)
treec764842a6ff60f7ae8d01d376ee6c19c2b10549b
parente307b6a763947e4def6b1e2940d020047d269caa (diff)
downloadbugzilla-20c1dbebae25818af68e68b77b8e33b76720c3c4.tar.gz
bugzilla-20c1dbebae25818af68e68b77b8e33b76720c3c4.tar.xz
Bug 1363736 - Ensure http configs (.htaccess) are forward-compatible with newer versions of apache (#77)
-rw-r--r--Bugzilla/ModPerl.pm9
1 files changed, 9 insertions, 0 deletions
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;
}