Closed
Description
- Version: v10.1.0
- Platform: Linux archPC 4.16.8-1-ARCH #1 SMP PREEMPT Wed May 9 11:25:02 UTC 2018 x86_64 GNU/Linux
- Subsystem: http
I want to completely disable Keep-Alive, so I use setKeepAlive(false)
, but it does not have any effect. Server code:
var http = require('http')
var server = http.createServer(function(req, res) {
res.end('Hello Node.js Server!')
})
server.on('connection', function(socket) {
socket.setKeepAlive(false)
})
server.listen(8080)
I tested it with browser and telnet:
$ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET / HTTP/1.1
HTTP/1.1 200 OK
Date: Thu, 17 May 2018 21:05:25 GMT
Connection: keep-alive
Content-Length: 21
Hello Node.js Server!
As you can see, there is Connection: keep-alive
header. I also tried Node.js v8.11.2 and issue was still present.