(withPipeline, cb)
| 24 | } |
| 25 | |
| 26 | function serverTest(withPipeline, cb) { |
| 27 | let gotAll = false; |
| 28 | let timedout = false; |
| 29 | const server = http.createServer(common.mustCall((req, res) => { |
| 30 | if (withPipeline) |
| 31 | res.end(); |
| 32 | if (req.url === '/3') { |
| 33 | gotAll = true; |
| 34 | if (timedout) |
| 35 | done(server, req.socket, cb); |
| 36 | } |
| 37 | }, 3)); |
| 38 | server.setTimeout(500, common.mustCallAtLeast((socket) => { |
| 39 | // End this test and call `run()` for the next test (if any). |
| 40 | timedout = true; |
| 41 | if (gotAll) |
| 42 | done(server, socket, cb); |
| 43 | })); |
| 44 | server.keepAliveTimeout = 50; |
| 45 | server.listen(0, common.mustCall(() => { |
| 46 | const options = { |
| 47 | port: server.address().port, |
| 48 | allowHalfOpen: true |
| 49 | }; |
| 50 | const c = net.connect(options, () => { |
| 51 | c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); |
| 52 | c.write('GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n'); |
| 53 | c.write('GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n'); |
| 54 | }); |
| 55 | })); |
| 56 | } |
| 57 | |
| 58 | test(function serverEndKeepAliveTimeoutWithPipeline(cb) { |
| 59 | serverTest(true, cb); |
no test coverage detected
searching dependent graphs…