diff options
author | Christopher Schenk <christopher@cschenk.net> | 2021-03-22 11:51:16 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-22 11:55:41 -0700 |
commit | 1b0d9545bb85912a16b367229d414f55d140d3be (patch) | |
tree | 57b13a12ef18e90ee0fcb6b1e0251f2128ed6767 | |
parent | The first batch in 2.32 cycle (diff) | |
download | tgif-1b0d9545bb85912a16b367229d414f55d140d3be.tar.xz |
remote-curl: fall back to basic auth if Negotiate fails
When the username and password are supplied in a url like this
https://myuser:secret@git.exampe/myrepo.git and the server supports the
negotiate authenticaten method, git does not fall back to basic auth and
libcurl hardly tries to authenticate with the negotiate method.
Stop using the Negotiate authentication method after the first failure
because if it fails on the first try it will never succeed.
Signed-off-by: Christopher Schenk <christopher@cschenk.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | http.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1641,17 +1641,18 @@ static int handle_curl_result(struct slot_results *results) } else if (missing_target(results)) return HTTP_MISSING_TARGET; else if (results->http_code == 401) { +#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY + http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE; + if (results->auth_avail) { + http_auth_methods &= results->auth_avail; + http_auth_methods_restricted = 1; + return HTTP_REAUTH; + } +#endif if (http_auth.username && http_auth.password) { credential_reject(&http_auth); return HTTP_NOAUTH; } else { -#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY - http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE; - if (results->auth_avail) { - http_auth_methods &= results->auth_avail; - http_auth_methods_restricted = 1; - } -#endif return HTTP_REAUTH; } } else { |