summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-02-24 22:10:17 -0800
committerJunio C Hamano <gitster@pobox.com>2015-02-24 22:10:17 -0800
commit8f3d03d81e124b102a29a4adeeec4b3473bfa8d6 (patch)
tree9e55f2945a57331a5a45b1f93046f69bf9c2e907
parent66061294915065375c7eaa4e3a72e4834590f32b (diff)
parent4dbe66464b4fd695c5989cc272fa0edd6475037c (diff)
downloadgit-8f3d03d81e124b102a29a4adeeec4b3473bfa8d6.tar.gz
Merge branch 'bc/http-fallback-to-password-after-krb-fails' into maint
After attempting and failing a password-less authentication (e.g. kerberos), libcURL refuses to fall back to password based Basic authentication without a bit of help/encouragement. * bc/http-fallback-to-password-after-krb-fails: remote-curl: fall back to Basic auth if Negotiate fails
-rw-r--r--http.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/http.c b/http.c
index 040f362a6a..44b130c54a 100644
--- a/http.c
+++ b/http.c
@@ -62,6 +62,9 @@ static const char *user_agent;
static struct credential cert_auth = CREDENTIAL_INIT;
static int ssl_cert_password_required;
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+static unsigned long http_auth_methods = CURLAUTH_ANY;
+#endif
static struct curl_slist *pragma_header;
static struct curl_slist *no_pragma_header;
@@ -580,6 +583,9 @@ struct active_request_slot *get_active_slot(void)
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+ curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
+#endif
if (http_auth.password)
init_curl_http_auth(slot->curl);
@@ -870,6 +876,9 @@ int handle_curl_result(struct slot_results *results)
credential_reject(&http_auth);
return HTTP_NOAUTH;
} else {
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+ http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
+#endif
return HTTP_REAUTH;
}
} else {
@@ -986,6 +995,7 @@ static void extract_content_type(struct strbuf *raw, struct strbuf *type,
strbuf_addstr(charset, "ISO-8859-1");
}
+
/* http_request() targets */
#define HTTP_REQUEST_STRBUF 0
#define HTTP_REQUEST_FILE 1