--- network-manager-openvpn-0.7~~svn20081015t024626.orig/properties/auth-helpers.c	2008-10-02 21:41:09.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626/properties/auth-helpers.c	2008-10-30 15:50:23.558082801 +0100
@@ -726,6 +726,10 @@
 	NM_OPENVPN_KEY_COMP_LZO,
 	NM_OPENVPN_KEY_TAP_DEV,
 	NM_OPENVPN_KEY_PROTO_TCP,
+	NM_OPENVPN_KEY_HTTP_PROXY,
+	NM_OPENVPN_KEY_HTTP_PROXY_PORT,
+	NM_OPENVPN_KEY_HTTP_PROXY_RETRY,
+	NM_OPENVPN_KEY_HTTP_PROXY_AUTH,
 	NM_OPENVPN_KEY_CIPHER,
 	NM_OPENVPN_KEY_TA_DIR,
 	NM_OPENVPN_KEY_TA,
@@ -773,6 +777,42 @@
 	gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
 }
 
+
+static void
+http_proxy_toggled_cb (GtkWidget *check, gpointer user_data)
+{
+        GladeXML *xml = (GladeXML *) user_data;
+        GtkWidget *widget;
+
+        widget = glade_xml_get_widget (xml, "http_proxy_entry");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+
+        widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+
+        /*
+        http-proxy
+        depend:
+                tcp
+        options:
+                proxy retry (--http-proxy-retry)
+                proxy authentication
+        */
+        widget = glade_xml_get_widget (xml, "tcp_checkbutton");
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+        gtk_widget_set_sensitive (widget, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+        /*proxy auth*/
+	/* not implemented yet */
+	/*
+	widget = glade_xml_get_widget (xml, "http_proxy_auth_checkbutton");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+	*/
+        /*http-proxy-retry*/
+        widget = glade_xml_get_widget (xml, "http_proxy_retry_checkbutton");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+
+}
+
 static const char *
 nm_find_openvpn (void)
 {
@@ -905,7 +945,7 @@
 	GtkWidget *dialog = NULL;
 	char *glade_file = NULL;
 	GtkWidget *widget;
-	const char *value;
+	const char *value, *value2;
 
 	g_return_val_if_fail (hash != NULL, NULL);
 
@@ -925,6 +965,35 @@
 	                        xml, (GDestroyNotify) g_object_unref);
 	g_object_set_data (G_OBJECT (dialog), "connection-type", GINT_TO_POINTER (contype));
 
+        widget = glade_xml_get_widget (xml, "http_proxy_checkbutton");
+        g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (http_proxy_toggled_cb), xml);
+
+        value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_HTTP_PROXY);
+        value2 = g_hash_table_lookup (hash, NM_OPENVPN_KEY_HTTP_PROXY_PORT);
+        if (value && strlen (value) && value2 && strlen (value2)) {
+                        widget = glade_xml_get_widget (xml, "http_proxy_checkbutton");
+                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+                        widget = glade_xml_get_widget (xml, "http_proxy_entry");
+			gtk_entry_set_text (GTK_ENTRY (widget), value);
+                	gtk_widget_set_sensitive (widget, TRUE);
+
+                        widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+                        gtk_entry_set_text (GTK_ENTRY (widget), value2);
+                        gtk_widget_set_sensitive (widget, TRUE);
+
+
+        } else {
+                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+
+                widget = glade_xml_get_widget (xml, "http_proxy_entry");
+                gtk_widget_set_sensitive (widget, FALSE);
+
+                widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+                gtk_widget_set_sensitive (widget, FALSE);
+
+        }
+
 	widget = glade_xml_get_widget (xml, "port_checkbutton");
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (port_toggled_cb), xml);
 
@@ -1034,6 +1103,7 @@
 	GtkWidget *widget;
 	GladeXML *xml;
 	const char *contype = NULL;
+	const char *value, *value2;
 
 	g_return_val_if_fail (dialog != NULL, NULL);
 	if (error)
@@ -1053,6 +1123,41 @@
 		nm_setting_vpn_add_data_item (hash, g_strdup (NM_OPENVPN_KEY_PORT), g_strdup_printf ("%d", port));
 	}
 
