Skip to content

Commit

Permalink
test: make HTTP/1.0 connection test more robust
Browse files Browse the repository at this point in the history
Fixes: #47200
  • Loading branch information
FliegendeWurst committed Nov 23, 2024
1 parent 02921e1 commit 33caf96
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ function makeHttp10Request(cb) {
'\r\n');
socket.resume(); // Ignore the response itself

setTimeout(function() {
cb(socket);
}, common.platformTimeout(50));
// Invoke the callback when the socket closes. The server should close it
// immediately after sending the response.
socket.on('close', cb);
// If the socket is not closed, the test will fail with a timeout.
});
}

Expand All @@ -63,8 +64,6 @@ server.listen(0, function() {
assert.strictEqual(firstSocket, secondSocket);

makeHttp10Request(function(socket) {
// The server should have immediately closed the HTTP/1.0 socket:
assert.strictEqual(socket.closed, true);
server.close();
});
});
Expand Down

0 comments on commit 33caf96

Please sign in to comment.