Add and use no proxy list option

This commit is contained in:
Vincent Sanders 2013-06-04 18:11:15 +01:00
parent ccb0c1cfd1
commit 4e24869524
5 changed files with 55 additions and 3 deletions

View File

@ -613,11 +613,16 @@ fetch_curl_set_options(struct curl_fetch_info *f)
SETOPT(CURLOPT_USERPWD, NULL);
}
/* set up proxy options */
if (nsoption_bool(http_proxy) &&
(nsoption_charp(http_proxy_host) != NULL) &&
(strncmp(nsurl_access(f->url), "file:", 5) != 0)) {
SETOPT(CURLOPT_PROXY, nsoption_charp(http_proxy_host));
SETOPT(CURLOPT_PROXYPORT, (long) nsoption_int(http_proxy_port));
/* setup the omission list */
SETOPT(CURLOPT_NOPROXY, nsoption_charp(http_proxy_noproxy));
if (nsoption_int(http_proxy_auth) != OPTION_HTTP_PROXY_AUTH_NONE) {
SETOPT(CURLOPT_PROXYAUTH,
nsoption_int(http_proxy_auth) ==

View File

@ -56,6 +56,9 @@ NSOPTION_STRING(http_proxy_auth_user, NULL)
/** Proxy authentication password */
NSOPTION_STRING(http_proxy_auth_pass, NULL)
/** Proxy omission list */
NSOPTION_STRING(http_proxy_noproxy, "localhost")
/** Default font size / 0.1pt. */
NSOPTION_INTEGER(font_size, 128)

View File

@ -45,6 +45,7 @@ struct ppref {
GtkEntry *entryProxyHost;
GtkEntry *entryProxyUser;
GtkEntry *entryProxyPassword;
GtkEntry *entryProxyNoproxy;
GtkSpinButton *spinProxyPort;
/* dynamic list stores */
@ -200,6 +201,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
gboolean port;
gboolean user;
gboolean pass;
gboolean noproxy;
switch (proxyval) {
case 0: /* no proxy */
@ -207,6 +209,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
port = FALSE;
user = FALSE;
pass = FALSE;
noproxy = FALSE;
break;
case 1: /* proxy with no auth */
@ -214,6 +217,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
port = TRUE;
user = FALSE;
pass = FALSE;
noproxy = TRUE;
break;
case 2: /* proxy with basic auth */
@ -221,6 +225,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
port = TRUE;
user = TRUE;
pass = TRUE;
noproxy = TRUE;
break;
case 3: /* proxy with ntlm auth */
@ -228,6 +233,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
port = TRUE;
user = TRUE;
pass = TRUE;
noproxy = TRUE;
break;
case 4: /* system proxy */
@ -235,6 +241,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
port = FALSE;
user = FALSE;
pass = FALSE;
noproxy = FALSE;
break;
default:
@ -245,6 +252,7 @@ static void set_proxy_widgets_sensitivity(int proxyval, struct ppref *priv)
gtk_widget_set_sensitive(GTK_WIDGET(priv->spinProxyPort), port);
gtk_widget_set_sensitive(GTK_WIDGET(priv->entryProxyUser), user);
gtk_widget_set_sensitive(GTK_WIDGET(priv->entryProxyPassword), pass);
gtk_widget_set_sensitive(GTK_WIDGET(priv->entryProxyNoproxy), noproxy);
}
@ -322,6 +330,9 @@ ENTRY_SIGNALS(entryProxyUser, http_proxy_auth_user)
/* password */
ENTRY_SIGNALS(entryProxyPassword, http_proxy_auth_pass)
/* no proxy */
ENTRY_SIGNALS(entryProxyNoproxy, http_proxy_noproxy)
/* Fetching */
/* maximum fetchers */
@ -1069,6 +1080,7 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent)
priv->spinProxyPort = GB(SPIN_BUTTON, spinProxyPort);
priv->entryProxyUser = GB(ENTRY, entryProxyUser);
priv->entryProxyPassword = GB(ENTRY, entryProxyPassword);
priv->entryProxyNoproxy = GB(ENTRY, entryProxyNoproxy);
#undef GB
/* connect all signals ready to use */

View File

@ -2002,7 +2002,7 @@
<object class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">4</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
@ -2175,6 +2175,36 @@
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label55">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">preferencesProxyNoproxy</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entryProxyNoproxy">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">preferencesProxyNoproxyTooltip</property>
<property name="caps_lock_warning">False</property>
<signal name="changed" handler="nsgtk_preferences_entryProxyNoproxy_changed" swapped="no"/>
<signal name="realize" handler="nsgtk_preferences_entryProxyNoproxy_realize" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
</object>
</child>
</object>

View File

@ -2182,11 +2182,13 @@ en.gtk.preferencesProxyType:Proxy type
en.gtk.preferencesProxyHost:Host
en.gtk.preferencesProxyUsername:Username
en.gtk.preferencesProxyPassword:Password
en.gtk.preferencesProxyNoproxy:No Proxy For
en.gtk.preferencesProxyTypeTooltip:The type of HTTP proxy server.
en.gtk.preferencesProxyHostTooltip:Host name of your proxy server.
en.gtk.preferencesProxyPortTooltip:Port number to connect to on proxy server.
en.gtk.preferencesProxyUsernameTooltip:Username to access the proxy
en.gtk.preferencesProxyPasswordTooltip:Password to access the proxy
en.gtk.preferencesProxyUsernameTooltip:Username to access the proxy.
en.gtk.preferencesProxyPasswordTooltip:Password to access the proxy.
en.gtk.preferencesProxyNoproxyTooltip:Comma separated list of host names that should not be proxied.
en.gtk.preferencesFetching:<b>Fetching</b>
en.gtk.preferencesFetchingMax:Maximum fetchers
en.gtk.preferencesFetchingPerhost:Fetches per host