websocket: pause writing and meta data fix

When writing a decoded chunk of websocket data, always flush the writer
chain so that buffered data gets delivered before the ws meta data gets
updated.

Add client writer flags CURL_CW_FLAG_BLOWUP for writer types that may
significantly enlarge write sizes. This flag causes the pause writer to
be added and shrinks the write chunk sizes. We do not want that for
content decoders like WS that do not change the size.

Add test_20_13 to check that large frames are paused/unpaused correctly
with the matching meta data.

Fixes #22413
Reported-by: Hendrik Hübner
Closes #22416
This commit is contained in:
Stefan Eissing 2026-07-28 14:27:13 +02:00 committed by Daniel Stenberg
parent 53565fbfd6
commit 3974491c97
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
11 changed files with 64 additions and 23 deletions

View file

@ -297,6 +297,7 @@ static void deflate_do_close(struct Curl_easy *data,
static const struct Curl_cwtype deflate_encoding = {
"deflate",
NULL,
CURL_CW_FLAG_BLOWUP,
deflate_do_init,
deflate_do_write,
Curl_cwriter_def_flush,
@ -359,6 +360,7 @@ static void gzip_do_close(struct Curl_easy *data,
static const struct Curl_cwtype gzip_encoding = {
"gzip",
"x-gzip",
CURL_CW_FLAG_BLOWUP,
gzip_do_init,
gzip_do_write,
Curl_cwriter_def_flush,
@ -493,6 +495,7 @@ static void brotli_do_close(struct Curl_easy *data,
static const struct Curl_cwtype brotli_encoding = {
"br",
NULL,
CURL_CW_FLAG_BLOWUP,
brotli_do_init,
brotli_do_write,
Curl_cwriter_def_flush,
@ -607,6 +610,7 @@ static void zstd_do_close(struct Curl_easy *data,
static const struct Curl_cwtype zstd_encoding = {
"zstd",
NULL,
CURL_CW_FLAG_BLOWUP,
zstd_do_init,
zstd_do_write,
Curl_cwriter_def_flush,
@ -619,6 +623,7 @@ static const struct Curl_cwtype zstd_encoding = {
static const struct Curl_cwtype identity_encoding = {
"identity",
"none",
0,
Curl_cwriter_def_init,
Curl_cwriter_def_write,
Curl_cwriter_def_flush,
@ -707,6 +712,7 @@ static void error_do_close(struct Curl_easy *data,
static const struct Curl_cwtype error_writer = {
"ce-error",
NULL,
0,
error_do_init,
error_do_write,
Curl_cwriter_def_flush,