Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable Keep-Alive #20807

Closed
koxu1996 opened this issue May 17, 2018 · 3 comments
Closed

Cannot disable Keep-Alive #20807

koxu1996 opened this issue May 17, 2018 · 3 comments
Labels
http Issues or PRs related to the http subsystem. question Issues that look for answers. wrong repo Issues that should be opened in another repository.

Comments

@koxu1996
Copy link

koxu1996 commented May 17, 2018

  • 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.

@bnoordhuis bnoordhuis added question Issues that look for answers. http Issues or PRs related to the http subsystem. wrong repo Issues that should be opened in another repository. labels May 17, 2018
@bnoordhuis
Copy link
Member

Please post questions to nodejs/help.

@koxu1996
Copy link
Author

@bnoordhuis I reported that setKeepAlive() does not works and it is not a question.

@bnoordhuis
Copy link
Member

It's a question because you can find the answer in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. question Issues that look for answers. wrong repo Issues that should be opened in another repository.
Projects
None yet
Development

No branches or pull requests

2 participants