diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-12-08 01:42:11 +0300 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-12-08 01:42:11 +0300 |
commit | f3b2b52b589bccae28b1740c155733028f2b8fd5 (patch) | |
tree | 8e1ff3e2bd1ccd5eb5a56fcc59cac4069708ed1c /networking | |
parent | f57c944e09417edcbcd69f2b01b937cadef39db2 (diff) |
Patch from Matt Kraai to enable proxy support.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/wget.c | 17 |
1 files changed, 14 insertions, 3 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 $ */ |