]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2: do not delay RST send on aborted transfer
authorStefan Eissing <stefan@eissing.org>
Mon, 16 Jun 2025 11:05:20 +0000 (13:05 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 17 Jun 2025 09:57:56 +0000 (11:57 +0200)
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

lib/http2.c

index 9dacb898e6f6bb574df49c4ab0cb65fbcba71d6c..1e583e89dc7f958535a94ce50294381e5c1bf016 100644 (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);