You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backport WebSocket maxPayloadSize fixes to v7.x (#5423)
* feat: add configurable maxPayloadSize for WebSocket (#4955)
(cherry picked from commit bd91f86)
Signed-off-by: Matteo Collina <hello@matteocollina.com>
* test: fix flaky permessage-deflate limit timeout (#5229)
(cherry picked from commit 9d82667)
Signed-off-by: Matteo Collina <hello@matteocollina.com>
* 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.
Co-authored-by: Matthew Aitken <maitken033380023@gmail.com>
(cherry picked from commit b4c287b)
Signed-off-by: Matteo Collina <hello@matteocollina.com>
* 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.
Co-authored-by: Ulises Gascon <ulisesgascongonzalez@gmail.com>
(cherry picked from commit c5ed787)
Signed-off-by: Matteo Collina <hello@matteocollina.com>
---------
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Co-authored-by: Matthew Aitken <maitken033380023@gmail.com>
Co-authored-by: Luigi Pinca <luigipinca@gmail.com>
Co-authored-by: Ulises Gascon <ulisesgascongonzalez@gmail.com>
Copy file name to clipboardExpand all lines: docs/docs/api/Client.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,8 @@ Returns: `Client`
25
25
***maxHeaderSize**`number | null` (optional) - Default: `--max-http-header-size` or `16384` - The maximum length of request headers in bytes. Defaults to Node.js' --max-http-header-size or 16KiB.
26
26
***maxResponseSize**`number | null` (optional) - Default: `-1` - The maximum length of response body in bytes. Set to `-1` to disable.
***maxFragments**`number` (optional) - Defailt: `131072` - Maximum number of fragments in a message. Set to 0 to disable the limit.
28
+
***maxFragments**`number` (optional) - Default: `131072` - Maximum number of fragments in a message. Set to 0 to disable the limit.
29
+
***maxPayloadSize**`number` (optional) - Default: `134217728` (128 MB) - Maximum allowed payload size in bytes for WebSocket messages. Applied to uncompressed messages, compressed frame payloads, and decompressed (permessage-deflate) messages. Set to 0 to disable the limit.
29
30
***pipelining**`number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
30
31
***connect**`ConnectOptions | Function | null` (optional) - Default: `null`.
31
32
***strictContentLength**`Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body. **Security Warning:** Disabling this option can expose your application to HTTP Request Smuggling attacks, where mismatched content-length headers cause servers and proxies to interpret request boundaries differently. This can lead to cache poisoning, credential hijacking, and bypassing security controls. Only disable this in controlled environments where you fully trust the request source.
0 commit comments