Skip to content

Commit 28d0c10

Browse files
peffgitster
authored andcommitted
remote-curl: don't retry auth failures with dumb protocol
When fetching an http URL, we first try fetching info/refs with an extra "service" parameter. This will work for a smart-http server, or a dumb server which ignores extra parameters when fetching files. If that fails, we retry without the extra parameter to remain compatible with dumb servers which didn't like our first request. If the server returned a "401 Unauthorized", indicating that the credentials we provided were not good, there is not much point in retrying. With the current code, we just waste an extra round trip to the HTTP server before failing. But as the http code becomes smarter about throwing away rejected credentials and re-prompting the user for new ones (which it will later in this series), this will become more confusing. At some point we will stop asking for credentials to retry smart http, and will be asking for credentials to retry dumb http. So now we're not only wasting an extra HTTP round trip for something that is unlikely to work, but we're making the user re-type their password for it. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5232586 commit 28d0c10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

remote-curl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static struct discovery* discover_refs(const char *service)
115115
http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);
116116

117117
/* try again with "plain" url (no ? or & appended) */
118-
if (http_ret != HTTP_OK) {
118+
if (http_ret != HTTP_OK && http_ret != HTTP_NOAUTH) {
119119
free(refs_url);
120120
strbuf_reset(&buffer);
121121

0 commit comments

Comments
 (0)