From 0141c3d067a89a9a372d8aaa1abab89d739fe6e7 Mon Sep 17 00:00:00 2001 From: vext01 Date: Thu, 7 Jun 2012 11:03:34 +0100 Subject: Some tweaks to xombrero's proxy support. * Display a message when toggling proxy. * Add a 'http_proxy_disabled' config option allowing a proxy to be disabled at xombrero start. * Add a note in the manual that polipo works with xombrero aswell as tsocks. * In the config file, provide examples for polipo and tsocks running on localhost with default ports. OK marco --- settings.c | 2 ++ xombrero.1 | 9 +++++++-- xombrero.c | 14 ++++++++++++-- xombrero.conf | 9 ++++++++- xombrero.h | 1 + 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/settings.c b/settings.c index 9cd3ff9..8a567b2 100644 --- a/settings.c +++ b/settings.c @@ -84,6 +84,7 @@ int append_next = XT_DS_APPEND_NEXT; /* append tab after current tab */ char *home = NULL; /* allocated/set at startup */ char *search_string = NULL; /* allocated/set at startup */ char *http_proxy = NULL; +int http_proxy_starts_enabled = 1; int download_mode = XT_DM_START; int color_visited_uris = XT_DS_COLOR_VISITED_URIS; int session_autosave = XT_DS_SESSION_AUTOSAVE; @@ -383,6 +384,7 @@ struct settings rs[] = { { "guess_search", XT_S_INT, 0, &guess_search, NULL, NULL, NULL, set_guess_search }, { "history_autosave", XT_S_INT, 0, &history_autosave, NULL, NULL, NULL, NULL }, { "http_proxy", XT_S_STR, 0, NULL, &http_proxy, NULL, NULL, set_http_proxy }, + { "http_proxy_starts_enabled", XT_S_INT, 0, &http_proxy_starts_enabled, NULL, NULL, NULL, NULL }, { "icon_size", XT_S_INT, 0, &icon_size, NULL, NULL, NULL, NULL }, { "enable_js_autorun", XT_S_INT, 0, &enable_js_autorun, NULL, NULL, NULL, set_enable_js_autorun }, { "max_connections", XT_S_INT, XT_SF_RESTART,&max_connections, NULL, NULL, NULL, NULL }, diff --git a/xombrero.1 b/xombrero.1 index 6c5e5fb..6bd548d 100644 --- a/xombrero.1 +++ b/xombrero.1 @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 14 2011 $ +.Dd $Mdocdate: June 7 2012 $ .Dt XOMBRERO 1 .Os .Sh NAME @@ -1220,8 +1220,13 @@ not a FQDN. This works as expected with webkit 1.4.2. .Pp If one desires to use a socks proxy then an intermediary tool must be used. -It has been reported that tsocks works with +It has been reported that tsocks and polipo work with .Nm . +.It Cm http_proxy_starts_enabled +If set to 0, the http_proxy will be disabled at startup. The user can later +enable the proxy with the +.Cm proxy toggle +command or keybinding. .It Cm icon_size Permits icon sizes to be changed if .Cm fancy_bar diff --git a/xombrero.c b/xombrero.c index 1d63855..20894e8 100644 --- a/xombrero.c +++ b/xombrero.c @@ -3070,10 +3070,13 @@ proxy_cmd(struct tab *t, struct karg *args) show_oops(t, "can't toggle proxy"); goto done; } - if (http_proxy) + if (http_proxy) { setup_proxy(NULL); - else + show_oops(t, "http proxy disabled"); + } else { setup_proxy(http_proxy_save); + show_oops(t, "http_proxy = %s", http_proxy); + } } done: return (XT_CB_PASSTHROUGH); @@ -8096,6 +8099,13 @@ main(int argc, char **argv) else setup_proxy(http_proxy); } + + /* the user can optionally have the proxy disabled at startup */ + if ((http_proxy_starts_enabled == 0) && (http_proxy != NULL)) { + http_proxy_save = g_strdup(http_proxy); + setup_proxy(NULL); + } + #ifndef XT_SOCKET_DISABLE if (opte) { send_cmd_to_socket(argv[0]); diff --git a/xombrero.conf b/xombrero.conf index 19b7bdd..e732265 100644 --- a/xombrero.conf +++ b/xombrero.conf @@ -64,7 +64,14 @@ # See http://www.xroxy.com/proxylist.php for a good list of open # proxies. # -# http_proxy = http://127.0.0.1:80 +# polipo +# http_proxy = http://127.0.0.1:8123 +# +# tsocks +# http_proxy = http://127.0.0.1:1080 +# +# If you only occasionally use a proxy +# http_proxy_starts_enabled = 0 # Search engines; uncomment one of these lines for you favorite search # engine. diff --git a/xombrero.h b/xombrero.h index cac8ca8..b204705 100644 --- a/xombrero.h +++ b/xombrero.h @@ -728,6 +728,7 @@ extern int append_next; extern char *home; extern char *search_string; extern char *http_proxy; +extern int http_proxy_starts_enabled; extern char *external_editor; extern char download_dir[PATH_MAX]; extern int download_mode; -- cgit 1.4.1-2-gfad0