diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /netwerk/test/unit/head_servers.js | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz firefox-adbda400be353e676059e335c3c0aaf99e719475.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/unit/head_servers.js')
-rw-r--r-- | netwerk/test/unit/head_servers.js | 42 |
1 files changed, 26 insertions, 16 deletions
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 { |