GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Backport WebSocket maxPayloadSize fixes to v7.x by mcollina · Pull Request #5423 · nodejs/undici

Conversation

@mcollina

@mcollina mcollina commented Jun 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This relates to...

Backporting WebSocket maxPayloadSize support and follow-up fixes from main to v7.x.

Backported commits:

  • bd91f86 - feat: add configurable maxPayloadSize for WebSocket (feat: add configurable maxPayloadSize for WebSocket #4955)
  • 9d82667 - test: fix flaky permessage-deflate limit timeout (test: fix flaky permessage-deflate limit timeout #5229)
  • b4c287b - fix(websocket): enforce max payload size across fragments
  • c5ed787 - websocket: handle empty fragments and stream limits

Related main commit 32dbf0b3 is not included because v7.x already contains the equivalent fragment-limit backport as 8cb10f98.

Rationale

Keeps the v7 release line aligned with main for configurable WebSocket payload limits, including enforcement across fragmented messages and WebSocketStream parser limits.

Changes

Features

  • Adds dispatcher webSocket.maxPayloadSize support with a 128 MB default and 0 to disable.
  • Documents and types the new option.
  • Preserves the existing v7 webSocket.maxFragments option while integrating the new payload limit.

Bug Fixes

  • Rejects oversized WebSocket payloads across uncompressed, compressed, and fragmented message paths.
  • Applies dispatcher WebSocket limits to WebSocketStream's parser.
  • Counts empty fragments toward maxFragments.
  • Includes the follow-up flaky-test timeout fix from main.

Breaking Changes and Deprecations

N/A

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Tests:

  • npm run test:typescript
  • node --test test/websocket/fragments.js test/websocket/stream/too-many-fragments.js test/websocket/permessage-deflate-limit.js test/websocket/permessage-deflate-config.js
  • npm run lint

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codecov-commenter

codecov-commenter commented Jun 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.10%. Comparing base (8cb10f9) to head (f49f6fa).

Additional details and impacted files
@@            Coverage Diff             @@
##             v7.x    #5423      +/-   ##
==========================================
+ Coverage   93.01%   93.10%   +0.08%     
==========================================
  Files         112      112              
  Lines       35983    36018      +35     
==========================================
+ Hits        33471    33535      +64     
+ Misses       2512     2483      -29     

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina
mcollina force-pushed the backport/websocket-max-payload-size-v7 branch from a708dc8 to a6824f7 Compare June 13, 2026 14:51
mcollina and others added 3 commits June 15, 2026 09:02
@mcollina
feat: add configurable maxPayloadSize for WebSocket (#4955)
5a31d7e
(cherry picked from commit bd91f86)
Signed-off-by: Matteo Collina <[email protected]>
@mcollina
test: fix flaky permessage-deflate limit timeout (#5229)
b9139e2
(cherry picked from commit 9d82667)
Signed-off-by: Matteo Collina <[email protected]>
@mcollina @KhafraDev
fix(websocket): enforce max payload size across fragments
b4eb7db
Account for previously received fragment bytes when checking WebSocket payload size limits, so fragmented messages cannot exceed maxPayloadSize by splitting the payload across frames.

Add coverage for cumulative fragmented payload size enforcement.

Co-authored-by: Matthew Aitken <[email protected]>
(cherry picked from commit b4c287b)
Signed-off-by: Matteo Collina <[email protected]>
@mcollina
mcollina force-pushed the backport/websocket-max-payload-size-v7 branch from a6824f7 to b4eb7db Compare June 15, 2026 07:15
@lpinca @UlisesGascon @mcollina
websocket: handle empty fragments and stream limits
f49f6fa
Treat zero-byte frames as real fragments so fragmented messages can start
with an empty frame and empty continuations still count toward
maxFragments.

Pass dispatcher WebSocket limits through to WebSocketStream's parser, add
regression coverage for WebSocket and WebSocketStream fragment limits, make
the fragment close tests wait for both endpoints, and fix the Client docs
typo for maxFragments.

Co-authored-by: Ulises Gascon <[email protected]>
(cherry picked from commit c5ed787)
Signed-off-by: Matteo Collina <[email protected]>
@mcollina
mcollina merged commit a027a4a into v7.x Jun 15, 2026
69 of 71 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mcollina
mcollina deleted the backport/websocket-max-payload-size-v7 branch June 15, 2026 09:53
mcollina added a commit that referenced this pull request Jun 15, 2026
@mcollina @KhafraDev
@lpinca @UlisesGascon
Backport WebSocket maxPayloadSize fixes to v7.x (#5423) (#5428)
b7f252e
* feat: add configurable maxPayloadSize for WebSocket (#4955)

(cherry picked from commit bd91f86)


* test: fix flaky permessage-deflate limit timeout (#5229)

(cherry picked from commit 9d82667)


* fix(websocket): enforce max payload size across fragments

Account for previously received fragment bytes when checking WebSocket payload size limits, so fragmented messages cannot exceed maxPayloadSize by splitting the payload across frames.

Add coverage for cumulative fragmented payload size enforcement.


(cherry picked from commit b4c287b)


* websocket: handle empty fragments and stream limits

Treat zero-byte frames as real fragments so fragmented messages can start
with an empty frame and empty continuations still count toward
maxFragments.

Pass dispatcher WebSocket limits through to WebSocketStream's parser, add
regression coverage for WebSocket and WebSocketStream fragment limits, make
the fragment close tests wait for both endpoints, and fix the Client docs
typo for maxFragments.


(cherry picked from commit c5ed787)


---------

Signed-off-by: Matteo Collina <[email protected]>
Co-authored-by: Matthew Aitken <[email protected]>
Co-authored-by: Luigi Pinca <[email protected]>
Co-authored-by: Ulises Gascon <[email protected]>
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
[Release] v7.28.0 #5430
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mcollina @codecov-commenter @lpinca
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.