summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2022-08-30 12:18:28 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2022-09-02 12:03:42 +0200
commitcc91759dbb011b59a872670d3bb789214d9201f0 (patch)
treea96ca2a97ed9af11b9573851ff42785ebfec9e64
parent904199f114445c6c182e4a8db2cd849fe9529bc4 (diff)
downloadlibsoup-cc91759dbb011b59a872670d3bb789214d9201f0.tar.gz
http2: finish the message IO when request is cancelled
-rw-r--r--libsoup/http2/soup-client-message-io-http2.c1
-rw-r--r--tests/http2-test.c8
2 files changed, 3 insertions, 6 deletions
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index b05fe299..48ba7d5c 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -314,6 +314,7 @@ soup_http2_message_data_check_status (SoupHTTP2MessageData *data)
if (g_cancellable_set_error_if_cancelled (g_task_get_cancellable (task), &error)) {
io->pending_io_messages = g_list_remove (io->pending_io_messages, data);
data->task = NULL;
+ soup_client_message_io_http2_finished ((SoupClientMessageIO *)io, msg);
g_task_return_error (task, error);
g_object_unref (task);
return;
diff --git a/tests/http2-test.c b/tests/http2-test.c
index 689fa2f5..b0e5bbc2 100644
--- a/tests/http2-test.c
+++ b/tests/http2-test.c
@@ -217,12 +217,8 @@ do_cancellation_test (Test *test, gconstpointer data)
soup_session_send_and_read_async (test->session, msg, G_PRIORITY_DEFAULT, cancellable,
(GAsyncReadyCallback)on_send_and_read_cancelled_complete, &done);
- /* Just iterate until a partial read is happening */
- for (guint i = 100000; i; i--)
- g_main_context_iteration (async_context, FALSE);
-
- /* Then cancel everything */
- g_cancellable_cancel (cancellable);
+ /* Cancel right after getting the headers */
+ g_signal_connect_swapped (msg, "got-headers", G_CALLBACK (g_cancellable_cancel), cancellable);
while (!done)
g_main_context_iteration (async_context, FALSE);