[libsoup/carlosgc/send-after-cancel] http2: return early on send headers or data after cancellation
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/carlosgc/send-after-cancel] http2: return early on send headers or data after cancellation
- Date: Wed, 21 Sep 2022 11:23:30 +0000 (UTC)
commit 86c4e678b585d6a09f1c56bf36ccab29cd6d45ef
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Wed Sep 21 13:01:23 2022 +0200
http2: return early on send headers or data after cancellation
Fixes #299
libsoup/http2/soup-client-message-io-http2.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 86d3f3ae..e7877401 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -830,11 +830,16 @@ on_frame_send_callback (nghttp2_session *session,
switch (frame->hd.type) {
case NGHTTP2_HEADERS:
- g_assert (data);
h2_debug (io, data, "[SEND] [HEADERS] category=%s finished=%d",
soup_http2_headers_category_to_string (frame->headers.cat),
(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS) ? 1 : 0);
+ if (!data) {
+ /* This can happen in case of cancellation */
+ io->in_callback--;
+ return 0;
+ }
+
if (data->metrics)
data->metrics->request_header_bytes_sent += frame->hd.length + FRAME_HEADER_SIZE;
@@ -847,7 +852,12 @@ on_frame_send_callback (nghttp2_session *session,
}
break;
case NGHTTP2_DATA:
- g_assert (data);
+ if (!data) {
+ /* This can happen in case of cancellation */
+ io->in_callback--;
+ return 0;
+ }
+
if (data->state < STATE_WRITE_DATA)
advance_state_from (data, STATE_WRITE_HEADERS, STATE_WRITE_DATA);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]