Skip to content

Commit edd060d

Browse files
peffgitster
authored andcommitted
t/lib-httpd: bump required apache version to 2.4
Apache 2.4 has been out since early 2012, almost 11 years. And its predecessor, 2.2, has been out of support since its last release in 2017, over 5 years ago. The last mention on the mailing list was from around the same time, in this thread: https://lore.kernel.org/git/[email protected]/ We can probably assume that 2.4 is available everywhere. And the stakes are fairly low, as the worst case is that such a platform would skip the http tests. This lets us clean up a few minor version checks in the config file, but also revert f1f2b45 (tests: adjust the configuration for Apache 2.2, 2016-05-09). Its technique isn't _too_ bad, but certainly required a bit more explanation than the 2.4 version it replaced. I manually confirmed that the test in t5551 still behaves as expected (if you replace "cadabra" with "foo", the server correctly rejects the request). It will also help future patches which will no longer have to deal with conditional config for this old version. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d762617 commit edd060d

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

t/lib-httpd.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ then
108108
if test -z "$LIB_HTTPD_MODULE_PATH"
109109
then
110110
if ! test "$HTTPD_VERSION_MAJOR" -eq 2 ||
111-
! test "$HTTPD_VERSION_MINOR" -ge 2
111+
! test "$HTTPD_VERSION_MINOR" -ge 4
112112
then
113113
test_skip_or_die GIT_TEST_HTTPD \
114-
"at least Apache version 2.2 is required"
114+
"at least Apache version 2.4 is required"
115115
fi
116116
if ! test -d "$DEFAULT_HTTPD_MODULE_PATH"
117117
then

t/lib-httpd/apache.conf

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ LoadModule http2_module modules/mod_http2.so
3434
Protocols h2c
3535
</IfDefine>
3636

37-
<IfVersion < 2.4>
38-
LockFile accept.lock
39-
</IfVersion>
40-
4137
<IfModule !mod_auth_basic.c>
4238
LoadModule auth_basic_module modules/mod_auth_basic.so
4339
</IfModule>
@@ -51,7 +47,6 @@ LockFile accept.lock
5147
LoadModule authz_host_module modules/mod_authz_host.so
5248
</IfModule>
5349

54-
<IfVersion >= 2.4>
5550
<IfModule !mod_authn_core.c>
5651
LoadModule authn_core_module modules/mod_authn_core.so
5752
</IfModule>
@@ -75,7 +70,6 @@ LockFile accept.lock
7570
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
7671
</IfModule>
7772
</IfDefine>
78-
</IfVersion>
7973

8074
PassEnv GIT_VALGRIND
8175
PassEnv GIT_VALGRIND_OPTIONS
@@ -115,6 +109,10 @@ Alias /auth/dumb/ www/auth/dumb/
115109
Header set Set-Cookie name=value
116110
</LocationMatch>
117111
<LocationMatch /smart_headers/>
112+
<RequireAll>
113+
Require expr %{HTTP:x-magic-one} == 'abra'
114+
Require expr %{HTTP:x-magic-two} == 'cadabra'
115+
</RequireAll>
118116
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
119117
SetEnv GIT_HTTP_EXPORT_ALL
120118
</LocationMatch>
@@ -197,18 +195,6 @@ RewriteRule ^/intern-redir/(.*)/foo$ /smart/$1 [PT]
197195
RewriteRule ^/redir-objects/(.*/info/refs)$ /dumb/$1 [PT]
198196
RewriteRule ^/redir-objects/(.*/objects/.*)$ /dumb/$1 [R=301]
199197

200-
# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
201-
# And as RewriteCond does not allow testing for non-matches, we match
202-
# the desired case first (one has abra, two has cadabra), and let it
203-
# pass by marking the RewriteRule as [L], "last rule, do not process
204-
# any other matching RewriteRules after this"), and then have another
205-
# RewriteRule that matches all other cases and lets them fail via '[F]',
206-
# "fail the request".
207-
RewriteCond %{HTTP:x-magic-one} =abra
208-
RewriteCond %{HTTP:x-magic-two} =cadabra
209-
RewriteRule ^/smart_headers/.* - [L]
210-
RewriteRule ^/smart_headers/.* - [F]
211-
212198
<IfDefine SSL>
213199
LoadModule ssl_module modules/mod_ssl.so
214200

0 commit comments

Comments
 (0)