diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-12-20 11:33:56 +0100 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-12-20 11:33:56 +0100 |
commit | 183a36b7dbd22b6d58ba7f58c006ffc600131c35 (patch) | |
tree | 3b6e2ba11378b1e024664c077346aa121e0d7aa0 /tests | |
parent | 9b2435c42870636b0007129cdb1f40a2c66eaacb (diff) | |
download | libsoup-183a36b7dbd22b6d58ba7f58c006ffc600131c35.tar.gz |
http2: check status of pending messages after a read IO error
Fixes #256
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/http2-server.py | 6 | ||||
-rw-r--r-- | tests/http2-test.c | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/http2-server.py b/tests/http2-server.py index 977aff15..adccc2ea 100755 --- a/tests/http2-server.py +++ b/tests/http2-server.py @@ -44,6 +44,12 @@ async def slow(): await asyncio.sleep(1) return 'Hello world' +@app.route('/timeout') +async def timeout(): + set_timeout() + await asyncio.sleep(4) + return 'Hello world' + @app.route('/no-content') async def no_content(): set_timeout() diff --git a/tests/http2-test.c b/tests/http2-test.c index c566505a..8ac00173 100644 --- a/tests/http2-test.c +++ b/tests/http2-test.c @@ -994,6 +994,25 @@ do_sniffer_sync_test (Test *test, gconstpointer data) do_one_sniffer_test (test->session, "https://127.0.0.1:5000/no-content", 0, FALSE, NULL); } +static void +do_timeout_test (Test *test, gconstpointer data) +{ + SoupMessage *msg; + GBytes *response; + GError *error = NULL; + + soup_session_set_timeout (test->session, 2); + + msg = soup_message_new (SOUP_METHOD_GET, "https://127.0.0.1:5000/timeout"); + response = soup_test_session_async_send (test->session, msg, NULL, &error); + g_assert_null (response); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT); + g_object_unref (msg); + + while (g_main_context_pending (NULL)) + g_main_context_iteration (NULL, FALSE); +} + int main (int argc, char **argv) { @@ -1102,6 +1121,10 @@ main (int argc, char **argv) setup_session, do_sniffer_sync_test, teardown_session); + g_test_add ("/http2/timeout", Test, NULL, + setup_session, + do_timeout_test, + teardown_session); ret = g_test_run (); |