mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
moebius#131: URL parser - stop preserving empty passwords
https://github.com/MoonchildProductions/moebius/issues/131
This commit is contained in:
parent
5622e56123
commit
de0621cc7e
4 changed files with 31 additions and 5 deletions
|
|
@ -781,11 +781,13 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
|
|||
i = AppendSegmentToBuf(buf, i, spec, username, mUsername,
|
||||
&encUsername, useEncUsername, &diff);
|
||||
ShiftFromPassword(diff);
|
||||
if (password.mLen >= 0) {
|
||||
if (password.mLen > 0) {
|
||||
buf[i++] = ':';
|
||||
i = AppendSegmentToBuf(buf, i, spec, password, mPassword,
|
||||
&encPassword, useEncPassword, &diff);
|
||||
ShiftFromHost(diff);
|
||||
} else {
|
||||
mPassword.mLen = -1;
|
||||
}
|
||||
buf[i++] = '@';
|
||||
}
|
||||
|
|
@ -1621,7 +1623,7 @@ nsStandardURL::SetUserPass(const nsACString &input)
|
|||
usernameLen),
|
||||
esc_Username | esc_AlwaysCopy,
|
||||
buf, ignoredOut);
|
||||
if (passwordLen >= 0) {
|
||||
if (passwordLen > 0) {
|
||||
buf.Append(':');
|
||||
passwordLen = encoder.EncodeSegmentCount(userpass.get(),
|
||||
URLSegment(passwordPos,
|
||||
|
|
@ -1629,6 +1631,8 @@ nsStandardURL::SetUserPass(const nsACString &input)
|
|||
esc_Password |
|
||||
esc_AlwaysCopy, buf,
|
||||
ignoredOut);
|
||||
} else {
|
||||
passwordLen = -1;
|
||||
}
|
||||
if (mUsername.mLen < 0)
|
||||
buf.Append('@');
|
||||
|
|
@ -1659,8 +1663,10 @@ nsStandardURL::SetUserPass(const nsACString &input)
|
|||
// update positions and lengths
|
||||
mUsername.mLen = usernameLen;
|
||||
mPassword.mLen = passwordLen;
|
||||
if (passwordLen)
|
||||
if (passwordLen > 0) {
|
||||
mPassword.mPos = mUsername.mPos + mUsername.mLen + 1;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue