Skip to content

Commit ee3ec6c

Browse files
committed
tests: adjust the configuration for Apache 2.2
Lars Schneider noticed that the configuration introduced to test the extra HTTP headers cannot be used with Apache 2.2 (which is still actively maintained, as pointed out by Junio Hamano). To let the tests pass with Apache 2.2 again, let's substitute the offending <RequireAll> and `expr` by using old school RewriteCond statements. As RewriteCond does not allow testing for *non*-matches, we simply match the desired case first and let it pass by marking the RewriteRule as '[L]' ("last rule, do not process any other matching RewriteRules after this"), and then have another RewriteRule that matches all other cases and lets them fail via '[F]' ("fail"). Signed-off-by: Johannes Schindelin <[email protected]> Tested-by: Lars Schneider <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 00090c8 commit ee3ec6c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

t/lib-httpd/apache.conf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ Alias /auth/dumb/ www/auth/dumb/
103103
Header set Set-Cookie name=value
104104
</LocationMatch>
105105
<LocationMatch /smart_headers/>
106-
<RequireAll>
107-
Require expr %{HTTP:x-magic-one} == 'abra'
108-
Require expr %{HTTP:x-magic-two} == 'cadabra'
109-
</RequireAll>
110106
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
111107
SetEnv GIT_HTTP_EXPORT_ALL
112108
</LocationMatch>
@@ -136,6 +132,18 @@ RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]
136132
RewriteRule ^/loop-redir/x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-(.*) /$1 [R=302]
137133
RewriteRule ^/loop-redir/(.*)$ /loop-redir/x-$1 [R=302]
138134

135+
# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
136+
# And as RewriteCond does not allow testing for non-matches, we match
137+
# the desired case first (one has abra, two has cadabra), and let it
138+
# pass by marking the RewriteRule as [L], "last rule, do not process
139+
# any other matching RewriteRules after this"), and then have another
140+
# RewriteRule that matches all other cases and lets them fail via '[F]',
141+
# "fail the request".
142+
RewriteCond %{HTTP:x-magic-one} =abra
143+
RewriteCond %{HTTP:x-magic-two} =cadabra
144+
RewriteRule ^/smart_headers/.* - [L]
145+
RewriteRule ^/smart_headers/.* - [F]
146+
139147
<IfDefine SSL>
140148
LoadModule ssl_module modules/mod_ssl.so
141149

0 commit comments

Comments
 (0)