soup: Use soup_session_new() to avoid deprecation warning
authorTobias Brunner <tobias@strongswan.org>
Thu, 12 Dec 2019 16:29:08 +0000 (17:29 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 5 Feb 2020 09:49:35 +0000 (10:49 +0100)
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
src/libstrongswan/tests/suites/test_fetch_http.c
src/libstrongswan/utils/leak_detective.c

index 99525cb..ce4faff 100644 (file)
@@ -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);
 
index 9f1eef2..8bbc525 100644 (file)
@@ -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;
index d4ebfea..fca1454 100644 (file)
@@ -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 */