# [RFH/PATCH 0/4] git http tests with apache 2.4

7 messages from 2013-06-09 to 2013-06-14. Participants: Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/34072

## Jeff King, 2013-06-09 08:07

Subject: [RFH/PATCH 0/4] git http tests with apache 2.4
Message-ID: <20130609080722.GA31699@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130609080722.GA31699%40sigill.intra.peff.net

```
Apache 2.4 recently shipped in Debian unstable, and I noticed that all
of the git httpd tests stopped working. It turns out that some
configuration directives have changed between 2.2 and 2.4, and the httpd
server would not start at all.

With this series, the tests run again (for me, at least). The
"<IfVersion>" checks hopefully mean that there are no regressions for
people running 2.2 and lower.

However, the final patch is very unsatisfactory. We have to pick an MPM
module to mention in the config, but we don't have any idea what's
available. I suspect what I have provided will work on most Unix-ish
systems. Under Windows, there is a totally different MPM. But I am not
sure that our http tests run at all on Windows, as we seem to check in
lib-httpd.sh for a Unix-ish apache module path.

As far as I know, Apache does not have a "try to load this module and
fallback" directive. We could perhaps look in the module directory and
try to do something clever in the shell before starting Apache. Advice
from Apache gurus is welcome.

  [1/4]: t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4
  [2/4]: t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
  [3/4]: t/lib-httpd/apache.conf: load compat access module in apache 2.4
  [4/4]: t/lib-httpd/apache.conf: configure an MPM module for apache 2.4

-Peff

```

## Jeff King, 2013-06-09 08:07

Subject: [PATCH 1/4] t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4
Message-ID: <20130609080759.GA32139@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130609080759.GA32139%40sigill.intra.peff.net
In-Reply-To: <20130609080722.GA31699@sigill.intra.peff.net>

```
The LockFile directive from earlier versions of apache has
been replaced by the Mutex directive. The latter seems to
give sane defaults and does not need any specific
customization, so we can get away with just adding a version
check to the use of LockFile.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index b5bce45..38699bb 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -1,5 +1,7 @@ LockFile accept.lock
 ServerName dummy
+<IfVersion < 2.4>
 LockFile accept.lock
+</IfVersion>
 PidFile httpd.pid
 DocumentRoot www
 LogFormat "%h %l %u %t \"%r\" %>s %b" common
-- 
1.8.3.rc2.14.g7eee6b3

```

## Jeff King, 2013-06-09 08:08

Subject: [PATCH 2/4] t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
Message-ID: <20130609080822.GB32139@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130609080822.GB32139%40sigill.intra.peff.net
In-Reply-To: <20130609080722.GA31699@sigill.intra.peff.net>

```
In apache 2.4, the "Auth*" and "Require" directives have
moved into the authn_core and authz_core modules,
respectively.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 38699bb..1d3615b 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -47,6 +47,15 @@ ErrorLog error.log
 </IfModule>
 </IfVersion>
 
+<IfVersion >= 2.4>
+<IfModule !mod_authn_core.c>
+	LoadModule authn_core_module modules/mod_authn_core.so
+</IfModule>
+<IfModule !mod_authz_core.c>
+	LoadModule authz_core_module modules/mod_authz_core.so
+</IfModule>
+</IfVersion>
+
 PassEnv GIT_VALGRIND
 PassEnv GIT_VALGRIND_OPTIONS
 
-- 
1.8.3.rc2.14.g7eee6b3

```

## Jeff King, 2013-06-09 08:08

Subject: [PATCH 3/4] t/lib-httpd/apache.conf: load compat access module in apache 2.4
Message-ID: <20130609080845.GC32139@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130609080845.GC32139%40sigill.intra.peff.net
In-Reply-To: <20130609080722.GA31699@sigill.intra.peff.net>

```
In apache 2.4, the "Order" directive has gone away in favor
of a new system in mod_authz_host. However, since we want
our config file to remain compatible across multiple Apache
versions, we can use mod_access_compat to keep using the
older style.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 1d3615b..4883b8c 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -54,6 +54,9 @@ ErrorLog error.log
 <IfModule !mod_authz_core.c>
 	LoadModule authz_core_module modules/mod_authz_core.so
 </IfModule>
+<IfModule !mod_access_compat.c>
+	LoadModule access_compat_module modules/mod_access_compat.so
+</IfModule>
 </IfVersion>
 
 PassEnv GIT_VALGRIND
-- 
1.8.3.rc2.14.g7eee6b3

```

