Bug 1955565 - Remove HTTP/2 pref and remove H2 push tests r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D242512
This commit is contained in:
Valentin Gosu
2025-04-02 07:51:09 +00:00
parent 1986cf37d1
commit cbc03acbea
9 changed files with 17 additions and 917 deletions

View File

@@ -14591,11 +14591,6 @@
value: 0
mirror: always
- name: network.http.http2.allow-push
type: RelaxedAtomicBool
value: false
mirror: always
# When true, Firefox will send a SETTINGS_MAX_CONCURRENT_STREAMS
# parameter when push is disabled. Chrome doesn't send this,
# so some servers misbehave when we do. See Bug 1919750.

View File

@@ -999,25 +999,23 @@ void Http2Session::SendHello() {
maxHpackBufferSize);
numberOfEntries++;
if (!StaticPrefs::network_http_http2_allow_push()) {
// If we don't support push then set MAX_CONCURRENT to 0 and also
// set ENABLE_PUSH to 0
// We don't support HTTP/2 Push. Set SETTINGS_TYPE_ENABLE_PUSH to 0
NetworkEndian::writeUint16(packet + kFrameHeaderBytes + (6 * numberOfEntries),
SETTINGS_TYPE_ENABLE_PUSH);
// The value portion of the setting pair is already initialized to 0
numberOfEntries++;
// We might also want to set the SETTINGS_TYPE_MAX_CONCURRENT to 0
// to indicate that we don't support any incoming push streams,
// but some websites panic when we do that, so we don't by default.
if (StaticPrefs::network_http_http2_send_push_max_concurrent_frame()) {
NetworkEndian::writeUint16(
packet + kFrameHeaderBytes + (6 * numberOfEntries),
SETTINGS_TYPE_ENABLE_PUSH);
SETTINGS_TYPE_MAX_CONCURRENT);
// The value portion of the setting pair is already initialized to 0
numberOfEntries++;
if (StaticPrefs::network_http_http2_send_push_max_concurrent_frame()) {
NetworkEndian::writeUint16(
packet + kFrameHeaderBytes + (6 * numberOfEntries),
SETTINGS_TYPE_MAX_CONCURRENT);
// The value portion of the setting pair is already initialized to 0
numberOfEntries++;
}
mWaitingForSettingsAck = true;
}
mWaitingForSettingsAck = true;
// Advertise the Push RWIN for the session, and on each new pull stream
// send a window update

View File

