diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2022-08-30 12:18:28 +0200 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2022-08-30 12:18:28 +0200 |
commit | edcc9eb6f47cc76d871951bf67b8e00e0c897460 (patch) | |
tree | 8063f129da4efd03b99f07e1df93d060fd5d1673 | |
parent | 2696fc8ddfd9237f8844452c6f8a12f6a612b97a (diff) | |
download | libsoup-edcc9eb6f47cc76d871951bf67b8e00e0c897460.tar.gz |
http2: finish the message IO when request is cancelled
-rw-r--r-- | libsoup/http2/soup-client-message-io-http2.c | 1 | ||||
-rw-r--r-- | tests/http2-test.c | 8 |
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 498b3e69..cb4c65d7 100644 --- a/libsoup/http2/soup-client-message-io-http2.c +++ b/libsoup/http2/soup-client-message-io-http2.c @@ -217,6 +217,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 be7fc43a..c11b245e 100644 --- a/tests/http2-test.c +++ b/tests/http2-test.c @@ -247,12 +247,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 = 10; i; i--) - g_main_context_iteration (async_context, TRUE); - - /* 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); |