Skip to content

fix(client): ignore unsolicited 100 Continue responses - #6242

Open
utsxvrai wants to merge 1 commit into
nodejs:mainfrom
utsxvrai:fix/ignore-unsolicited-100-continue
Open

utsxvrai wants to merge 1 commit into
nodejs:mainfrom
utsxvrai:fix/ignore-unsolicited-100-continue

Conversation

@utsxvrai

@utsxvrai utsxvrai commented Nov 21, 2026 •

Copy link
Copy Markdown

This relates to...

Fixes #5899

Rationale

When an HTTP/1.1 server sends a 100 Continue that the client never asked for (no Expect: 100-continue), undici destroys the socket with SocketError: bad response. RFC 9110 §15.2.1 lets a client discard such a response, browsers move on to the final response, and our README ("Expect" section) already says the 100 is ignored. This is the same idea as #5918, which was closed without review.

Changes

Features

N/A

Bug Fixes

  • client-h1: drop the special case that treated a 100 status as a bad response. It now goes through the same path as other 1xx informational responses, and the final response plus connection reuse work as expected.
  • test/http-100.js: the error 100 body test asserted the old behaviour; replaced it with ignore unsolicited 100 response.
  • Added test/issue-5899.js covering Client (including keep-alive reuse) and fetch.

Breaking Changes and Deprecations

N/A

Tests

  • node --test test/issue-5899.js test/http-100.js test/http2-informational.js: 8/8 pass (issue-5899 fails on main with bad response)
  • node --test test/client*.js test/http-*.js test/issue-*.js test/request*.js test/pipeline*.js test/fetch/client-fetch.js: 501 tests, 0 failures
  • eslint clean on changed files

AI assistance: the code and tests were generated with a coding agent; I verified them by running the tests listed above and reviewing the diff.

Status

An HTTP/1.1 100 response received without an Expect: 100-continue request
was treated as a bad response and destroyed the socket. RFC 9110 15.2.1
allows a client to discard it, and the README already documents that it
is ignored. Handle it like any other 1xx informational response.

Fixes: nodejs#5899
Signed-off-by: utsxvrai <utsavrai2115@gmail.com>

@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

@codecov-commenter

codecov-commenter commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.74%. Comparing base (5d7f657) to head (2343316).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6242      +/-   ##
==========================================
- Coverage   91.74%   91.74%   -0.01%     
==========================================
  Files         113      113              
  Lines       44849    44844       -5     
==========================================
- Hits        41147    41141       -6     
- Misses       3702     3703       +1     

☔ 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.

This branch has not been deployed

No deployments
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.

Fetch should ignore unsolicited 100 Continue responses

3 participants