@@ -159,35 +159,6 @@ Http2HeaderListener.prototype.onDataAvailable = function (
read_stream(stream, cnt);
};
var Http2PushListener = function (shouldBePushed) {
this.shouldBePushed = shouldBePushed;
};
Http2PushListener.prototype = new Http2CheckListener();
Http2PushListener.prototype.onDataAvailable = function (
request,
stream,
off,
cnt
) {
this.onDataAvailableFired = true;
this.isHttp2Connection = checkIsHttp2(request);
if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/push.js` ||
request.originalURI.spec ==
`https://localhost:${this.serverPort}/push2.js` ||
request.originalURI.spec == `https://localhost:${this.serverPort}/push5.js`
) {
Assert.equal(
request.getResponseHeader("pushed"),
this.shouldBePushed ? "yes" : "no"
);
}
read_stream(stream, cnt);
};
const pushHdrTxt =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const pullHdrTxt = pushHdrTxt.split("").reverse().join("");
@@ -198,78 +169,6 @@ function checkContinuedHeaders(getHeader, headerPrefix, headerText) {
}
}
var Http2ContinuedHeaderListener = function () {};
Http2ContinuedHeaderListener.prototype = new Http2CheckListener();
Http2ContinuedHeaderListener.prototype.onStopsLeft = 2;
Http2ContinuedHeaderListener.prototype.QueryInterface = ChromeUtils.generateQI([
"nsIHttpPushListener",
"nsIStreamListener",
]);
Http2ContinuedHeaderListener.prototype.getInterface = function (aIID) {
return this.QueryInterface(aIID);
};
Http2ContinuedHeaderListener.prototype.onDataAvailable = function (
request,
stream,
off,
cnt
) {
this.onDataAvailableFired = true;
this.isHttp2Connection = checkIsHttp2(request);
if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/continuedheaders`
) {
// This is the original request, so the only one where we'll have continued response headers
checkContinuedHeaders(
request.getResponseHeader,
"X-Pull-Test-Header-",
pullHdrTxt
);
}
read_stream(stream, cnt);
};
Http2ContinuedHeaderListener.prototype.onStopRequest = function (
request,
status
) {
Assert.ok(this.onStartRequestFired);
Assert.ok(Components.isSuccessCode(status));
Assert.ok(this.onDataAvailableFired);
Assert.ok(this.isHttp2Connection);
--this.onStopsLeft;
if (this.onStopsLeft === 0) {
request.QueryInterface(Ci.nsIProxiedChannel);
var httpProxyConnectResponseCode = request.httpProxyConnectResponseCode;
this.finish({ httpProxyConnectResponseCode });
}
};
Http2ContinuedHeaderListener.prototype.onPush = function (
associatedChannel,
pushChannel
) {
Assert.equal(
associatedChannel.originalURI.spec,
"https://localhost:" + this.serverPort + "/continuedheaders"
);
Assert.equal(pushChannel.getRequestHeader("x-pushed-request"), "true");
checkContinuedHeaders(
pushChannel.getRequestHeader,
"X-Push-Test-Header-",
pushHdrTxt
);
pushChannel.asyncOpen(this);
};
// Does the appropriate checks for a large GET response
var Http2BigListener = function () {};
@@ -631,72 +530,6 @@ async function test_http2_cookie_crumbling(serverPort) {
});
}
async function test_http2_push1(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push2(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push.js`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push3(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push2`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push4(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push2.js`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push5(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push5`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push6(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push5.js`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
// this is a basic test where the server sends a simple document with 2 header
// blocks. bug 1027364
async function test_http2_doubleheader(serverPort) {
@@ -916,120 +749,6 @@ async function test_http2_altsvc(httpserv, httpserv2, withProxy) {
});
}
var Http2PushApiListener = function (finish, serverPort) {
this.finish = finish;
this.serverPort = serverPort;
};
Http2PushApiListener.prototype = {
checksPending: 9, // 4 onDataAvailable and 5 onStop
getInterface(aIID) {
return this.QueryInterface(aIID);
},
QueryInterface: ChromeUtils.generateQI([
"nsIHttpPushListener",
"nsIStreamListener",
]),
// nsIHttpPushListener
onPush: function onPush(associatedChannel, pushChannel) {
Assert.equal(
associatedChannel.originalURI.spec,
"https://localhost:" + this.serverPort + "/pushapi1"
);
Assert.equal(pushChannel.getRequestHeader("x-pushed-request"), "true");
pushChannel.asyncOpen(this);
if (
pushChannel.originalURI.spec ==
"https://localhost:" + this.serverPort + "/pushapi1/2"
) {
pushChannel.cancel(Cr.NS_ERROR_ABORT);
} else if (
pushChannel.originalURI.spec ==
"https://localhost:" + this.serverPort + "/pushapi1/3"
) {
Assert.ok(pushChannel.getRequestHeader("Accept-Encoding").includes("br"));
}
},
// normal Channel listeners
onStartRequest: function pushAPIOnStart() {},
onDataAvailable: function pushAPIOnDataAvailable(
request,
stream,
offset,
cnt
) {
Assert.notEqual(
request.originalURI.spec,
`https://localhost:${this.serverPort}/pushapi1/2`
);
var data = read_stream(stream, cnt);
if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/pushapi1`
) {
Assert.equal(data[0], "0");
--this.checksPending;
} else if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/pushapi1/1`
) {
Assert.equal(data[0], "1");
--this.checksPending; // twice
} else if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/pushapi1/3`
) {
Assert.equal(data[0], "3");
--this.checksPending;
} else {
Assert.equal(true, false);
}
},
onStopRequest: function test_onStopR(request) {
if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/pushapi1/2`
) {
Assert.equal(request.status, Cr.NS_ERROR_ABORT);
} else {
Assert.equal(request.status, Cr.NS_OK);
}
--this.checksPending; // 5 times - one for each push plus the pull
if (!this.checksPending) {
request.QueryInterface(Ci.nsIProxiedChannel);
var httpProxyConnectResponseCode = request.httpProxyConnectResponseCode;
this.finish({ httpProxyConnectResponseCode });
}
},
};
// pushAPI testcase 1 expects
// 1 to pull /pushapi1 with 0
// 2 to see /pushapi1/1 with 1
// 3 to see /pushapi1/1 with 1 (again)
// 4 to see /pushapi1/2 that it will cancel
// 5 to see /pushapi1/3 with 3 with brotli
async function test_http2_pushapi_1(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/pushapi1`);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2PushApiListener(resolve, serverPort);
chan.notificationCallbacks = listener;
chan.asyncOpen(listener);
});
}
var WrongSuiteListener = function () {};
WrongSuiteListener.prototype = new Http2CheckListener();
@@ -1131,20 +850,6 @@ async function test_http2_retry_rst(serverPort) {
});
}
async function test_http2_continuations(loadGroup, serverPort) {
var chan = makeHTTPChannel(
`https://localhost:${serverPort}/continuedheaders`
);
chan.loadGroup = loadGroup;
return new Promise(resolve => {
var listener = new Http2ContinuedHeaderListener();
listener.finish = resolve;
listener.serverPort = serverPort;
chan.notificationCallbacks = listener;
chan.asyncOpen(listener);
});
}
async function test_http2_continuations_over_max_response_limit(
loadGroup,
serverPort
@@ -1243,78 +948,6 @@ async function test_http2_empty_data(serverPort) {
});
}
async function test_http2_push_firstparty1(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push`);
chan.loadGroup = loadGroup;
chan.loadInfo.originAttributes = { firstPartyDomain: "foo.com" };
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push_firstparty2(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push.js`);
chan.loadGroup = loadGroup;
chan.loadInfo.originAttributes = { firstPartyDomain: "bar.com" };
return new Promise(resolve => {
var listener = new Http2PushListener(false);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push_firstparty3(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push.js`);
chan.loadGroup = loadGroup;
chan.loadInfo.originAttributes = { firstPartyDomain: "foo.com" };
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push_userContext1(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push`);
chan.loadGroup = loadGroup;
chan.loadInfo.originAttributes = { userContextId: 1 };
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push_userContext2(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push.js`);
chan.loadGroup = loadGroup;
chan.loadInfo.originAttributes = { userContextId: 2 };
return new Promise(resolve => {
var listener = new Http2PushListener(false);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_push_userContext3(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/push.js`);
chan.loadGroup = loadGroup;
chan.loadInfo.originAttributes = { userContextId: 1 };
return new Promise(resolve => {
var listener = new Http2PushListener(true);
listener.finish = resolve;
listener.serverPort = serverPort;
chan.asyncOpen(listener);
});
}
async function test_http2_status_phrase(serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/statusphrase`);
return new Promise(resolve => {
@@ -1393,121 +1026,3 @@ FromDiskCacheListener.prototype = {
});
},
};
var Http2DiskCachePushListener = function () {};
Http2DiskCachePushListener.prototype = new Http2CheckListener();
Http2DiskCachePushListener.onStopRequest = function (request, status) {
Assert.ok(this.onStartRequestFired);
Assert.ok(Components.isSuccessCode(status));
Assert.ok(this.onDataAvailableFired);
Assert.ok(this.isHttp2Connection == this.shouldBeHttp2);
// Now we need to open a channel to ensure we get data from the disk cache
// for the pushed item, instead of from the push cache.
var chan = makeHTTPChannel(`https://localhost:${this.serverPort}/diskcache`);
var listener = new FromDiskCacheListener(
this.finish,
this.loadGroup,
this.serverPort
);
chan.loadGroup = this.loadGroup;
chan.asyncOpen(listener);
};
function continue_test_http2_disk_cache_push(
status,
entry,
finish,
loadGroup,
serverPort
) {
// TODO - store stuff in cache entry, then open an h2 channel that will push
// this, once that completes, open a channel for the cache entry we made and
// ensure it came from disk cache, not the push cache.
var outputStream = entry.openOutputStream(0, -1);
outputStream.write(DISK_CACHE_DATA, DISK_CACHE_DATA.length);
// Now we open our URL that will push data for the URL above
var chan = makeHTTPChannel(`https://localhost:${serverPort}/pushindisk`);
var listener = new Http2DiskCachePushListener();
listener.finish = finish;
listener.loadGroup = loadGroup;
listener.serverPort = serverPort;
chan.loadGroup = loadGroup;
chan.asyncOpen(listener);
}
async function test_http2_disk_cache_push(loadGroup, serverPort) {
return new Promise(resolve => {
asyncOpenCacheEntry(
`https://localhost:${serverPort}/diskcache`,
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
function (status, entry) {
continue_test_http2_disk_cache_push(
status,
entry,
resolve,
loadGroup,
serverPort
);
},
false
);
});
}
var Http2DoublepushListener = function () {};
Http2DoublepushListener.prototype = new Http2CheckListener();
Http2DoublepushListener.prototype.onStopRequest = function (request, status) {
Assert.ok(this.onStartRequestFired);
Assert.ok(Components.isSuccessCode(status));
Assert.ok(this.onDataAvailableFired);
Assert.ok(this.isHttp2Connection == this.shouldBeHttp2);
var chan = makeHTTPChannel(
`https://localhost:${this.serverPort}/doublypushed`
);
var listener = new Http2DoublypushedListener();
listener.finish = this.finish;
chan.loadGroup = this.loadGroup;
chan.asyncOpen(listener);
};
var Http2DoublypushedListener = function () {};
Http2DoublypushedListener.prototype = new Http2CheckListener();
Http2DoublypushedListener.prototype.readData = "";
Http2DoublypushedListener.prototype.onDataAvailable = function (
request,
stream,
off,
cnt
) {
this.onDataAvailableFired = true;
this.accum += cnt;
this.readData += read_stream(stream, cnt);
};
Http2DoublypushedListener.prototype.onStopRequest = function (request, status) {
Assert.ok(this.onStartRequestFired);
Assert.ok(Components.isSuccessCode(status));
Assert.ok(this.onDataAvailableFired);
Assert.equal(this.readData, "pushed");
request.QueryInterface(Ci.nsIProxiedChannel);
let httpProxyConnectResponseCode = request.httpProxyConnectResponseCode;
this.finish({ httpProxyConnectResponseCode });
};
function test_http2_doublepush(loadGroup, serverPort) {
var chan = makeHTTPChannel(`https://localhost:${serverPort}/doublepush`);
return new Promise(resolve => {
var listener = new Http2DoublepushListener();
listener.finish = resolve;
listener.loadGroup = loadGroup;
listener.serverPort = serverPort;
chan.loadGroup = loadGroup;
chan.asyncOpen(listener);
});
}

View File

@@ -26,11 +26,9 @@ add_setup(async function setup() {
}
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRFIRST);
Services.prefs.setBoolPref("network.http.http2.allow-push", true);
});
let test_answer = "bXkgdm9pY2UgaXMgbXkgcGFzc3dvcmQ=";
let test_answer_addr = "127.0.0.1";
add_task(async function testTXTResolve() {
// use the h2 server as DOH provider
@@ -48,37 +46,3 @@ add_task(async function testTXTResolve() {
.getRecordsAsOneString();
Assert.equal(answer, test_answer, "got correct answer");
});
// verify TXT record pushed on a A record request
add_task(async function testTXTRecordPushPart1() {
Services.prefs.setCharPref(
"network.trr.uri",
"https://foo.example.com:" + h2Port + "/txt-dns-push"
);
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
type: Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
expectedAnswer: "127.0.0.1",
});
inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
let answer = inRecord.getNextAddrAsString();
Assert.equal(answer, test_answer_addr, "got correct answer");
}).skip("H2 push is disabled");
// verify the TXT pushed record
add_task(async function testTXTRecordPushPart2() {
// At this point the second host name should've been pushed and we can resolve it using
// cache only. Set back the URI to a path that fails.
Services.prefs.setCharPref(
"network.trr.uri",
"https://foo.example.com:" + h2Port + "/404"
);
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
type: Ci.nsIDNSService.RESOLVE_TYPE_TXT,
});
let answer = inRecord
.QueryInterface(Ci.nsIDNSTXTRecord)
.getRecordsAsOneString();
Assert.equal(answer, test_answer, "got correct answer");
}).skip("H2 push is disabled");

