Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Jan 17, 2023
1 parent 76d03a7 commit 4a3531c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,13 @@ class Parser {
this.statusCode = statusCode
this.shouldKeepAlive = (
shouldKeepAlive ||
// Override llhttp value which does not allow keepAlive for HEAD.
(request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
// Override llhttp value which does not allow keepAlive for HEAD and 204 and 304
// responses.
(
(request.method === 'HEAD' || this.statusCode === 204 || this.statusCode === 304) &&
!socket[kReset] &&
this.connection.toLowerCase() === 'keep-alive'
)
)

if (this.statusCode >= 200) {
Expand Down

0 comments on commit 4a3531c

Please sign in to comment.