[libsoup] io-http2: reset the stream on io skip



commit f7ab9583430ee344aa87c4d7be9dae117e5c22b0
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu May 20 15:24:52 2021 +0200

    io-http2: reset the stream on io skip
    
    In HTTP/2 we don't really need to read the rest of the response body to
    complete the IO, we can just reset the stream.

 libsoup/http2/soup-client-message-io-http2.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index bea7136a..615f7763 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -1220,8 +1220,18 @@ soup_client_message_io_http2_skip (SoupClientMessageIO *iface,
                                    GError             **error)
 {
         SoupClientMessageIOHTTP2 *io = (SoupClientMessageIOHTTP2 *)iface;
+        SoupHTTP2MessageData *data;
+
+        if (g_cancellable_set_error_if_cancelled (cancellable, error))
+                return FALSE;
 
-        return io_run_until (io, msg, blocking, STATE_READ_DONE, cancellable, error);
+        data = get_data_for_message (io, msg);
+        if (!data || data->state == STATE_READ_DONE)
+                return TRUE;
+
+        h2_debug (io, data, "Skip");
+        NGCHECK (nghttp2_submit_rst_stream (io->session, NGHTTP2_FLAG_NONE, data->stream_id, 
NGHTTP2_STREAM_CLOSED));
+        return TRUE;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]