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

fix: only set keep-alive header before Node.js 14.8.0 #4457

Merged
merged 1 commit into from Sep 8, 2020

Conversation

atian25
Copy link
Member

@atian25 atian25 commented Sep 7, 2020

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

Node.js 14.8.0 will set Keep-Alive header, so it'll be dup

image

unittest is here: https://github.com/eggjs/egg/blob/master/test/app/middleware/meta.test.js#L67

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') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单测是否有?加上单测确保只会设置一次 header

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@codecov
Copy link

codecov bot commented Sep 7, 2020

Codecov Report

Merging #4457 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #4457   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           34        34           
  Lines          955       957    +2     
=========================================
+ Hits           955       957    +2     
Impacted Files Coverage Δ
app/middleware/meta.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7ae46c...bd5cb2d. Read the comment docs.

app/middleware/meta.js Outdated Show resolved Hide resolved
@fengmk2 fengmk2 merged commit d25d32e into master Sep 8, 2020
@fengmk2 fengmk2 deleted the keep-alive-header branch September 8, 2020 03:01
@fengmk2
Copy link
Member

fengmk2 commented Sep 8, 2020

@atian25 你来发版本

@atian25
Copy link
Member Author

atian25 commented Sep 8, 2020

#4421 一起发

popomore pushed a commit that referenced this pull request Sep 8, 2020
fix: only set keep-alive header before Node.js 14.8.0 (#4457)
@atian25
Copy link
Member Author

atian25 commented Oct 9, 2020

@qingdengyue
Copy link
Contributor

12跟14都merge了 keep_alive 的代码。现在在12上keep_alive会设置两次。

@atian25
Copy link
Member Author

atian25 commented Oct 9, 2020

哪个 PR? 14 那个我提的,node 本身会判断,不会设置两次的

@qingdengyue
Copy link
Contributor

qingdengyue commented Oct 10, 2020

@atian25
Copy link
Member Author

atian25 commented Oct 10, 2020

@qingdengyue 可以去蹭个 PR 了,把我那个 backport 回去 12 吧

@qingdengyue
Copy link
Contributor

@atian25 已提交

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants