From 79749f8eb4a81c0a9743eaa71dfa03cc525da674 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 15 Jul 2003 23:06:02 +0000 Subject: [PATCH] Fix to the endless loop of bad Basic authentication as reported in Cris Bailiff's bug report 768275. --- lib/transfer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/transfer.c b/lib/transfer.c index 98cf70c1d..3a6ad2203 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -794,7 +794,15 @@ CURLcode Curl_readwrite(struct connectdata *conn, } } else if(checkprefix("Basic", start)) { - if(data->state.authwant & CURLAUTH_BASIC) { + if((data->state.authwant == CURLAUTH_BASIC) && + (k->httpcode == 401)) { + /* We asked for Basic authentication but got a 401 back + anyway, which basicly means our name+password isn't + valid. */ + data->state.authavail = CURLAUTH_NONE; + infof(data, "Authentication problem. Ignoring this.\n"); + } + else if(data->state.authwant & CURLAUTH_BASIC) { data->state.authavail |= CURLAUTH_BASIC; } }