Skip to content

fix(http1): fix handling of 204/304 responses - #5864

Merged
mcollina merged 1 commit into
nodejs:mainfrom
jasnell:jasnell/fixup-http1-304-204
Sep 25, 2026
Merged

mcollina merged 1 commit into
nodejs:mainfrom
jasnell:jasnell/fixup-http1-304-204

Conversation

@jasnell

@jasnell jasnell commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

This relates to...

HTTP1

Rationale

204/304 responses don't have a payload but they may have Content-Length. Deliver the response but close the connection (unless it's a HEAD request).

Better match for RFC 9112 and RFC 9110.
Looks like #5816 did something similar for H2.
#5505 and #5516 are likely relevant here.

Spotted while doing an audit of the implementation.

Changes

204/304 responses with a Content-Length do not error but the connection is still dropped.

Features

N/A

Bug Fixes

Searched but didn't find specific reports.

Breaking Changes and Deprecations

Should be determined if this is technically breaking.

Status

204/304 responses don't have a payload but they may have
`Content-Length`. Deliver the response but close the
connection (unless it's a `HEAD` request).

Signed-off-by: James M Snell <jasnell@gmail.com>
@jasnell
jasnell marked this pull request as ready for review September 23, 2026 03:55
Comment thread lib/dispatcher/client-h1.js
@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.84%. Comparing base (77d7b3f) to head (2d2e97c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5864      +/-   ##
==========================================
- Coverage   93.85%   93.84%   -0.02%     
==========================================
  Files         110      110              
  Lines       39879    39891      +12     
==========================================
+ Hits        37428    37435       +7     
- Misses       2451     2456       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@metcoder95 metcoder95 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm. The change on the behavior seems reasonable as we align with a spec

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina
mcollina merged commit a287eff into nodejs:main Sep 25, 2026
36 of 38 checks passed
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.

4 participants