From d65956b40cb3b4c1ba21b54d2e5184d67c27cbe9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Zuzelski?= Date: Fri, 21 Aug 2009 11:57:02 +0200 Subject: [PATCH] Pass proxy_url to download handler Pass the value of proxy_url variable as optional 9th argument of download handler. Added support for http proxy to the example download handler script. Updated README file. --- README | 1 + examples/data/uzbl/scripts/download.sh | 3 +++ uzbl.c | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README b/README index b36293c..f9037c9 100644 --- a/README +++ b/README @@ -364,6 +364,7 @@ The script specific arguments are this: * download: $8 url of item to download + $9 url of http proxy (optional) * cookie handler diff --git a/examples/data/uzbl/scripts/download.sh b/examples/data/uzbl/scripts/download.sh index aa1ca09..c8eb6ba 100755 --- a/examples/data/uzbl/scripts/download.sh +++ b/examples/data/uzbl/scripts/download.sh @@ -8,6 +8,9 @@ GET="wget --user-agent=Firefox" dest="$HOME" url="$8" +http_proxy="$9" +export http_proxy + test "x$url" = "x" && { echo "you must supply a url! ($url)"; exit 1; } # only changes the dir for the $get sub process diff --git a/uzbl.c b/uzbl.c index e90d220..80a3cfc 100644 --- a/uzbl.c +++ b/uzbl.c @@ -565,7 +565,17 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { if (uzbl.state.verbose) printf("Download -> %s\n",uri); /* if urls not escaped, we may have to escape and quote uri before this call */ - run_handler(uzbl.behave.download_handler, uri); + + GString *args = g_string_new(uri); + + if (uzbl.net.proxy_url) { + g_string_append_c(args, ' '); + g_string_append(args, uzbl.net.proxy_url); + } + + run_handler(uzbl.behave.download_handler, args->str); + + g_string_free(args, TRUE); } return (FALSE); } -- 1.7.9.5