## Jeff King, 2013-06-09 08:09

Subject: [PATCH 4/4] t/lib-httpd/apache.conf: configure an MPM module for apache 2.4
Message-ID: <20130609080932.GD32139@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130609080932.GD32139%40sigill.intra.peff.net
In-Reply-To: <20130609080722.GA31699@sigill.intra.peff.net>

```
Versions of Apache before 2.4 always had a "MultiProcessing
Module" (MPM) statically built in, which manages the worker
threads/processes. We do not care which one, as it is
largely a performance issue, and we put only a light load on
the server during our testing.

As of Apache 2.4, the MPM module is loadable just like any
other module, but exactly one such module must be loaded. On
a system where the MPMs are compiled dynamically (e.g.,
Debian unstable), this means that our test Apache server
will not start unless we provide the appropriate
configuration.

Unfortunately, we do not actually know which MPM modules are
available or appropriate for the system on which the tests
are running. This patch picks the "prefork" module, as it
is likely to be available on all Unix-like systems.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 4883b8c..56ae548 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -57,6 +57,9 @@ ErrorLog error.log
 <IfModule !mod_access_compat.c>
 	LoadModule access_compat_module modules/mod_access_compat.so
 </IfModule>
+<IfModule !mod_mpm_prefork.c>
+	LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
+</IfModule>
 </IfVersion>
 
 PassEnv GIT_VALGRIND
-- 
1.8.3.rc2.14.g7eee6b3

```

## Junio C Hamano, 2013-06-14 17:32

Subject: Re: [RFH/PATCH 0/4] git http tests with apache 2.4
Message-ID: <7v61xgpph2.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v61xgpph2.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20130609080722.GA31699@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> Apache 2.4 recently shipped in Debian unstable, and I noticed that all
> of the git httpd tests stopped working. It turns out that some
> configuration directives have changed between 2.2 and 2.4, and the httpd
> server would not start at all.
>
> With this series, the tests run again (for me, at least). The
> "<IfVersion>" checks hopefully mean that there are no regressions for
> people running 2.2 and lower.
>
> However, the final patch is very unsatisfactory. We have to pick an MPM
> module to mention in the config, but we don't have any idea what's
> available. I suspect what I have provided will work on most Unix-ish
> systems. Under Windows, there is a totally different MPM. But I am not
> sure that our http tests run at all on Windows, as we seem to check in
> lib-httpd.sh for a Unix-ish apache module path.

Thanks.  I think the final one, while it may be unsatisfactory, is a
reasonable (or "least bad") compromise, at least for now.  I do not
think of a better way, without adding "if you want customization,
write a snippet to be included in the configuration used during the
test", which feels way overkill.
>
> As far as I know, Apache does not have a "try to load this module and
> fallback" directive. We could perhaps look in the module directory and
> try to do something clever in the shell before starting Apache. Advice
> from Apache gurus is welcome.
>
>   [1/4]: t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4
>   [2/4]: t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
>   [3/4]: t/lib-httpd/apache.conf: load compat access module in apache 2.4
>   [4/4]: t/lib-httpd/apache.conf: configure an MPM module for apache 2.4
>
> -Peff

```

## Jeff King, 2013-06-14 21:58

Subject: Re: [RFH/PATCH 0/4] git http tests with apache 2.4
Message-ID: <20130614215801.GC29138@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130614215801.GC29138%40sigill.intra.peff.net
In-Reply-To: <7v61xgpph2.fsf@alter.siamese.dyndns.org>

```
On Fri, Jun 14, 2013 at 10:32:57AM -0700, Junio C Hamano wrote:

> > However, the final patch is very unsatisfactory. We have to pick an MPM
> > module to mention in the config, but we don't have any idea what's
> > available. I suspect what I have provided will work on most Unix-ish
> > systems. Under Windows, there is a totally different MPM. But I am not
> > sure that our http tests run at all on Windows, as we seem to check in
> > lib-httpd.sh for a Unix-ish apache module path.
> 
> Thanks.  I think the final one, while it may be unsatisfactory, is a
> reasonable (or "least bad") compromise, at least for now.  I do not
> think of a better way, without adding "if you want customization,
> write a snippet to be included in the configuration used during the
> test", which feels way overkill.

Yeah, we may have to go there. My feeling on it (and why I posted it
as-is) is that it improves the situation for some people, and should be
no worse for anyone else. Therefore people who are on 2.4 and are still
broken after this series can speak up and show us the exact breakage and
fix they need without us having to guess.

-Peff

```
