--- gnome-session-2.15.91/gnome-session/main.c.http_proxy	2006-09-06 09:52:45.000000000 -0400
+++ gnome-session-2.15.91/gnome-session/main.c	2006-09-06 11:13:07.000000000 -0400
@@ -133,6 +133,77 @@
     }
 }
 
+/* Set legacy proxy environment variable base on GConf setting
+ */ 
+static void
+set_proxy (void)
+{
+  gboolean use_proxy, use_authentication;
+  char *host, *user_name, *password, *http_proxy;
+  gint port;
+  GConfClient *gconf_client;
+
+  gconf_client = gsm_get_conf_client ();
+
+  use_proxy = gconf_client_get_bool (gconf_client, HTTP_PROXY_KEY, NULL);
+
+  if (!use_proxy)
+    {
+      g_unsetenv ("http_proxy"); 
+      return;
+    }
+
+  host = gconf_client_get_string (gconf_client, HTTP_PROXY_HOST_KEY, NULL);
+
+  if (host == NULL)
+    {
+      g_unsetenv ("http_proxy");
+      return;
+    }
+
+  port = gconf_client_get_int (gconf_client, HTTP_PROXY_PORT_KEY, NULL);
+
+  use_authentication = gconf_client_get_bool (gconf_client, HTTP_PROXY_AUTHENTICATION_KEY, NULL);
+
+  user_name = NULL;
+  password = NULL;
+  if (use_authentication)
+    {
+      user_name = gconf_client_get_string (gconf_client, HTTP_PROXY_USER_NAME_KEY, 
+                                           NULL);
+      if (user_name != NULL && user_name[0] == '\0')
+        {
+          g_free (user_name);
+          user_name = NULL;
+        }
+      else 
+        password = gconf_client_get_string (gconf_client, HTTP_PROXY_PASSWORD_KEY, 
+                                          NULL);
+    }
+
+  if (port <= 0)
+    http_proxy = g_strdup_printf ("http://%s%s%s%s%s",
+                                  user_name != NULL? user_name : "",
+                                  user_name != NULL && password != NULL? "@" : "",
+                                  user_name != NULL && password != NULL? password : "",
+                                  user_name != NULL? ":" : "",
+                                  host); 
+  else
+    http_proxy = g_strdup_printf ("http://%s%s%s%s%s:%d",
+                                  user_name != NULL? user_name : "",
+                                  user_name != NULL && password != NULL? "@" : "",
+                                  user_name != NULL && password != NULL? password : "",
+                                  user_name != NULL? ":" : "",
+                                  host, port); 
+  g_setenv ("http_proxy", http_proxy, TRUE);
+
+  g_free (http_proxy);
+  g_free (password);
+  g_free (user_name);
+  g_free (host);
+
+}
+
 /* Point GTK_RC_FILES at a separate file that we change in
  * in gnome-settings-daemon.
  */
@@ -432,6 +490,14 @@
   g_free (display_str);
   putenv (ep);
 
+  /* Set http_proxy environment variable for legacy apps */
+  gconf_client_add_dir (gconf_client, HTTP_PROXY_PREFIX, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); 
+  gconf_client_notify_add (gconf_client,
+			   HTTP_PROXY_PREFIX,
+			   (GConfClientNotifyFunc) set_proxy,
+			   NULL, NULL, NULL);
+  set_proxy ();
+
   ignore (SIGPIPE);
 
   /* Need DISPLAY set */
--- gnome-session-2.15.91/gnome-session/headers.h.http_proxy	2006-09-06 10:02:39.000000000 -0400
+++ gnome-session-2.15.91/gnome-session/headers.h	2006-09-06 11:04:13.000000000 -0400
@@ -74,6 +74,15 @@
 /* Assistive Technology support is turned on */
 #define ACCESSIBILITY_KEY         "/desktop/gnome/interface/accessibility"
 
+/* Proxy information */
+#define HTTP_PROXY_PREFIX             "/system/http_proxy"
+#define HTTP_PROXY_KEY                HTTP_PROXY_PREFIX "/use_http_proxy"
+#define HTTP_PROXY_AUTHENTICATION_KEY HTTP_PROXY_PREFIX "/use_authentication"
+#define HTTP_PROXY_USER_NAME_KEY      HTTP_PROXY_PREFIX "/authentication_user"
+#define HTTP_PROXY_PASSWORD_KEY       HTTP_PROXY_PREFIX "/authentication_password"
+#define HTTP_PROXY_HOST_KEY           HTTP_PROXY_PREFIX "/host"
+#define HTTP_PROXY_PORT_KEY           HTTP_PROXY_PREFIX "/port"
+
 /* Convenience macros: */
 #define APPEND(List,Elt) ((List) = (g_slist_append ((List), (Elt))))
 #define PREPEND(List,Elt) ((List) = (g_slist_prepend ((List), (Elt))))
