blob: 99bbf3dd1bc766614e922cf87f440b18d8d80ff3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
'use strict';
// Test https://github.com/nodejs/node/issues/25499 fix.
const { mustCall } = require('../common');
const { Agent, createServer, get } = require('http');
const { strictEqual } = require('assert');
const server = createServer(mustCall((req, res) => {
res.end();
}));
server.listen(0, () => {
const agent = new Agent({ keepAlive: true, maxSockets: 1 });
const port = server.address().port;
let socket;
const req = get({ agent, port }, (res) => {
res.on('end', () => {
strictEqual(req.setTimeout(0), req);
strictEqual(socket.listenerCount('timeout'), 0);
agent.destroy();
server.close();
});
res.resume();
});
req.on('socket', (sock) => {
socket = sock;
});
});
|