commit 6987f2e01b9982e2d694c98f1bf66425c249e639
parent 26b609c27e25261fcdbebe7c10ccfdcfbc2ef6b7
Author: Kershaw Chang <kershaw@mozilla.com>
Date: Wed, 1 Oct 2025 10:27:58 +0000
Bug 1991314 - Use the no-response port of the dynamically created server, r=necko-reviewers,valentin
In test_http_connect_fallback, the MOZHTTP3_PORT_NO_RESPONSE port is a global variable, so it might also be used by another server.
To avoid conflicts, we can instead use the no-response port from the dynamically created server.
Differential Revision: https://phabricator.services.mozilla.com/D266964
Diffstat:
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/netwerk/test/httpserver/NodeServer.sys.mjs b/netwerk/test/httpserver/NodeServer.sys.mjs
@@ -1097,6 +1097,9 @@ export class HTTP3Server {
masque_proxy_port() {
return this._masque_proxy_port;
}
+ no_response_port() {
+ return this._no_response_port;
+ }
domain() {
return `localhost`;
}
@@ -1127,6 +1130,7 @@ export class HTTP3Server {
// Extract the ports as an array of numbers
let ports = match.slice(1, 7).map(Number);
this._port = ports[0];
+ this._no_response_port = ports[4];
this._masque_proxy_port = ports[5];
return ports[0];
}
diff --git a/netwerk/test/unit/head_http3.js b/netwerk/test/unit/head_http3.js
@@ -24,7 +24,10 @@ async function create_h3_server() {
}
async function create_masque_proxy_server() {
- return with_http3_server(server => server.masque_proxy_port());
+ return with_http3_server(server => ({
+ masqueProxyPort: server.masque_proxy_port(),
+ noResponsePort: server.no_response_port(),
+ }));
}
async function http3_setup_tests(http3version, reload) {
diff --git a/netwerk/test/unit/test_http3_proxy.js b/netwerk/test/unit/test_http3_proxy.js
@@ -38,6 +38,7 @@ function channelOpenPromise(chan, flags) {
let pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].getService();
let proxyHost;
let proxyPort;
+let noResponsePort;
let proxyAuth;
let proxyFilter;
@@ -57,7 +58,8 @@ add_setup(async function setup() {
addCertFromFile(certdb, "proxy-ca.pem", "CTu,u,u");
proxyHost = "foo.example.com";
- proxyPort = await create_masque_proxy_server();
+ ({ masqueProxyPort: proxyPort, noResponsePort } =
+ await create_masque_proxy_server());
proxyAuth = "";
Assert.notEqual(proxyPort, null);
@@ -344,7 +346,7 @@ add_task(async function test_http_connect_fallback() {
""
);
- let proxyPort = Services.env.get("MOZHTTP3_PORT_NO_RESPONSE");
+ let proxyPort = noResponsePort;
let proxy = new NodeHTTP2ProxyServer();
await proxy.startWithoutProxyFilter(proxyPort);
Assert.equal(proxyPort, proxy.port());
@@ -422,7 +424,7 @@ add_task(async function test_http_connect_fallback() {
add_task(async function test_inner_connection_fallback() {
let h3Port = Services.env.get("MOZHTTP3_PORT_NO_RESPONSE");
- console.log(`h3Port = ${h3Port}`);
+ info(`h3Port = ${h3Port}`);
// Register the connect-udp proxy.
pps.registerFilter(proxyFilter, 10);