aboutsummaryrefslogtreecommitdiff
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
parentf57c944e09417edcbcd69f2b01b937cadef39db2 (diff)
downloadbusybox-w32-f3b2b52b589bccae28b1740c155733028f2b8fd5.tar.gz
busybox-w32-f3b2b52b589bccae28b1740c155733028f2b8fd5.tar.bz2
busybox-w32-f3b2b52b589bccae28b1740c155733028f2b8fd5.zip
Patch from Matt Kraai to enable proxy support.
-rw-r--r--networking/wget.c17
-rw-r--r--utility.c4
-rw-r--r--wget.c17
3 files changed, 30 insertions, 8 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 0ec4dff19..9b8fedd1f 100644
--- a/networking/wget.c
+++ b/networking/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
diff --git a/utility.c b/utility.c
index 2f3486c13..62c472885 100644
--- a/utility.c
+++ b/utility.c
@@ -611,7 +611,7 @@ int full_read(int fd, char *buf, int len)
611 * location, and do something (something specified 611 * location, and do something (something specified
612 * by the fileAction and dirAction function pointers). 612 * by the fileAction and dirAction function pointers).
613 * 613 *
614 * Unfortunatly, while nftw(3) could replace this and reduce 614 * Unfortunately, while nftw(3) could replace this and reduce
615 * code size a bit, nftw() wasn't supported before GNU libc 2.1, 615 * code size a bit, nftw() wasn't supported before GNU libc 2.1,
616 * and so isn't sufficiently portable to take over since glibc2.1 616 * and so isn't sufficiently portable to take over since glibc2.1
617 * is so stinking huge. 617 * is so stinking huge.
@@ -1444,7 +1444,7 @@ extern void *xcalloc(size_t nmemb, size_t size)
1444} 1444}
1445#endif 1445#endif
1446 1446
1447#if defined BB_FEATURE_NFSMOUNT || defined BB_SH || defined BB_LS 1447#if defined BB_FEATURE_NFSMOUNT || defined BB_LS || defined BB_SH || defined BB_WGET
1448# ifndef DMALLOC 1448# ifndef DMALLOC
1449extern char * xstrdup (const char *s) { 1449extern char * xstrdup (const char *s) {
1450 char *t; 1450 char *t;
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