{
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;
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.
* 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 $
*/
* 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.
}
#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;
{
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;
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.
* 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 $
*/