From 26b7ca924b1cb196e10ac1780e2d2ab736db85bf Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 11 Aug 2015 20:02:03 +0100 Subject: Remove an unused exported method --- libappstream-glib/as-self-test.c | 15 --------- libappstream-glib/as-utils.c | 70 ---------------------------------------- libappstream-glib/as-utils.h | 3 -- 3 files changed, 88 deletions(-) diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index 594ffb9..c014cc2 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -3491,21 +3491,6 @@ as_test_utils_func (void) g_assert_cmpstr (tmp, ==, NULL); g_clear_error (&error); - /* invalid URLs */ - ret = as_utils_check_url_exists ("hello dave", 1, &error); - g_assert (!ret); - g_assert (error != NULL); - g_clear_error (&error); - ret = as_utils_check_url_exists ("http://www.bbc.co.uk/notgoingtoexist", 1, &error); - g_assert (!ret); - g_assert (error != NULL); - g_clear_error (&error); - - /* valid URLs */ - //ret = as_utils_check_url_exists ("http://www.bbc.co.uk/", &error); - //g_assert (ret); - //g_assert_no_error (error); - /* valid tokens */ g_assert (as_utils_search_token_valid ("battery")); g_assert (!as_utils_search_token_valid ("and")); diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c index 4b31e50..a3d9299 100644 --- a/libappstream-glib/as-utils.c +++ b/libappstream-glib/as-utils.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -649,75 +648,6 @@ as_utils_is_spdx_license (const gchar *license) return TRUE; } -/** - * as_utils_check_url_exists: - * @url: the URL to check. - * @timeout: the timeout in seconds. - * @error: A #GError or %NULL - * - * Checks to see if a URL is reachable. - * - * Returns: %TRUE if the URL was reachable and pointed to a non-zero-length file. - * - * Since: 0.1.5 - **/ -gboolean -as_utils_check_url_exists (const gchar *url, guint timeout, GError **error) -{ - _cleanup_object_unref_ SoupMessage *msg = NULL; - _cleanup_object_unref_ SoupSession *session = NULL; - _cleanup_uri_unref_ SoupURI *base_uri = NULL; - - /* GET file */ - base_uri = soup_uri_new (url); - if (base_uri == NULL) { - g_set_error_literal (error, - AS_NODE_ERROR, - AS_NODE_ERROR_FAILED, - "URL not valid"); - return FALSE; - } - msg = soup_message_new_from_uri (SOUP_METHOD_GET, base_uri); - if (msg == NULL) { - g_set_error_literal (error, - AS_NODE_ERROR, - AS_NODE_ERROR_FAILED, - "Failed to setup message"); - return FALSE; - } - session = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT, - "libappstream-glib", - SOUP_SESSION_TIMEOUT, - timeout, - NULL); - if (session == NULL) { - g_set_error_literal (error, - AS_NODE_ERROR, - AS_NODE_ERROR_FAILED, - "Failed to set up networking"); - return FALSE; - } - - /* send sync */ - if (soup_session_send_message (session, msg) != SOUP_STATUS_OK) { - g_set_error_literal (error, - AS_NODE_ERROR, - AS_NODE_ERROR_FAILED, - msg->reason_phrase); - return FALSE; - } - - /* check if it's a zero sized file */ - if (msg->response_body->length == 0) { - g_set_error (error, - AS_NODE_ERROR, - AS_NODE_ERROR_FAILED, - "Returned a zero length file"); - return FALSE; - } - return TRUE; -} - /** * as_pixbuf_blur_private: **/ diff --git a/libappstream-glib/as-utils.h b/libappstream-glib/as-utils.h index 26c819b..aa0baf4 100644 --- a/libappstream-glib/as-utils.h +++ b/libappstream-glib/as-utils.h @@ -107,9 +107,6 @@ gboolean as_utils_is_category_id (const gchar *category_id); gboolean as_utils_is_blacklisted_id (const gchar *desktop_id); gchar **as_utils_spdx_license_tokenize (const gchar *license); gchar *as_utils_spdx_license_detokenize (gchar **license_tokens); -gboolean as_utils_check_url_exists (const gchar *url, - guint timeout, - GError **error); gchar *as_utils_find_icon_filename (const gchar *destdir, const gchar *search, GError **error); -- cgit v1.2.1