Skip to content

Commit 4a3531c

Browse files
committed
fixup
1 parent 76d03a7 commit 4a3531c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/client.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,13 @@ class Parser {
714714
this.statusCode = statusCode
715715
this.shouldKeepAlive = (
716716
shouldKeepAlive ||
717-
// Override llhttp value which does not allow keepAlive for HEAD.
718-
(request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
717+
// Override llhttp value which does not allow keepAlive for HEAD and 204 and 304
718+
// responses.
719+
(
720+
(request.method === 'HEAD' || this.statusCode === 204 || this.statusCode === 304) &&
721+
!socket[kReset] &&
722+
this.connection.toLowerCase() === 'keep-alive'
723+
)
719724
)
720725

721726
if (this.statusCode >= 200) {

0 commit comments

Comments
 (0)