summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-04-10 11:53:40 +0200
committerJunio C Hamano <gitster@pobox.com>2012-04-10 09:12:13 -0700
commitdfa1725a3ec57098637b698ffc2b2e2459acc518 (patch)
treecd60c4d5053081b20956bc14158b402ec60028c6 /http.c
parent5a9681f46aa9e152f32e76d7ade9d4c11313f99a (diff)
downloadgit-dfa1725a3ec57098637b698ffc2b2e2459acc518.tar.gz
fix http auth with multiple curl handles
HTTP authentication is currently handled by get_refs and fetch_ref, but not by fetch_object, fetch_pack or fetch_alternates. In the single-threaded case, this is not an issue, since get_refs is always called first. It recognigzes the 401 and prompts the user for credentials, which will then be used subsequently. If the curl multi interface is used, however, only the multi handle used by get_refs will have credentials configured. Requests made by other handles fail with an authentication error. Fix this by setting CURLOPT_USERPWD whenever a slot is requested. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/http.c b/http.c
index f3f83d70cd..c6dc9b778e 100644
--- a/http.c
+++ b/http.c
@@ -494,6 +494,8 @@ struct active_request_slot *get_active_slot(void)
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
+ if (http_auth.password)
+ init_curl_http_auth(slot->curl);
return slot;
}