From 0f141fb095a41a9fdfe5c111269eb643dc643494 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 12 Dec 2019 17:29:08 +0100 Subject: [PATCH] soup: Use soup_session_new() to avoid deprecation warning There are a ton of libsoup/GLib-related "leaks" that we can't whitelist and with leak detective active there is a delay that interestingly doesn't happen with soup_session_sync_new(), so tests failed with a timeout (actually they hung due to the lock in the fetcher manager). On Travis, the curl plugin is used for the tests, so that's not an issue there (and without LD the tests complete quickly and successfully). --- src/libstrongswan/plugins/soup/soup_fetcher.c | 2 +- src/libstrongswan/tests/suites/test_fetch_http.c | 3 +++ src/libstrongswan/utils/leak_detective.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libstrongswan/plugins/soup/soup_fetcher.c b/src/libstrongswan/plugins/soup/soup_fetcher.c index 99525cb79..ce4faffdd 100644 --- a/src/libstrongswan/plugins/soup/soup_fetcher.c +++ b/src/libstrongswan/plugins/soup/soup_fetcher.c @@ -118,7 +118,7 @@ METHOD(fetcher_t, fetch, status_t, soup_message_set_http_version(message, this->version); soup_message_body_set_accumulate(message->response_body, FALSE); g_signal_connect(message, "got-chunk", G_CALLBACK(soup_cb), &data); - data.session = soup_session_sync_new(); + data.session = soup_session_new(); g_object_set(G_OBJECT(data.session), SOUP_SESSION_TIMEOUT, (guint)this->timeout, NULL); diff --git a/src/libstrongswan/tests/suites/test_fetch_http.c b/src/libstrongswan/tests/suites/test_fetch_http.c index 9f1eef2f3..8bbc52549 100644 --- a/src/libstrongswan/tests/suites/test_fetch_http.c +++ b/src/libstrongswan/tests/suites/test_fetch_http.c @@ -313,14 +313,17 @@ Suite *fetch_http_suite_create() tc = tcase_create("GET"); tcase_add_loop_test(tc, test_get, 0, countof(gtests)); + test_case_set_timeout(tc, 10); suite_add_tcase(s, tc); tc = tcase_create("POST"); tcase_add_loop_test(tc, test_post, 0, countof(ptests)); + test_case_set_timeout(tc, 10); suite_add_tcase(s, tc); tc = tcase_create("response code"); tcase_add_loop_test(tc, test_response_code, 0, countof(rtests)); + test_case_set_timeout(tc, 10); suite_add_tcase(s, tc); return s; diff --git a/src/libstrongswan/utils/leak_detective.c b/src/libstrongswan/utils/leak_detective.c index d4ebfeac7..fca145469 100644 --- a/src/libstrongswan/utils/leak_detective.c +++ b/src/libstrongswan/utils/leak_detective.c @@ -557,12 +557,15 @@ static char *whitelist[] = { /* libcurl */ "Curl_client_write", /* libsoup */ + "soup_add_timeout", + "soup_headers_parse_response", "soup_message_headers_append", "soup_message_headers_clear", "soup_message_headers_get_list", "soup_message_headers_get_one", "soup_session_abort", "soup_session_get_type", + "soup_session_remove_feature", /* libldap */ "ldap_int_initialize", /* ClearSilver */