Bug 1520125 - Don't use origin attributes to distinguish proxy authentication cache entries. r=dragana, r=mixedpuppy

This commit is contained in:
Honza Bambas 2019-01-22 07:34:00 -05:00
Родитель 98de6694fc
Коммит 594d062b4c
3 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -1542,15 +1542,15 @@ void nsHttpChannelAuthProvider::SetAuthorizationHeader(
// or a webserver
nsISupports **continuationState;
nsAutoCString suffix;
if (header == nsHttp::Proxy_Authorization) {
continuationState = &mProxyAuthContinuationState;
} else {
continuationState = &mAuthContinuationState;
}
nsCOMPtr<nsIChannel> chan = do_QueryInterface(mAuthChannel);
nsAutoCString suffix;
GetOriginAttributesSuffix(chan, suffix);
nsCOMPtr<nsIChannel> chan = do_QueryInterface(mAuthChannel);
GetOriginAttributesSuffix(chan, suffix);
}
rv = authCache->GetAuthEntryForPath(scheme, host, port, path, suffix, &entry);
if (NS_SUCCEEDED(rv)) {

Просмотреть файл

@ -1,5 +1,9 @@
"use strict";
XPCOMUtils.defineLazyServiceGetter(this, "authManager",
"@mozilla.org/network/http-auth-manager;1",
"nsIHttpAuthManager");
const proxy = createHttpServer();
// accept proxy connections for mozilla.org
@ -74,6 +78,8 @@ add_task(async function test_webRequest_auth_proxy() {
await handlingExt.startup();
await handlingExt.awaitMessage("pac-ready");
authManager.clearAll();
let contentPage = await ExtensionTestUtils.loadContentPage(`http://mozilla.org/`);
await handlingExt.awaitMessage("done");
@ -112,12 +118,12 @@ add_task(async function test_webRequest_auth_proxy_system() {
xhr.open("GET", url);
xhr.onload = () => { resolve(xhr.responseText); };
xhr.onerror = () => { reject(xhr.status); };
// use a different contextId to avoid auth cache.
xhr.setOriginAttributes({userContextId: 1});
xhr.send();
});
}
authManager.clearAll();
await Promise.all([
handlingExt.awaitMessage("onAuthRequired"),
fetch("http://mozilla.org"),

Просмотреть файл

@ -1,5 +1,9 @@
"use strict";
XPCOMUtils.defineLazyServiceGetter(this, "authManager",
"@mozilla.org/network/http-auth-manager;1",
"nsIHttpAuthManager");
const proxy = createHttpServer();
// accept proxy connections for mozilla.org
@ -76,6 +80,8 @@ add_task(async function test_webRequest_auth_proxy() {
await handlingExt.startup();
await handlingExt.awaitMessage("ready");
authManager.clearAll();
let contentPage = await ExtensionTestUtils.loadContentPage(`http://mozilla.org/`);
await handlingExt.awaitMessage("done");
@ -112,6 +118,8 @@ add_task(async function test_webRequest_auth_proxy_system() {
await handlingExt.startup();
await handlingExt.awaitMessage("ready");
authManager.clearAll();
function fetch(url) {
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
@ -119,8 +127,6 @@ add_task(async function test_webRequest_auth_proxy_system() {
xhr.open("GET", url);
xhr.onload = () => { resolve(xhr.responseText); };
xhr.onerror = () => { reject(xhr.status); };
// use a different contextId to avoid auth cache.
xhr.setOriginAttributes({userContextId: 1});
xhr.send();
});
}