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 <johannes.schindelin@gmx.de> Tested-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed May 9, 2016 at 07:59 UTC f1f2b45be0a2b205fc07758e0f4e9c13e90d34d9
1 file changed +12 -4
t/lib-httpd/apache.conf
+12 -4
@@ -102,10 +102,6 @@ Alias /auth/dumb/ www/auth/dumb/
102 Header set Set-Cookie name=value
103 </LocationMatch>
104 <LocationMatch /smart_headers/>
105 - <RequireAll>
106 - Require expr %{HTTP:x-magic-one} == 'abra'
107 - Require expr %{HTTP:x-magic-two} == 'cadabra'
108 - </RequireAll>
105 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
106 SetEnv GIT_HTTP_EXPORT_ALL
107 </LocationMatch>
@@ -135,6 +131,18 @@ RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]
131 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]
132 RewriteRule ^/loop-redir/(.*)$ /loop-redir/x-$1 [R=302]
133
134 +# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
135 +# And as RewriteCond does not allow testing for non-matches, we match
136 +# the desired case first (one has abra, two has cadabra), and let it
137 +# pass by marking the RewriteRule as [L], "last rule, do not process
138 +# any other matching RewriteRules after this"), and then have another
139 +# RewriteRule that matches all other cases and lets them fail via '[F]',
140 +# "fail the request".
141 +RewriteCond %{HTTP:x-magic-one} =abra
142 +RewriteCond %{HTTP:x-magic-two} =cadabra
143 +RewriteRule ^/smart_headers/.* - [L]
144 +RewriteRule ^/smart_headers/.* - [F]
145 +
146 <IfDefine SSL>
147 LoadModule ssl_module modules/mod_ssl.so
148