Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2021-06-06 12:51:23 +0300
committerMatteo Collina <hello@matteocollina.com>2021-06-08 18:54:28 +0300
commitf504c9c6b897f14891f147ad4a05e743133a0d35 (patch)
tree1a96764bb1abef60b193b9b2fe8661e26d89085b /test
parent65a7fd3e23b6f7be6a066f3f5ffe87a36ba66360 (diff)
Revert "http: make HEAD method to work with keep-alive"
This reverts commit 7afa5336aed999a62e4943e6000a239585b2e2ea. The change breaks clients like cURL. Fixes: https://github.com/nodejs/node/issues/38922 PR-URL: https://github.com/nodejs/node/pull/38949 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-http-reuse-socket.js51
1 files changed, 0 insertions, 51 deletions
diff --git a/test/parallel/test-http-reuse-socket.js b/test/parallel/test-http-reuse-socket.js
deleted file mode 100644
index f5cd002fdbf..00000000000
--- a/test/parallel/test-http-reuse-socket.js
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict';
-const common = require('../common');
-const http = require('http');
-const assert = require('assert');
-const Countdown = require('../common/countdown');
-
-// The HEAD:204, GET:200 is the most pathological test case.
-// GETs following a 204 response with a content-encoding header failed.
-// Responses without bodies and without content-length or encoding caused
-// the socket to be closed.
-const codes = [204, 200, 200, 304, 200];
-const methods = ['HEAD', 'HEAD', 'GET', 'HEAD', 'GET'];
-
-const sockets = [];
-const agent = new http.Agent();
-agent.maxSockets = 1;
-
-const countdown = new Countdown(codes.length, () => server.close());
-
-const server = http.createServer(common.mustCall((req, res) => {
- const code = codes.shift();
- assert.strictEqual(typeof code, 'number');
- assert.ok(code > 0);
- res.writeHead(code, {});
- res.end();
-}, codes.length));
-
-function nextRequest() {
- const request = http.request({
- port: server.address().port,
- path: '/',
- agent: agent,
- method: methods.shift()
- }, common.mustCall((response) => {
- response.on('end', common.mustCall(() => {
- if (countdown.dec()) {
- nextRequest();
- }
- assert.strictEqual(sockets.length, 1);
- }));
- response.resume();
- }));
- request.on('socket', common.mustCall((socket) => {
- if (!sockets.includes(socket)) {
- sockets.push(socket);
- }
- }));
- request.end();
-}
-
-server.listen(0, common.mustCall(nextRequest));