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.
This commit is contained in:
Carlos Martín Nieto 2016-03-03 10:48:24 +01:00
parent 2520573778
commit a4cba9d453

View File

@ -926,10 +926,11 @@ replay:
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0) if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0)
return -1; return -1;
if (allowed_types && if (allowed_types) {
(!t->cred || 0 == (t->cred->credtype & allowed_types))) {
int cred_error = 1; int cred_error = 1;
git_cred_free(t->cred);
t->cred = NULL;
/* Start with the user-supplied credential callback, if present */ /* Start with the user-supplied credential callback, if present */
if (t->owner->cred_acquire_cb) { if (t->owner->cred_acquire_cb) {
cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url, cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,