git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/4] http: extract http_reauth_prepare() from retry paths

From
Matthew John Cheetham via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 30, 2026, 10:54 UTC
Message-ID
<49488cc7d44404b9af55859dd892427bc8ee9142.1777546472.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2087.v2.git.1777546472.gitgitgadget@gmail.com>
From: Matthew John Cheetham <mjcheetham@outlook.com>

All three HTTP retry paths (http_request_recoverable, post_rpc, probe_rpc) call credential_fill() directly when handling HTTP_REAUTH. Extract this into a helper function so that a subsequent commit can add pre-fill logic (such as attempting empty-auth before prompting) in one place.

No functional change.
Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
---
 http.c        | 7 ++++++-
 http.h        | 6 ++++++
 remote-curl.c | 4 ++--
 3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/http.c b/http.c
index d8d016891b..f208e0ad82 100644
--- a/http.c
+++ b/http.c
@@ -665,6 +665,11 @@ static void init_curl_http_auth(CURL *result)
 	}
 }
 
+void http_reauth_prepare(int all_capabilities)
+{
+	credential_fill(the_repository, &http_auth, all_capabilities);
+}
+
 /* *var must be free-able */
 static void var_override(char **var, char *value)
 {
@@ -2398,7 +2403,7 @@ static int http_request_recoverable(const char *url,
 				sleep(retry_delay);
 			}
 		} else if (ret == HTTP_REAUTH) {
-			credential_fill(the_repository, &http_auth, 1);
+			http_reauth_prepare(1);
 		}
 
 		ret = http_request(url, result, target, options);
diff --git a/http.h b/http.h
index f9ee888c3e..729c51904d 100644
--- a/http.h
+++ b/http.h
@@ -76,6 +76,12 @@ extern int http_is_verbose;
 extern ssize_t http_post_buffer;
 extern struct credential http_auth;
 
+/**
+ * Prepare for an HTTP re-authentication retry. This fills credentials
+ * via credential_fill() so the next request can include them.
+ */
+void http_reauth_prepare(int all_capabilities);
+
 extern char curl_errorstr[CURL_ERROR_SIZE];
 
 enum http_follow_config {
diff --git a/remote-curl.c b/remote-curl.c
index aba60d5712..affdb880f7 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -946,7 +946,7 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
 		do {
 			err = probe_rpc(rpc, &results);
 			if (err == HTTP_REAUTH)
-				credential_fill(the_repository, &http_auth, 0);
+				http_reauth_prepare(0);
 		} while (err == HTTP_REAUTH);
 		if (err != HTTP_OK)
 			return -1;
@@ -1068,7 +1068,7 @@ retry:
 	rpc->any_written = 0;
 	err = run_slot(slot, NULL);
 	if (err == HTTP_REAUTH && !large_request) {
-		credential_fill(the_repository, &http_auth, 0);
+		http_reauth_prepare(0);
 		curl_slist_free_all(headers);
 		goto retry;
 	}
-- 
gitgitgadget
Previous: Matthew John Cheetham via GitGitGadgetNext: Matthew John Cheetham via GitGitGadget
Message 9 of 13 in “http: fix emptyAuth=auto for Negotiate/SPNEGO”
  1. 0/3 http: fix emptyAuth=auto for Negotiate/SPNEGOMatthew John Cheetham via GitGitGadget, Apr 16, 2026
  2. 1/3 http: extract http_reauth_prepare() from retry pathsMatthew John Cheetham via GitGitGadget, Apr 16, 2026
  3. Junio C HamanoApr 16, 2026
  4. 2/3 http: attempt Negotiate auth in http.emptyAuth=auto modeMatthew John Cheetham via GitGitGadget, Apr 16, 2026
  5. Junio C HamanoApr 16, 2026
  6. Matthew John CheethamApr 28, 2026
  7. 3/3 t5563: add tests for http.emptyAuth with NegotiateMatthew John Cheetham via GitGitGadget, Apr 16, 2026
  8. 0/4 http: fix emptyAuth=auto for Negotiate/SPNEGOMatthew John Cheetham via GitGitGadget, Apr 30, 2026
  9. 1/4 http: extract http_reauth_prepare() from retry pathsMatthew John Cheetham via GitGitGadget, Apr 30, 2026
  10. 2/4 http: attempt Negotiate auth in http.emptyAuth=auto modeMatthew John Cheetham via GitGitGadget, Apr 30, 2026
  11. 3/4 t5563: add tests for http.emptyAuth with NegotiateMatthew John Cheetham via GitGitGadget, Apr 30, 2026
  12. 4/4 doc: clarify http.emptyAuth valuesMatthew John Cheetham via GitGitGadget, Apr 30, 2026
  13. Matthew John CheethamApr 30, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.