diff options
-rw-r--r-- | http.c | 6 | ||||
-rw-r--r-- | http.h | 1 | ||||
-rw-r--r-- | remote-curl.c | 7 |
3 files changed, 11 insertions, 3 deletions
@@ -45,7 +45,7 @@ static long curl_low_speed_time = -1; static int curl_ftp_no_epsv; static const char *curl_http_proxy; static const char *curl_cookie_file; -static struct credential http_auth = CREDENTIAL_INIT; +struct credential http_auth = CREDENTIAL_INIT; static int http_proactive_auth; static const char *user_agent; @@ -806,7 +806,6 @@ int handle_curl_result(struct slot_results *results) credential_reject(&http_auth); return HTTP_NOAUTH; } else { - credential_fill(&http_auth); return HTTP_REAUTH; } } else { @@ -924,6 +923,9 @@ static int http_request_reauth(const char *url, die("BUG: HTTP_KEEP_ERROR is only supported with strbufs"); } } + + credential_fill(&http_auth); + return http_request(url, result, target, options); } @@ -102,6 +102,7 @@ extern void http_cleanup(void); extern int active_requests; extern int http_is_verbose; extern size_t http_post_buffer; +extern struct credential http_auth; extern char curl_errorstr[CURL_ERROR_SIZE]; diff --git a/remote-curl.c b/remote-curl.c index ed1499b62c..8ffd7ff7a7 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -8,6 +8,7 @@ #include "pkt-line.h" #include "sideband.h" #include "argv-array.h" +#include "credential.h" static struct remote *remote; static const char *url; /* always ends with a trailing slash */ @@ -449,6 +450,8 @@ static int post_rpc(struct rpc_state *rpc) if (large_request) { do { err = probe_rpc(rpc); + if (err == HTTP_REAUTH) + credential_fill(&http_auth); } while (err == HTTP_REAUTH); if (err != HTTP_OK) return -1; @@ -548,8 +551,10 @@ retry: curl_easy_setopt(slot->curl, CURLOPT_FILE, rpc); err = run_slot(slot); - if (err == HTTP_REAUTH && !large_request) + if (err == HTTP_REAUTH && !large_request) { + credential_fill(&http_auth); goto retry; + } if (err != HTTP_OK) err = -1; |