+       /* PROXY SUPPORT */
+
+        widget = glade_xml_get_widget (xml, "http_proxy_checkbutton");
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+
+                       widget = glade_xml_get_widget (xml, "http_proxy_entry");
+                       value = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+                        widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+                        value2 = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+
+                       if (value && strlen (value) && value2 && strlen (value2)) {
+                                               g_hash_table_insert (hash,
+                                               g_strdup (NM_OPENVPN_KEY_HTTP_PROXY),
+                                               g_strdup (value));
+
+                                                g_hash_table_insert (hash,
+                                                g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_PORT),
+                                                g_strdup (value2));
+
+                       }
+
+                       widget = glade_xml_get_widget (xml, "http_proxy_retry_checkbutton");
+                       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+                               g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_RETRY), g_strdup ("yes"));
+                       }
+
+			/* not implemented yet */
+                        /*
+			widget = glade_xml_get_widget (xml, "http_proxy_auth_checkbutton");
+                        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+                                g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_AUTH), g_strdup ("yes"));
+                        }
+                        */
+	}
+
 	widget = glade_xml_get_widget (xml, "lzo_checkbutton");
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
 		nm_setting_vpn_add_data_item (hash, g_strdup (NM_OPENVPN_KEY_COMP_LZO), g_strdup ("yes"));
--- network-manager-openvpn-0.7~~svn20081015t024626.orig/properties/import-export.c	2008-08-19 13:59:36.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626./properties/import-export.c	2008-10-30 15:50:23.558082801 +0100
@@ -55,6 +55,8 @@
 #define TLS_AUTH_TAG "tls-auth"
 #define AUTH_TAG "auth"
 #define RENEG_SEC_TAG "reneg-sec"
+#define PROXY_TAG "http-proxy"
+#define PROXY_RETRY_TAG "http-retry-proxy"
 
 static gboolean
 handle_path_item (const char *line,
@@ -221,6 +223,47 @@
 			continue;
 		}
 
+                if (!strncmp (*line, PROXY_RETRY_TAG, strlen (PROXY_RETRY_TAG))) {
+                        nm_setting_vpn_add_data_item (s_vpn,
+                                             g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_RETRY),
+                                             g_strdup ("yes"));
+                        continue;
+                }
+
+
+                if (!strncmp (*line, PROXY_TAG, strlen (PROXY_TAG))) {
+                        items = get_args (*line + strlen (PROXY_TAG));
+                        if (!items)
+                                continue;
+
+                        if (g_strv_length (items) >= 1) {
+                                nm_setting_vpn_add_data_item (s_vpn,
+                                                     g_strdup (NM_OPENVPN_KEY_HTTP_PROXY),
+                                                     g_strdup (items[0]));
+                                if (g_strv_length (items) >= 2) {
+                                        glong port;
+
+                                        errno = 0;
+                                        port = strtol (items[1], NULL, 10);
+                                        if ((errno == 0) && (port > 0) && (port < 65536)) {
+                                                char *tmp = g_strdup_printf ("%d", (guint32) port);
+                                                nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_HTTP_PROXY_PORT, tmp);
+                                                g_free (tmp);
+						if (g_strv_length (items) >= 3) {
+							nm_setting_vpn_add_data_item (s_vpn,
+			                                             g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_AUTH),
+                        			                     g_strdup ("yes"));
+							/*save http proxy usename/password*/
+						}
+                                       } else
+                                                g_warning ("%s: invalid http proxy port in option '%s'", __func__, *line);
+                                }
+                        }
+
+                        g_strfreev (items);
+                        continue;
+                }
+
 		if (!strncmp (*line, REMOTE_TAG, strlen (REMOTE_TAG))) {
 			items = get_args (*line + strlen (REMOTE_TAG));
 			if (!items)
--- network-manager-openvpn-0.7~~svn20081015t024626.orig/properties/nm-openvpn-dialog.glade	2008-10-02 21:41:09.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626/properties/nm-openvpn-dialog.glade	2008-10-30 16:45:37.896376354 +0100
@@ -1090,6 +1090,155 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
+	  <child>
+	    <widget class="GtkVBox" id="vbox12">
+	      <property name="border_width">12</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkHBox" id="hbox3">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">6</property>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="http_proxy_checkbutton">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Use _http proxy:</property>
+		      <property name="use_underline">True</property>
+		      <property name="response_id">0</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">True</property>
+		    </packing>
+		  </child>
+		  <child>
+		    <widget class="GtkEntry" id="http_proxy_entry">
+		      <property name="width_request">110</property>
+		      <property name="visible">True</property>
+		      <property name="xalign">0</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">True</property>
+		      <property name="visibility">True</property>
+		      <property name="max_length">0</property>
+		      <property name="text" translatable="yes"></property>
+		      <property name="has_frame">True</property>
+		      <property name="activates_default">False</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label31">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">:</property>
+		      <property name="use_underline">True</property>
+		      <property name="use_markup">True</property>
+		      <property name="wrap">True</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="mnemonic_widget">http_proxy_port_entry</property>
+		      <property name="width_chars">-1</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="http_proxy_port_entry">
+		      <property name="width_request">40</property>
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">True</property>
+		      <property name="visibility">True</property>
+		      <property name="max_length">4</property>
+		      <property name="text" translatable="yes"></property>
+		      <property name="has_frame">True</property>
+		      <property name="activates_default">False</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">True</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="http_proxy_retry_checkbutton">
+		  <property name="visible">True</property>
+		  <property name="sensitive">False</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Use _http proxy retry</property>
+		  <property name="use_underline">True</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">True</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="http_proxy_auth_checkbutton">
+		  <property name="visible">True</property>
+		  <property name="sensitive">False</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Use http proxy _authentication</property>
+		  <property name="use_underline">True</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+	  <child>
+	    <widget class="GtkLabel" id="label32">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Http proxy</property>
+	    </widget>
+	    <packing>
+	      <property name="type">tab</property>
+	    </packing>
+	  </child>
           </widget>
           <packing>
             <property name="expand">False</property>
--- network-manager-openvpn-0.7~~svn20081015t024626.orig/src/nm-openvpn-service.c	2008-10-02 21:41:09.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626/src/nm-openvpn-service.c	2008-10-30 15:50:23.647082520 +0100
@@ -102,6 +102,10 @@
 	{ NM_OPENVPN_KEY_TA_DIR,               G_TYPE_INT, 0, 1, FALSE },
 	{ NM_OPENVPN_KEY_USERNAME,             G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_RENEG_SECONDS,        G_TYPE_INT, 0, G_MAXINT, FALSE },
+       { NM_OPENVPN_KEY_HTTP_PROXY,           G_TYPE_STRING, 0, 0, FALSE },
+       { NM_OPENVPN_KEY_HTTP_PROXY_PORT,      G_TYPE_STRING, 0, 65535, FALSE },
+       { NM_OPENVPN_KEY_HTTP_PROXY_RETRY,     G_TYPE_BOOLEAN, 0, 0, FALSE },
+       { NM_OPENVPN_KEY_HTTP_PROXY_AUTH,      G_TYPE_BOOLEAN, 0, 0, FALSE },
 	{ NULL,                                G_TYPE_NONE, FALSE }
 };
 
