Patch from Matt Kraai to enable proxy support.

This commit is contained in:
Eric Andersen 2000-12-07 22:42:11 +00:00
parent f57c944e09
commit f3b2b52b58
3 changed files with 30 additions and 8 deletions

View File

@ -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");
/*
* Use the proxy if necessary.
*/
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 $
*/

View File

@ -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;

13
wget.c
View File

@ -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");
/*
* Use the proxy if necessary.
*/
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 $
*/