From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- netwerk/test/unit/head_servers.js | 42 ++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'netwerk/test/unit/head_servers.js') diff --git a/netwerk/test/unit/head_servers.js b/netwerk/test/unit/head_servers.js index d2d449b482..b8087e496f 100644 --- a/netwerk/test/unit/head_servers.js +++ b/netwerk/test/unit/head_servers.js @@ -327,21 +327,31 @@ class BaseProxyCode { // Connect to an origin server const { port, hostname } = new URL(`https://${req.url}`); const serverSocket = net - .connect(port || 443, hostname, () => { - clientSocket.write( - "HTTP/1.1 200 Connection Established\r\n" + - "Proxy-agent: Node.js-Proxy\r\n" + - "\r\n" - ); - serverSocket.write(head); - serverSocket.pipe(clientSocket); - clientSocket.pipe(serverSocket); - }) + .connect( + { + port: port || 443, + host: hostname, + family: 4, // Specifies to use IPv4 + }, + () => { + clientSocket.write( + "HTTP/1.1 200 Connection Established\r\n" + + "Proxy-agent: Node.js-Proxy\r\n" + + "\r\n" + ); + serverSocket.write(head); + serverSocket.pipe(clientSocket); + clientSocket.pipe(serverSocket); + } + ) .on("error", e => { + console.log("error" + e); // The socket will error out when we kill the connection // just ignore it. }); + clientSocket.on("error", e => { + console.log("client error" + e); // Sometimes we got ECONNRESET error on windows platform. // Ignore it for now. }); @@ -848,22 +858,22 @@ class WebSocketConnection { ]); } - onAcknowledge(aContext, aSize) {} + onAcknowledge() {} onBinaryMessageAvailable(aContext, aMsg) { this._messages.push(aMsg); this._msgCallback(); } - onMessageAvailable(aContext, aMsg) {} - onServerClose(aContext, aCode, aReason) {} - onWebSocketListenerStart(aContext) {} - onStart(aContext) { + onMessageAvailable() {} + onServerClose() {} + onWebSocketListenerStart() {} + onStart() { this._openCallback(); } onStop(aContext, aStatusCode) { this._stopCallback({ status: aStatusCode }); this._ws = null; } - onProxyAvailable(req, chan, proxyInfo, status) { + onProxyAvailable(req, chan, proxyInfo) { if (proxyInfo) { this._proxyAvailCallback({ type: proxyInfo.type }); } else { -- cgit v1.2.3