diff options
author | Ivan Tham <pickfire@riseup.net> | 2015-12-17 21:35:02 +0800 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2015-12-17 23:36:56 +0100 |
commit | 86efaf80936cebba56ec3e88db61c786c608c885 (patch) | |
tree | 82ff4ad14f051002bde2ad9e49dc17157014b4ee /surf.c | |
parent | 9fa4ffef72308e75446aeeebc9d38140b7198640 (diff) | |
download | surf-86efaf80936cebba56ec3e88db61c786c608c885.tar.gz surf-86efaf80936cebba56ec3e88db61c786c608c885.tar.bz2 surf-86efaf80936cebba56ec3e88db61c786c608c885.zip |
proxy-uri -> proxy-resolver for no_proxy; add #inc
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat (limited to 'surf.c')
-rw-r--r-- | surf.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -24,6 +24,9 @@ #include <stdarg.h> #include <regex.h> #include <pwd.h> +#include <glib.h> +#include <lib/gprintf.h> +#include <gio/gio.h> #include "arg.h" @@ -1290,9 +1293,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 +1370,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_strfreev(new_no_proxy); usingproxy = 1; } } |