aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
{
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 $
*/
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)
* location, and do something (something specified
* by the fileAction and dirAction function pointers).
*
- * Unfortunatly, while nftw(3) could replace this and reduce
+ * Unfortunately, while nftw(3) could replace this and reduce
* code size a bit, nftw() wasn't supported before GNU libc 2.1,
* and so isn't sufficiently portable to take over since glibc2.1
* is so stinking huge.
@@ -1444,7 +1444,7 @@ extern void *xcalloc(size_t nmemb, size_t size)
}
#endif
-#if defined BB_FEATURE_NFSMOUNT || defined BB_SH || defined BB_LS
+#if defined BB_FEATURE_NFSMOUNT || defined BB_LS || defined BB_SH || defined BB_WGET
# ifndef DMALLOC
extern char * xstrdup (const char *s) {
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)
{
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 $
*/