@@ -549,7 +553,7 @@
                                  GError **error)
 {
 	NMOpenvpnPluginPrivate *priv = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin);
-	const char *openvpn_binary, *auth, *connection_type, *tmp;
+	const char *openvpn_binary, *auth, *connection_type, *tmp, *tmp2;
 	GPtrArray *args;
 	GSource *openvpn_watch;
 	GPid pid;
@@ -584,6 +588,19 @@
		add_openvpn_arg (args, tmp);
	}

+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_HTTP_PROXY);
+	tmp2 = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_HTTP_PROXY_PORT);
+	if (tmp && strlen (tmp) && tmp2 && strlen (tmp2)) {
+		add_openvpn_arg (args, "--http-proxy");
+		add_openvpn_arg (args, tmp);
+		add_openvpn_arg (args, tmp2);
+	}
+
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_HTTP_PROXY_RETRY);
+	if (tmp && strlen (tmp)){
+		add_openvpn_arg (args, "--http-proxy-retry");
+	}
+
	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO);
	if (tmp && !strcmp (tmp, "yes"))
		add_openvpn_arg (args, "--comp-lzo");
--- network-manager-openvpn-0.7~~svn20081015t024626.orig/src/nm-openvpn-service.h	2008-09-08 21:55:33.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626/src/nm-openvpn-service.h	2008-10-30 15:50:23.670081882 +0100
@@ -55,6 +55,10 @@
 #define NM_OPENVPN_KEY_TA "ta"
 #define NM_OPENVPN_KEY_TA_DIR "ta-dir"
 #define NM_OPENVPN_KEY_USERNAME "username"
+#define NM_OPENVPN_KEY_HTTP_PROXY "http-proxy"
+#define NM_OPENVPN_KEY_HTTP_PROXY_PORT "http-proxy-port"
+#define NM_OPENVPN_KEY_HTTP_PROXY_RETRY "http-proxy-retry"
+#define NM_OPENVPN_KEY_HTTP_PROXY_AUTH "http-proxy-auth"
 
 #define NM_OPENVPN_KEY_PASSWORD "password"
 #define NM_OPENVPN_KEY_CERTPASS "cert-pass"
