Skip to content

Commit 475db39

Browse files
committed
ignore unsupported http authentication schemes
auth_context_match returns 0 instead of -1 for unknown schemes to not fail in situations where some authentication schemes are supported and others are not. apply_credentials is adjusted to handle auth_context_match returning 0 without producing authentication context.
1 parent a8d447f commit 475db39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/transports/http.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int auth_context_match(
142142
}
143143

144144
if (!scheme)
145-
return -1;
145+
return 0;
146146

147147
/* See if authentication has already started for this scheme */
148148
git_vector_foreach(&t->auth_contexts, i, c) {
@@ -188,6 +188,9 @@ static int apply_credentials(git_buf *buf, http_subtransport *t)
188188
if (auth_context_match(&context, t, credtype_match, &cred->credtype) < 0)
189189
return -1;
190190

191+
if (!context)
192+
return 0;
193+
191194
return context->next_token(buf, context, cred);
192195
}
193196

0 commit comments

Comments
 (0)