From a1da7b86658f75a8ad8497a848c85c6692ab22db Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Tue, 8 Apr 2003 20:31:24 +0000 Subject: [PATCH] allowing ftp URLs w/ anonymous username to automatically use anonymous password. r+sr=darin, b=196286 --- .../protocol/ftp/src/nsFtpConnectionThread.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index ce1191a692ed..a1747d283899 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -2239,17 +2239,16 @@ nsFtpState::Init(nsIFTPChannel* aChannel, // pull any username and/or password out of the uri nsCAutoString uname; rv = mURL->GetUsername(uname); - if (NS_FAILED(rv)) { + if (NS_FAILED(rv)) return rv; - } else { - if (!uname.IsEmpty()) { - mAnonymous = PR_FALSE; - mUsername = NS_ConvertUTF8toUCS2(NS_UnescapeURL(uname)); - // return an error if we find a CR or LF in the username - if (uname.FindCharInSet(CRLF) >= 0) - return NS_ERROR_MALFORMED_URI; - } + if (!uname.IsEmpty() && !uname.Equals(NS_LITERAL_CSTRING("anonymous"))) { + mAnonymous = PR_FALSE; + mUsername = NS_ConvertUTF8toUCS2(NS_UnescapeURL(uname)); + + // return an error if we find a CR or LF in the username + if (uname.FindCharInSet(CRLF) >= 0) + return NS_ERROR_MALFORMED_URI; } nsCAutoString password;