summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-11-08 11:37:25 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-11-08 11:37:26 -0800
commite5becd042f821ac0a38077460a5fe816876a6504 (patch)
tree89523b0a33ee1700b7d2ecc5f421f441418732c2 /t
parentStart preparing for 1.8.4.3 (diff)
parenthttp.c: Spell the null pointer as NULL (diff)
downloadtgif-e5becd042f821ac0a38077460a5fe816876a6504.tar.xz
Merge branch 'jk/http-auth-redirects' into maint
We did not handle cases where http transport gets redirected during the authorization request (e.g. from http:// to https://). * jk/http-auth-redirects: http.c: Spell the null pointer as NULL remote-curl: rewrite base url from info/refs redirects remote-curl: store url as a strbuf remote-curl: make refs_url a strbuf http: update base URLs when we see redirects http: provide effective url to callers http: hoist credential request out of handle_curl_result http: refactor options to http_get_* http_request: factor out curlinfo_strbuf http_get_file: style fixes
Diffstat (limited to 't')
-rw-r--r--t/lib-httpd.sh3
-rw-r--r--t/lib-httpd/apache.conf2
-rwxr-xr-xt/t5551-http-fetch.sh11
3 files changed, 15 insertions, 1 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 895b9258b0..7059cc6c21 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -187,7 +187,8 @@ set_askpass() {
}
expect_askpass() {
- dest=$HTTPD_DEST
+ dest=$HTTPD_DEST${3+/$3}
+
{
case "$1" in
none)
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index dd17e3a09d..4a261f13f5 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -102,6 +102,8 @@ ScriptAlias /broken_smart/ broken-smart-http.sh/
RewriteEngine on
RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]
RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]
+RewriteRule ^/smart-redir-auth/(.*)$ /auth/smart/$1 [R=301]
+RewriteRule ^/smart-redir-limited/(.*)/info/refs$ /smart/$1/info/refs [R=301]
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index 55a866af80..1b71bb5156 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -113,6 +113,10 @@ test_expect_success 'follow redirects (302)' '
git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t
'
+test_expect_success 'redirects re-root further requests' '
+ git clone $HTTPD_URL/smart-redir-limited/repo.git repo-redir-limited
+'
+
test_expect_success 'clone from password-protected repository' '
echo two >expect &&
set_askpass user@host &&
@@ -146,6 +150,13 @@ test_expect_success 'no-op half-auth fetch does not require a password' '
expect_askpass none
'
+test_expect_success 'redirects send auth to new location' '
+ set_askpass user@host &&
+ git -c credential.useHttpPath=true \
+ clone $HTTPD_URL/smart-redir-auth/repo.git repo-redir-auth &&
+ expect_askpass both user@host auth/smart/repo.git
+'
+
test_expect_success 'disable dumb http on server' '
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
config http.getanyfile false