aboutsummaryrefslogtreecommitdiff
path: root/wget.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-12-07 22:42:11 +0000
committerEric Andersen <andersen@codepoet.org>2000-12-07 22:42:11 +0000
commitf3b2b52b589bccae28b1740c155733028f2b8fd5 (patch)
tree8e1ff3e2bd1ccd5eb5a56fcc59cac4069708ed1c /wget.c
parentf57c944e09417edcbcd69f2b01b937cadef39db2 (diff)
downloadbusybox-w32-f3b2b52b589bccae28b1740c155733028f2b8fd5.tar.gz
busybox-w32-f3b2b52b589bccae28b1740c155733028f2b8fd5.tar.bz2
busybox-w32-f3b2b52b589bccae28b1740c155733028f2b8fd5.zip
Patch from Matt Kraai to enable proxy support.
Diffstat (limited to '')
-rw-r--r--wget.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/wget.c b/wget.c
index 0ec4dff19..9b8fedd1f 100644
--- a/wget.c
+++ b/wget.c
@@ -52,6 +52,7 @@ int wget_main(int argc, char **argv)
52{ 52{
53 FILE *sfp; /* socket to web server */ 53 FILE *sfp; /* socket to web server */
54 char *uri_host, *uri_path; /* parsed from command line url */ 54 char *uri_host, *uri_path; /* parsed from command line url */
55 char *proxy;
55 int uri_port; 56 int uri_port;
56 char *s, buf[512]; 57 char *s, buf[512];
57 int n; 58 int n;
@@ -101,10 +102,20 @@ int wget_main(int argc, char **argv)
101 102
102 if (do_continue && !fname_out) 103 if (do_continue && !fname_out)
103 error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n"); 104 error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
105
104 /* 106 /*
105 * Parse url into components. 107 * Use the proxy if necessary.
106 */ 108 */
107 parse_url(argv[optind], &uri_host, &uri_port, &uri_path); 109 if ((proxy = getenv("http_proxy")) != NULL) {
110 proxy = xstrdup(proxy);
111 parse_url(proxy, &uri_host, &uri_port, &uri_path);
112 uri_path = argv[optind];
113 } else {
114 /*
115 * Parse url into components.
116 */
117 parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
118 }
108 119
109 /* 120 /*
110 * Open socket to server. 121 * Open socket to server.
@@ -475,7 +486,7 @@ progressmeter(int flag)
475 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 486 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
476 * SUCH DAMAGE. 487 * SUCH DAMAGE.
477 * 488 *
478 * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $ 489 * $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $
479 */ 490 */
480 491
481 492