GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: make HTTP/1.0 connection test more robust · nodejs/node@1a78bde

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http-remove-connection-header-persists-connection.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http-remove-connection-header-persists-connection.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-remove-connection-header-persists-connection.js
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ const server = http.createServer(function(request, response) {
1010
// For HTTP/1.0, the connection should be closed after the response automatically.
1111
response.removeHeader('connection');
1212

13+
if (request.httpVersion === '1.0') {
14+
const socket = request.socket;
15+
response.on('finish', common.mustCall(function() {
16+
assert.ok(socket.writableEnded);
17+
}));
18+
}
19+
1320
response.end('beep boop\n');
1421
});
1522

@@ -50,9 +57,7 @@ function makeHttp10Request(cb) {
5057
'\r\n');
5158
socket.resume(); // Ignore the response itself
5259

53-
setTimeout(function() {
54-
cb(socket);
55-
}, common.platformTimeout(50));
60+
socket.on('close', cb);
5661
});
5762
}
5863

@@ -62,9 +67,7 @@ server.listen(0, function() {
6267
// Both HTTP/1.1 requests should have used the same socket:
6368
assert.strictEqual(firstSocket, secondSocket);
6469

65-
makeHttp10Request(function(socket) {
66-
// The server should have immediately closed the HTTP/1.0 socket:
67-
assert.strictEqual(socket.closed, true);
70+
makeHttp10Request(function() {
6871
server.close();
6972
});
7073
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.