[glib-networking] proxy/gnome: fix to work with no http proxy



commit 4f73daf7b756bc10f6f6a8b4522bd79d061cad98
Author: Dan Winship <danw gnome org>
Date:   Tue Apr 24 21:12:21 2012 -0400

    proxy/gnome: fix to work with no http proxy
    
    In "manual" mode, the http proxy setting was always being used, even
    if it was "". Fix that.

 proxy/gnome/gproxyresolvergnome.c |   39 +++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/proxy/gnome/gproxyresolvergnome.c b/proxy/gnome/gproxyresolvergnome.c
index c97fa1f..3c4d63c 100644
--- a/proxy/gnome/gproxyresolvergnome.c
+++ b/proxy/gnome/gproxyresolvergnome.c
@@ -318,26 +318,29 @@ update_settings (GProxyResolverGnome *resolver)
   host = g_settings_get_string (resolver->http_settings, GNOME_PROXY_HTTP_HOST_KEY);
   port = g_settings_get_int (resolver->http_settings, GNOME_PROXY_HTTP_PORT_KEY);
 
-  if (g_settings_get_boolean (resolver->http_settings, GNOME_PROXY_HTTP_USE_AUTH_KEY))
+  if (host && *host)
     {
-      gchar *user, *password;
-      gchar *enc_user, *enc_password;
-
-      user = g_settings_get_string (resolver->http_settings, GNOME_PROXY_HTTP_USER_KEY);
-      enc_user = g_uri_escape_string (user, NULL, TRUE);
-      g_free (user);
-      password = g_settings_get_string (resolver->http_settings, GNOME_PROXY_HTTP_PASSWORD_KEY);
-      enc_password = g_uri_escape_string (password, NULL, TRUE);
-      g_free (password);
-
-      resolver->http_proxy = g_strdup_printf ("http://%s:%s %s:%u",
-					      enc_user, enc_password,
-					      host, port);
-      g_free (enc_user);
-      g_free (enc_password);
+      if (g_settings_get_boolean (resolver->http_settings, GNOME_PROXY_HTTP_USE_AUTH_KEY))
+	{
+	  gchar *user, *password;
+	  gchar *enc_user, *enc_password;
+
+	  user = g_settings_get_string (resolver->http_settings, GNOME_PROXY_HTTP_USER_KEY);
+	  enc_user = g_uri_escape_string (user, NULL, TRUE);
+	  g_free (user);
+	  password = g_settings_get_string (resolver->http_settings, GNOME_PROXY_HTTP_PASSWORD_KEY);
+	  enc_password = g_uri_escape_string (password, NULL, TRUE);
+	  g_free (password);
+
+	  resolver->http_proxy = g_strdup_printf ("http://%s:%s %s:%u",
+						  enc_user, enc_password,
+						  host, port);
+	  g_free (enc_user);
+	  g_free (enc_password);
+	}
+      else
+	resolver->http_proxy = g_strdup_printf ("http://%s:%u";, host, port);
     }
-  else
-    resolver->http_proxy = g_strdup_printf ("http://%s:%u";, host, port);
   g_free (host);
 
   host = g_settings_get_string (resolver->https_settings, GNOME_PROXY_HTTPS_HOST_KEY);



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