[libsoup/libsoup-3-0] http2: handle connection terminated unexpectedly error when reading



commit 34848a9ca02a5fd8f53407a6538490353702b676
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Mon Aug 29 09:21:44 2022 +0200

    http2: handle connection terminated unexpectedly error when reading

 libsoup/http2/soup-client-message-io-http2.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 17a70f59..81ab185a 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -456,10 +456,17 @@ io_read (SoupClientMessageIOHTTP2  *io,
                                             blocking, cancellable, error)) < 0)
             return FALSE;
 
+        if (read == 0) {
+                g_set_error_literal (error, G_IO_ERROR,
+                                     G_IO_ERROR_PARTIAL_INPUT,
+                                     _("Connection terminated unexpectedly"));
+                return FALSE;
+        }
+
         g_warn_if_fail (io->in_callback == 0);
         ret = nghttp2_session_mem_recv (io->session, buffer, read);
         NGCHECK (ret);
-        return ret != 0;
+        return ret > 0;
 }
 
 static gboolean


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