[gnome-terminal] Support autoconfig http proxy



commit ed365372429aaf5888aa0a8254f572eb93be26f2
Author: Behdad Esfahbod <behdad behdad org>
Date:   Fri Dec 11 09:42:44 2009 -0500

    Support autoconfig http proxy
    
    Also part of Bug 596688 - Expose more proxy settings
    
    If /system/proxy/mode is set to auto, we put "pac+URL" into http_proxy
    where URL comes from /system/proxy/autoconfig_url.

 src/terminal-screen.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index a2659e6..969c762 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1475,6 +1475,21 @@ setup_socks_proxy_env (GHashTable *env_table, GConfClient *conf)
 }
 
 static void
+setup_autoconfig_proxy_env (GHashTable *env_table, GConfClient *conf)
+{
+  gchar *url;
+
+  url = conf_get_string (conf, PROXY_DIR "/autoconfig_url");
+  if (url)
+    {
+      char *proxy;
+      proxy = g_strdup_printf ("pac+%s", url);
+      set_proxy_env (env_table, "http_proxy", proxy);
+    }
+  g_free (url);
+}
+
+static void
 setup_proxy_env (GHashTable *env_table)
 {
   char *proxymode;
@@ -1484,7 +1499,7 @@ setup_proxy_env (GHashTable *env_table)
   gconf_client_preload (conf, PROXY_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
   /* If mode is not manual, nothing to set */
-  proxymode = gconf_client_get_string (conf, PROXY_DIR "/mode", NULL);
+  proxymode = conf_get_string (conf, PROXY_DIR "/mode");
   if (proxymode && 0 == strcmp (proxymode, "manual"))
     {
       setup_http_proxy_env (env_table, conf);
@@ -1492,6 +1507,10 @@ setup_proxy_env (GHashTable *env_table)
       setup_ftp_proxy_env (env_table, conf);
       setup_socks_proxy_env (env_table, conf);
     }
+  else if (proxymode && 0 == strcmp (proxymode, "auto"))
+    {
+      setup_autoconfig_proxy_env (env_table, conf);
+    }
 
   g_free (proxymode);
   g_object_unref (conf);



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