--- surf.1 | 7 +++++++ surf.c | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/surf.1 b/surf.1 index c1d339a..1715f93 100644 --- a/surf.1 +++ b/surf.1 @@ -283,6 +283,13 @@ string .TP .B http_proxy If this variable is set and not empty upon startup, surf will use it as the http proxy +.TP +.B no_proxy +If both http_proxy is set and no_proxy contain a +.BR comma-separated +list of domain extensions and both is not empty upon startup, proxy will +.BR not +be used for each of the elements in no_proxy. .SH PLUGINS For using plugins in surf, first determine your running architecture. Then get the appropriate plugin for that architecture and copy it to diff --git a/surf.c b/surf.c index ea0e260..fdfaab1 100644 --- a/surf.c +++ b/surf.c @@ -24,6 +24,7 @@ #include <stdarg.h> #include <regex.h> #include <pwd.h> +#include <gio/gio.h> #include "arg.h" @@ -1290,9 +1291,9 @@ void setup(void) { int i; - char *proxy, *new_proxy; + char *proxy, *new_proxy, *no_proxy, **new_no_proxy; char *styledirfile, *stylepath; - SoupURI *puri; + GProxyResolver *pr; SoupSession *s; GError *error = NULL; @@ -1367,15 +1368,19 @@ setup(void) /* proxy */ if ((proxy = getenv("http_proxy")) && strcmp(proxy, "")) { new_proxy = g_strrstr(proxy, "http://") + || g_strrstr(proxy, "https://") || g_strrstr(proxy, "socks://") || g_strrstr(proxy, "socks4://") + || g_strrstr(proxy, "socks4a://") || g_strrstr(proxy, "socks5://") ? g_strdup(proxy) : g_strdup_printf("http://%s", proxy); - puri = soup_uri_new(new_proxy); - g_object_set(G_OBJECT(s), "proxy-uri", puri, NULL); - soup_uri_free(puri); + new_no_proxy = ((no_proxy = getenv("no_proxy")) && strcmp(no_proxy, "")) + ? g_strsplit(no_proxy, ",", -1) : NULL; + pr = g_simple_proxy_resolver_new(new_proxy, new_no_proxy); + g_object_set(G_OBJECT(s), "proxy-resolver", pr, NULL); g_free(new_proxy); + g_free(new_no_proxy); usingproxy = 1; } } -- 2.6.4