Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4cba9d

Browse files
committed
winhttp: retry authentication
If the caller has provided bad authentication, give them another apportunity to get it right until they give up. This brings WinHTTP in line with the other transports.
1 parent 2520573 commit a4cba9d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/transports/winhttp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,11 @@ static int winhttp_stream_read(
926926
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0)
927927
return -1;
928928

929-
if (allowed_types &&
930-
(!t->cred || 0 == (t->cred->credtype & allowed_types))) {
929+
if (allowed_types) {
931930
int cred_error = 1;
932931

932+
git_cred_free(t->cred);
933+
t->cred = NULL;
933934
/* Start with the user-supplied credential callback, if present */
934935
if (t->owner->cred_acquire_cb) {
935936
cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,

0 commit comments

Comments
 (0)