diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-10-30 12:09:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-10-30 12:09:53 -0700 |
commit | 177f0a400955f2345c73a5c8b0459d617429ffd9 (patch) | |
tree | befe6d8d3e767c1dc6bc06b3a8557d44a5faaefe /t | |
parent | 0d6cf2471f426dd2b742e2285aad78381738be96 (diff) | |
parent | 70900eda4a0ed473ab5a933940285ac3dda698c0 (diff) | |
download | git-177f0a400955f2345c73a5c8b0459d617429ffd9.tar.gz git-177f0a400955f2345c73a5c8b0459d617429ffd9.tar.xz |
Merge branch 'jk/http-auth-redirects'
Handle the case where http transport gets redirected during the
authorization request better.
* 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.sh | 3 | ||||
-rw-r--r-- | t/lib-httpd/apache.conf | 2 | ||||
-rwxr-xr-x | t/t5551-http-fetch.sh | 11 |
3 files changed, 15 insertions, 1 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index 54dbbfe5c..ad8f1ef71 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -204,7 +204,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 397c48040..3a03e8263 100644 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@ -110,6 +110,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 8196af19f..fb16833f7 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 |