allowing ftp URLs w/ anonymous username to automatically use anonymous password. r+sr=darin, b=196286

This commit is contained in:
dougt%netscape.com 2003-04-08 20:31:24 +00:00
parent d2fa1050d2
commit a1da7b8665

View File

@ -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;