http2: do not delay RST send on aborted transfer

When a transfer is done prematurely, a RST is generated to the server,
but was not send right away due to send buffering.

Flush the send buffer in a best effort when transfer is done.

Reported-by: Michael Kaufmann
Fixes #17611
Closes #17638
This commit is contained in:
Stefan Eissing 2025-06-16 13:05:20 +02:00 committed by Viktor Szakats
parent 539d11297d
commit 1454aa17d6
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View file

@ -205,6 +205,9 @@ static void cf_h2_ctx_close(struct cf_h2_ctx *ctx)
}
}
static CURLcode nw_out_flush(struct Curl_cfilter *cf,
struct Curl_easy *data);
static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
struct Curl_easy *data);
@ -449,8 +452,10 @@ static void http2_data_done(struct Curl_cfilter *cf, struct Curl_easy *data)
flush_egress = TRUE;
}
if(flush_egress)
nghttp2_session_send(ctx->h2);
if(flush_egress) {
(void)nghttp2_session_send(ctx->h2);
(void)nw_out_flush(cf, data);
}
}
Curl_uint_hash_remove(&ctx->streams, data->mid);