From: Daniel Carl <danielcarl@gmx.de>
Date: Sun, 29 Jun 2014 13:52:47 +0000 (+0200)
Subject: Inform external download about used proxy.
X-Git-Url: https://git.owens.tech/assets/112-editable-focus.html/assets/112-editable-focus.html/git?a=commitdiff_plain;h=1fcae38fdbc94c9dce8ce23abcf55186d19d4d75;p=vimb.git

Inform external download about used proxy.
---

diff --git a/doc/vimb.1 b/doc/vimb.1
index 82309e3..4d82b89 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -799,6 +799,11 @@ Holds the user agent string that vimb uses.
 The mime-type of the download. This variable is only available when der server
 sent the mime-type header with the response and only if the download was not
 start by the `:save' command or the `;s' hinting.
+.TP
+.B $VIMB_USE_PROXY
+Indicates if the proxy is enabled in vimb. If enable this variable is `1',
+otherwise `0'. Note that this variable gives no hint if the proxy settings
+apply to the URL to be downloaded, only if proxy is enabled in general.
 .PD
 .P
 Example: :set download-command=/bin/sh -c "wget -c %s -O $VIMB_FILE
diff --git a/src/main.c b/src/main.c
index 1d8c6aa..bb148bf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1284,6 +1284,7 @@ void vb_download_external(WebKitWebView *view, WebKitDownload *download, const c
     /* set the required download information as environment */
     envp = g_get_environ();
     envp = g_environ_setenv(envp, "VIMB_FILE", file, true);
+    envp = g_environ_setenv(envp, "VIMB_USE_PROXY", GET_BOOL("proxy") ? "1" : "0", true);
 #ifdef FEATURE_COOKIE
     envp = g_environ_setenv(envp, "VIMB_COOKIES", vb.files[FILES_COOKIE], true);
 #endif