mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
r=mcafee. FTP now retrieves username and password info directly from the respective URL accessors. This removes any unescaping burden from FTP. These accessors are guaranteed to return unescaped strings
This commit is contained in:
parent
5cc6cc608d
commit
30c25dc728
@ -1663,22 +1663,24 @@ nsFtpConnectionThread::Init(nsIProtocolHandler* aHandler,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// pull any username and/or password out of the uri
|
||||
nsXPIDLCString preHost;
|
||||
rv = mURL->GetPreHost(getter_Copies(preHost));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (preHost) {
|
||||
// we found some username (and maybe password info) in the URL.
|
||||
// we know we're not going anonymously now.
|
||||
mAnonymous = PR_FALSE;
|
||||
char *colon = PL_strchr(preHost, ':');
|
||||
if (colon) {
|
||||
*colon = '\0';
|
||||
mPassword = colon+1;
|
||||
nsXPIDLCString uname;
|
||||
rv = mURL->GetUsername(getter_Copies(uname));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
} else {
|
||||
if ((const char*)uname && *(const char*)uname) {
|
||||
mAnonymous = PR_FALSE;
|
||||
mUsername = uname;
|
||||
}
|
||||
mUsername = preHost;
|
||||
}
|
||||
|
||||
nsXPIDLCString password;
|
||||
rv = mURL->GetPassword(getter_Copies(password));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
else
|
||||
mPassword = password;
|
||||
|
||||
// setup the connection cache key
|
||||
nsXPIDLCString host;
|
||||
rv = mURL->GetHost(getter_Copies(host));
|
||||
|
Loading…
Reference in New Issue
Block a user