From 71aa7a6bd4a1dbd1f3174fd5e428ef3266b5b03f Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sun, 19 Oct 2014 02:46:32 +0200 Subject: [PATCH] Don't force proxy to http scheme (#119). --- doc/vimb.1 | 3 ++- src/setting.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/vimb.1 b/doc/vimb.1 index 29e7d21..593ce90 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -1370,7 +1370,8 @@ started with -e option. .TP .B http_proxy If this variable is set to an none empty value, and the configuration option -`proxy' is enabled, this will be used as http proxy. +`proxy' is enabled, this will be used as http proxy. If the proxy URL has no +scheme set, http is assumed. .TP .B no_proxy A comma separated list of domains and/or ips which should not be proxied. Note diff --git a/src/setting.c b/src/setting.c index 22213a5..897d187 100644 --- a/src/setting.c +++ b/src/setting.c @@ -18,6 +18,7 @@ */ #include "config.h" +#include #include "main.h" #include "setting.h" #include "shortcut.h" @@ -730,7 +731,7 @@ static int proxy(const char *name, int type, void *value, void *data) const char *http_proxy = g_getenv("http_proxy"); if (http_proxy != NULL && *http_proxy != '\0') { - char *proxy_new = g_str_has_prefix(http_proxy, "http://") + char *proxy_new = strstr(http_proxy, "://") ? g_strdup(http_proxy) : g_strconcat("http://", http_proxy, NULL); -- 2.20.1