diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2020-04-18 20:54:57 -0700 |
---|---|---|
committer | Jonathan Nieder <jrnieder@gmail.com> | 2020-04-19 16:10:58 -0700 |
commit | e7fab62b736cca3416660636e46f0be8386a5030 (patch) | |
tree | d44b7bee236853dcc7f66a29340df9f4746f1b11 /t/t5550-http-fetch-dumb.sh | |
parent | c44088ecc4b0722636e0a305f9608d3047197282 (diff) | |
download | git-e7fab62b736cca3416660636e46f0be8386a5030.tar.gz |
credential: treat URL with empty scheme as invalid
Until "credential: refuse to operate when missing host or protocol",
Git's credential handling code interpreted URLs with empty scheme to
mean "give me credentials matching this host for any protocol".
Luckily libcurl does not recognize such URLs (it tries to look for a
protocol named "" and fails). Just in case that changes, let's reject
them within Git as well. This way, credential_from_url is guaranteed to
always produce a "struct credential" with protocol and host set.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 't/t5550-http-fetch-dumb.sh')
-rwxr-xr-x | t/t5550-http-fetch-dumb.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh index 517202e477..86f6eeaf71 100755 --- a/t/t5550-http-fetch-dumb.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -314,6 +314,15 @@ test_expect_success 'remote-http complains cleanly about malformed urls' ' test_i18ngrep "url has no scheme" stderr ' +# NEEDSWORK: Writing commands to git-remote-curl can race against the latter +# erroring out, producing SIGPIPE. Remove "ok=sigpipe" once transport-helper has +# learned to handle early remote helper failures more cleanly. +test_expect_success 'remote-http complains cleanly about empty scheme' ' + test_must_fail ok=sigpipe git ls-remote \ + http::${HTTPD_URL#http}/dumb/repo.git 2>stderr && + test_i18ngrep "url has no scheme" stderr +' + test_expect_success 'redirects can be forbidden/allowed' ' test_must_fail git -c http.followRedirects=false \ clone $HTTPD_URL/dumb-redir/repo.git dumb-redir && |