[gnome-software/1001-packagekit-receives-proxy_http-8080-when-proxy-host-is-empty: 3/3] gs-plugin-packagekit-proxy: Skip the setting when the host is empty




commit 7f85adf0dba588acc1d2414510e0a5dd879b835d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 21 12:14:34 2021 +0100

    gs-plugin-packagekit-proxy: Skip the setting when the host is empty
    
    It avoids to set invalid proxy URL to the PackageKit.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1001

 plugins/packagekit/gs-plugin-packagekit-proxy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit-proxy.c b/plugins/packagekit/gs-plugin-packagekit-proxy.c
index a5bbcc7f..8c383893 100644
--- a/plugins/packagekit/gs-plugin-packagekit-proxy.c
+++ b/plugins/packagekit/gs-plugin-packagekit-proxy.c
@@ -45,7 +45,7 @@ get_proxy_http (GsPlugin *plugin)
                return NULL;
 
        host = g_settings_get_string (priv->settings_http, "host");
-       if (host == NULL)
+       if (host == NULL || host[0] == '\0')
                return NULL;
 
        port = g_settings_get_int (priv->settings_http, "port");
@@ -88,7 +88,7 @@ get_proxy_https (GsPlugin *plugin)
                return NULL;
 
        host = g_settings_get_string (priv->settings_https, "host");
-       if (host == NULL)
+       if (host == NULL || host[0] == '\0')
                return NULL;
        port = g_settings_get_int (priv->settings_https, "port");
        if (port == 0)
@@ -115,7 +115,7 @@ get_proxy_ftp (GsPlugin *plugin)
                return NULL;
 
        host = g_settings_get_string (priv->settings_ftp, "host");
-       if (host == NULL)
+       if (host == NULL || host[0] == '\0')
                return NULL;
        port = g_settings_get_int (priv->settings_ftp, "port");
        if (port == 0)
@@ -142,7 +142,7 @@ get_proxy_socks (GsPlugin *plugin)
                return NULL;
 
        host = g_settings_get_string (priv->settings_socks, "host");
-       if (host == NULL)
+       if (host == NULL || host[0] == '\0')
                return NULL;
        port = g_settings_get_int (priv->settings_socks, "port");
        if (port == 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]