summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorEric Andersen2000-12-07 22:42:11 +0000
committerEric Andersen2000-12-07 22:42:11 +0000
commitf3b2b52b589bccae28b1740c155733028f2b8fd5 (patch)
tree8e1ff3e2bd1ccd5eb5a56fcc59cac4069708ed1c /networking
parentf57c944e09417edcbcd69f2b01b937cadef39db2 (diff)
downloadbusybox-f3b2b52b589bccae28b1740c155733028f2b8fd5.zip
busybox-f3b2b52b589bccae28b1740c155733028f2b8fd5.tar.gz
Patch from Matt Kraai to enable proxy support.
Diffstat (limited to 'networking')
-rw-r--r--networking/wget.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 0ec4dff..9b8fedd 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -52,6 +52,7 @@ int wget_main(int argc, char **argv)
{
FILE *sfp; /* socket to web server */
char *uri_host, *uri_path; /* parsed from command line url */
+ char *proxy;
int uri_port;
char *s, buf[512];
int n;
@@ -101,10 +102,20 @@ int wget_main(int argc, char **argv)
if (do_continue && !fname_out)
error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
+
/*
- * Parse url into components.
+ * Use the proxy if necessary.
*/
- parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
+ if ((proxy = getenv("http_proxy")) != NULL) {
+ proxy = xstrdup(proxy);
+ parse_url(proxy, &uri_host, &uri_port, &uri_path);
+ uri_path = argv[optind];
+ } else {
+ /*
+ * Parse url into components.
+ */
+ parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
+ }
/*
* Open socket to server.
@@ -475,7 +486,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
+ * $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $
*/