[PATCH v7 0/3] Add support for sending additional HTTP headers (part 2)
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 9, 2016, 06:18 UTC
- Message-ID
- <cover.1462774709.git.johannes.schindelin@gmx.de>
- In-Reply-To
- <cover.1462342213.git.johannes.schindelin@gmx.de>
My use case is an army of build agents that need only limited and selective access to otherwise private repositories.
The first part already made it into `master`, this is the remainder.
This iteration still has the specific patch to make `git -c http.extraHeader=... submodule update` work; I plan to keep only the test (and adjust the commit message) as soon as Peff's patch is applied that skips -c ... sanitizing for submodules.
Johannes Schindelin (3): tests: Adjust the configuration for Apache 2.2 t5551: make the test for extra HTTP headers more robust submodule: pass on http.extraheader config settings
builtin/submodule--helper.c | 3 ++- t/lib-httpd/apache.conf | 12 ++++++++---- t/t5551-http-fetch-smart.sh | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-)
Published-As: https://github.com/dscho/git/releases/tag/extra-http-headers-v7 Interdiff vs v6:
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index b8ed96f..29b34bb 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -103,10 +103,6 @@ Alias /auth/dumb/ www/auth/dumb/
Header set Set-Cookie name=value
</LocationMatch>
<LocationMatch /smart_headers/>
- <RequireAll>
- Require expr %{HTTP:x-magic-one} == 'abra'
- Require expr %{HTTP:x-magic-two} == 'cadabra'
- </RequireAll>
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
SetEnv GIT_HTTP_EXPORT_ALL
</LocationMatch>
@@ -136,6 +132,14 @@ RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]
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]
RewriteRule ^/loop-redir/(.*)$ /loop-redir/x-$1 [R=302]
+# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
+# And as RewriteCond unfortunately lacks "not equal" matching, we use this
+# ugly trick to fail *unless* the two headers are present.
+RewriteCond %{HTTP:x-magic-one} =abra
+RewriteCond %{HTTP:x-magic-two} =cadabra
+RewriteRule ^/smart_headers/.* - [L]
+RewriteRule ^/smart_headers/.* - [F]
+
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 1794168..2f375eb 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -283,7 +283,8 @@ test_expect_success EXPENSIVE 'http can handle enormous ref negotiation' '
'
test_expect_success 'custom http headers' '
- test_must_fail git fetch "$HTTPD_URL/smart_headers/repo.git" &&
+ test_must_fail git -c http.extraheader="x-magic-two: cadabra" \
+ fetch "$HTTPD_URL/smart_headers/repo.git" &&
git -c http.extraheader="x-magic-one: abra" \
-c http.extraheader="x-magic-two: cadabra" \
fetch "$HTTPD_URL/smart_headers/repo.git" &&-- 2.8.2.463.g99156ee