-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: only set keep-alive header before Node.js 14.8.0 #4457
Conversation
const server = ctx.app.server; | ||
if (server && server.keepAliveTimeout && server.keepAliveTimeout >= 1000 && ctx.header.connection !== 'close') { | ||
if (shouldPatchKeepAliveHeader && server && server.keepAliveTimeout && server.keepAliveTimeout >= 1000 && ctx.header.connection !== 'close') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
单测是否有?加上单测确保只会设置一次 header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #4457 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 34 34
Lines 955 957 +2
=========================================
+ Hits 955 957 +2
Continue to review full report at Codecov.
|
37ebd24
to
bd5cb2d
Compare
@atian25 你来发版本 |
等 #4421 一起发 |
fix: only set keep-alive header before Node.js 14.8.0 (#4457)
12跟14都merge了 keep_alive 的代码。现在在12上keep_alive会设置两次。 |
哪个 PR? 14 那个我提的,node 本身会判断,不会设置两次的 |
v12.19.0 proposal nodejs/node#35401 |
@qingdengyue 可以去蹭个 PR 了,把我那个 backport 回去 12 吧 |
@atian25 已提交 |
Checklist
npm test
passesAffected core subsystem(s)
Description of change
Node.js 14.8.0 will set Keep-Alive header, so it'll be dup
unittest is here: https://github.com/eggjs/egg/blob/master/test/app/middleware/meta.test.js#L67