View File

@@ -76,7 +76,6 @@ add_setup(async function setup() {
addCertFromFile(certdb, "http2-ca.pem", "CTu,u,u");
Services.prefs.setBoolPref("network.http.http2.enabled", true);
Services.prefs.setBoolPref("network.http.http2.allow-push", true);
Services.prefs.setBoolPref("network.http.altsvc.enabled", true);
Services.prefs.setBoolPref("network.http.altsvc.oe", true);
Services.prefs.setCharPref(
@@ -116,7 +115,6 @@ add_setup(async function setup() {
registerCleanupFunction(async () => {
Services.prefs.clearUserPref("network.http.speculative-parallel-limit");
Services.prefs.clearUserPref("network.http.http2.enabled");
Services.prefs.clearUserPref("network.http.http2.allow-push");
Services.prefs.clearUserPref("network.http.altsvc.enabled");
Services.prefs.clearUserPref("network.http.altsvc.oe");
Services.prefs.clearUserPref("network.dns.localDomains");
@@ -170,54 +168,6 @@ add_task(async function do_test_http2_nospdy() {
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push1() {
const { httpProxyConnectResponseCode } = await test_http2_push1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push2() {
const { httpProxyConnectResponseCode } = await test_http2_push2(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push3() {
const { httpProxyConnectResponseCode } = await test_http2_push3(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push4() {
const { httpProxyConnectResponseCode } = await test_http2_push4(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push5() {
const { httpProxyConnectResponseCode } = await test_http2_push5(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push6() {
const { httpProxyConnectResponseCode } = await test_http2_push6(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_altsvc() {
const { httpProxyConnectResponseCode } = await test_http2_altsvc(
httpserv.identity.primaryPort,
@@ -313,22 +263,6 @@ add_task(async function do_test_http2_patch() {
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_pushapi_1() {
const { httpProxyConnectResponseCode } = await test_http2_pushapi_1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_continuations() {
const { httpProxyConnectResponseCode } = await test_http2_continuations(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_blocking_download() {
const { httpProxyConnectResponseCode } =
await test_http2_blocking_download(serverPort);
@@ -367,22 +301,6 @@ add_task(async function do_test_http2_status_phrase() {
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_doublepush() {
const { httpProxyConnectResponseCode } = await test_http2_doublepush(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_disk_cache_push() {
const { httpProxyConnectResponseCode } = await test_http2_disk_cache_push(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_h11required_stream() {
// Add new tests above here - best to add new tests before h1
// streams get too involved
@@ -416,54 +334,6 @@ add_task(async function do_test_http2_wrongsuite_tls13() {
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push_firstparty1() {
const { httpProxyConnectResponseCode } = await test_http2_push_firstparty1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push_firstparty2() {
const { httpProxyConnectResponseCode } = await test_http2_push_firstparty2(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push_firstparty3() {
const { httpProxyConnectResponseCode } = await test_http2_push_firstparty3(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push_userContext1() {
const { httpProxyConnectResponseCode } = await test_http2_push_userContext1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push_userContext2() {
const { httpProxyConnectResponseCode } = await test_http2_push_userContext2(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_push_userContext3() {
const { httpProxyConnectResponseCode } = await test_http2_push_userContext3(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, -1);
});
add_task(async function do_test_http2_continuations_over_max_response_limit() {
const { httpProxyConnectResponseCode } =
await test_http2_continuations_over_max_response_limit(

View File

@@ -38,7 +38,6 @@ add_setup(async function setup() {
addCertFromFile(certdb, "proxy-ca.pem", "CTu,u,u");
Services.prefs.setBoolPref("network.http.http2.enabled", true);
Services.prefs.setBoolPref("network.http.http2.allow-push", true);
Services.prefs.setBoolPref("network.http.altsvc.enabled", true);
Services.prefs.setBoolPref("network.http.altsvc.oe", true);
Services.prefs.setCharPref(
@@ -66,7 +65,6 @@ add_setup(async function setup() {
registerCleanupFunction(async () => {
Services.prefs.clearUserPref("network.http.speculative-parallel-limit");
Services.prefs.clearUserPref("network.http.http2.enabled");
Services.prefs.clearUserPref("network.http.http2.allow-push");
Services.prefs.clearUserPref("network.http.altsvc.enabled");
Services.prefs.clearUserPref("network.http.altsvc.oe");
Services.prefs.clearUserPref("network.dns.localDomains");
@@ -120,54 +118,6 @@ add_task(async function do_test_http2_nospdy() {
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push1() {
const { httpProxyConnectResponseCode } = await test_http2_push1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push2() {
const { httpProxyConnectResponseCode } = await test_http2_push2(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push3() {
const { httpProxyConnectResponseCode } = await test_http2_push3(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push4() {
const { httpProxyConnectResponseCode } = await test_http2_push4(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push5() {
const { httpProxyConnectResponseCode } = await test_http2_push5(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push6() {
const { httpProxyConnectResponseCode } = await test_http2_push6(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_doubleheader() {
const { httpProxyConnectResponseCode } =
await test_http2_doubleheader(serverPort);
@@ -254,22 +204,6 @@ add_task(async function do_test_http2_patch() {
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_pushapi_1() {
const { httpProxyConnectResponseCode } = await test_http2_pushapi_1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 0);
});
add_task(async function do_test_http2_continuations() {
const { httpProxyConnectResponseCode } = await test_http2_continuations(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 0);
});
add_task(async function do_test_http2_blocking_download() {
const { httpProxyConnectResponseCode } =
await test_http2_blocking_download(serverPort);
@@ -308,22 +242,6 @@ add_task(async function do_test_http2_status_phrase() {
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_doublepush() {
const { httpProxyConnectResponseCode } = await test_http2_doublepush(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_disk_cache_push() {
const { httpProxyConnectResponseCode } = await test_http2_disk_cache_push(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_h11required_stream() {
// Add new tests above here - best to add new tests before h1
// streams get too involved
@@ -367,54 +285,6 @@ add_task(async function do_test_http2_wrongsuite_tls13() {
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push_firstparty1() {
const { httpProxyConnectResponseCode } = await test_http2_push_firstparty1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push_firstparty2() {
const { httpProxyConnectResponseCode } = await test_http2_push_firstparty2(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push_firstparty3() {
const { httpProxyConnectResponseCode } = await test_http2_push_firstparty3(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push_userContext1() {
const { httpProxyConnectResponseCode } = await test_http2_push_userContext1(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push_userContext2() {
const { httpProxyConnectResponseCode } = await test_http2_push_userContext2(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_push_userContext3() {
const { httpProxyConnectResponseCode } = await test_http2_push_userContext3(
loadGroup,
serverPort
);
Assert.equal(httpProxyConnectResponseCode, 200);
});
add_task(async function do_test_http2_continuations_over_max_response_limit() {
const { httpProxyConnectResponseCode } =
await test_http2_continuations_over_max_response_limit(

View File

@@ -3,7 +3,6 @@
var h2Port;
var prefs;
var http2pref;
var loadGroup;
function run_test() {
h2Port = Services.env.get("MOZHTTP2_PORT");
@@ -15,7 +14,6 @@ function run_test() {
prefs = Services.prefs;
http2pref = prefs.getBoolPref("network.http.http2.enabled");
Services.prefs.setBoolPref("network.http.http2.allow-push", true);
prefs.setBoolPref("network.http.http2.enabled", true);
prefs.setCharPref(
@@ -221,100 +219,9 @@ function doTest10() {
// but the cert is not valid for bar. so expect a failure
dump("doTest10()\n");
origin = "https://bar.example.com:" + h2Port + "/origin-10";
nextTest = doTest11;
nextTest = testsDone;
nextPortExpectedToBeSame = false;
forceFailListener = true;
do_test_pending();
doTest();
}
var Http2PushApiListener = function () {};
Http2PushApiListener.prototype = {
fooOK: false,
alt1OK: false,
getInterface(aIID) {
return this.QueryInterface(aIID);
},
QueryInterface: ChromeUtils.generateQI([
"nsIHttpPushListener",
"nsIStreamListener",
]),
// nsIHttpPushListener
onPush: function onPush(associatedChannel, pushChannel) {
dump(
"push api onpush " +
pushChannel.originalURI.spec +
" associated to " +
associatedChannel.originalURI.spec +
"\n"
);
Assert.equal(
associatedChannel.originalURI.spec,
"https://foo.example.com:" + h2Port + "/origin-11-a"
);
Assert.equal(pushChannel.getRequestHeader("x-pushed-request"), "true");
if (
pushChannel.originalURI.spec ===
"https://foo.example.com:" + h2Port + "/origin-11-b"
) {
this.fooOK = true;
} else if (
pushChannel.originalURI.spec ===
"https://alt1.example.com:" + h2Port + "/origin-11-e"
) {
this.alt1OK = true;
} else {
// any push of bar or madeup should not end up in onPush()
Assert.equal(true, false);
}
pushChannel.cancel(Cr.NS_ERROR_ABORT);
},
// normal Channel listeners
onStartRequest: function pushAPIOnStart(request) {
dump("push api onstart " + request.originalURI.spec + "\n");
},
onDataAvailable: function pushAPIOnDataAvailable(
request,
stream,
offset,
cnt
) {
read_stream(stream, cnt);
},
onStopRequest: function test_onStopR(request) {
dump("push api onstop " + request.originalURI.spec + "\n");
Assert.ok(this.fooOK);
Assert.ok(this.alt1OK);
nextTest();
do_test_finished();
},
};
function doTest11() {
// we are connected with an SNI of foo from test6
// but the origin set is alt1, alt2, bar - foo is implied
// and bar is not actually covered by the cert
//
// the server will push foo (b-OK), bar (c-NOT OK), madeup (d-NOT OK), alt1 (e-OK),
dump("doTest11()\n");
do_test_pending();
loadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance(
Ci.nsILoadGroup
);
var chan = makeChan("https://foo.example.com:" + h2Port + "/origin-11-a");
chan.loadGroup = loadGroup;
var listener = new Http2PushApiListener();
nextTest = testsDone;
chan.notificationCallbacks = listener;
chan.asyncOpen(listener);
}

View File

@@ -8,7 +8,6 @@ SetParentalControlEnabled(false);
function setup() {
Services.prefs.setBoolPref("network.dns.get-ttl", false);
Services.prefs.setBoolPref("network.http.http2.allow-push", true);
h2Port = trr_test_setup();
}
@@ -135,22 +134,6 @@ add_task(async function test_trr_flags() {
add_task(test_A_record);
add_task(async function test_push() {
info("Verify DOH push");
Services.dns.clearCache(true);
info("Asking server to push us a record");
setModeAndURI(3, "doh?responseIP=5.5.5.5&push=true");
await new TRRDNSListener("first.example.com", "5.5.5.5");
// At this point the second host name should've been pushed and we can resolve it using
// cache only. Set back the URI to a path that fails.
// Don't clear the cache, otherwise we lose the pushed record.
setModeAndURI(3, "404");
await new TRRDNSListener("push.example.org", "2018::2018");
}).skip("H2 push is disabled");
add_task(test_AAAA_records);
add_task(test_RFC1918);
@@ -935,19 +918,17 @@ add_task(
setModeAndURI(Ci.nsIDNSService.MODE_TRRONLY, `doh`);
Services.dns.clearCache(true);
var { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);
// Close the previous TRR connection.
Services.obs.notifyObservers(null, "net:cancel-all-connections");
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
await new Promise(r => setTimeout(r, 3000));
await new Promise(r => do_timeout(3000, r));
Services.fog.testResetFOG();
// Disable IPv6, so we only send one TRR request.
Services.prefs.setBoolPref("network.dns.disableIPv6", true);
await new TRRDNSListener("timing.com", { expectedAnswer: "5.5.5.5" });
await new Promise(r => do_timeout(100, r));
let dnsStart = await Glean.networking.trrDnsStart.other.testGetValue();
let dnsEnd = await Glean.networking.trrDnsEnd.other.testGetValue();
let tcpConnection =

View File

@@ -523,7 +523,7 @@ function handleRequest(req, res) {
arg => {
writeResponse(arg[0], arg[1]);
},
delay,
delay + 1,
[response, buf]
);
return;