[BusyBox-cvs] busybox/networking wget.c,1.68,1.69

Glenn McGrath bug1 at busybox.net
Sun Feb 22 00:27:36 UTC 2004


Update of /var/cvs/busybox/networking
In directory nail:/tmp/cvs-serv28631/networking

Modified Files:
	wget.c 
Log Message:
No need to check proxy env variable twice, ignore proxy env variable if 
its set to 0


Index: wget.c
===================================================================
RCS file: /var/cvs/busybox/networking/wget.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- a/wget.c	31 Jan 2004 08:08:57 -0000	1.68
+++ b/wget.c	22 Feb 2004 00:27:34 -0000	1.69
@@ -185,7 +185,7 @@
 	int got_clen = 0;			/* got content-length: from server	*/
 	FILE *output;				/* socket to web server				*/
 	int quiet_flag = FALSE;		/* Be verry, verry quiet...			*/
-	int noproxy = 0;            /* Use proxies if env vars are set  */
+	int use_proxy = 1;          /* Use proxies if env vars are set  */
 	char *proxy_flag = "on";	/* Use proxies if env vars are set  */
 
 	/*
@@ -200,11 +200,9 @@
 	if (opt & WGET_OPT_QUIET) {
 		quiet_flag = TRUE;
 	}
-	if (strcmp(proxy_flag, "on") == 0) {
+	if (strcmp(proxy_flag, "off") == 0) {
 		/* Use the proxy if necessary. */
-		proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy");
-		if (proxy)
-			parse_url(bb_xstrdup(proxy), &server);
+		use_proxy = 0;
 	}
 	if (opt & WGET_OPT_HEADER) {
 		while (headers_llist) {
@@ -230,10 +228,13 @@
 	/*
 	 * Use the proxy if necessary.
 	 */
-	if (!noproxy) {
+	if (use_proxy) {
 		proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy");
-		if (proxy)
+		if (proxy && *proxy) {
 			parse_url(bb_xstrdup(proxy), &server);
+		} else {
+			use_proxy = 0;
+		}
 	}
 	
 	/* Guess an output filename */
@@ -293,7 +294,7 @@
 				server.host, inet_ntoa(s_in.sin_addr), ntohs(server.port));
 	}
 
-	if (proxy || !target.is_ftp) {
+	if (use_proxy || !target.is_ftp) {
 		/*
 		 *  HTTP session
 		 */
@@ -312,7 +313,7 @@
 			/*
 			 * Send HTTP request.
 			 */
-			if (proxy) {
+			if (use_proxy) {
 				const char *format = "GET %stp://%s:%d/%s HTTP/1.1\r\n";
 #ifdef CONFIG_FEATURE_WGET_IP6_LITERAL
 				if (strchr (target.host, ':'))
@@ -332,7 +333,7 @@
 				fprintf(sfp, "Authorization: Basic %s\r\n",
 					base64enc(target.user, buf, sizeof(buf)));
 			}
-			if (proxy && server.user) {
+			if (use_proxy && server.user) {
 				fprintf(sfp, "Proxy-Authorization: Basic %s\r\n",
 					base64enc(server.user, buf, sizeof(buf)));
 			}
@@ -400,7 +401,7 @@
 						target.path = bb_xstrdup(s+1);
 					else {
 						parse_url(bb_xstrdup(s), &target);
-						if (!proxy) {
+						if (use_proxy == 0) {
 							server.host = target.host;
 							server.port = target.port;
 						}
@@ -525,7 +526,7 @@
 	if (quiet_flag==FALSE)
 		progressmeter(1);
 #endif
-	if (!proxy && target.is_ftp) {
+	if ((use_proxy == 0) && target.is_ftp) {
 		fclose(dfp);
 		if (ftpcmd(NULL, NULL, sfp, buf) != 226)
 			bb_error_msg_and_die("ftp error: %s", buf+4);
@@ -551,7 +552,7 @@
 		bb_error_msg_and_die("not an http or ftp url: %s", url);
 
 	sp = strchr(h->host, '/');
-	if (sp != NULL) {
+	if (sp) {
 		*sp++ = '\0';
 		h->path = sp;
 	} else




More information about the busybox-cvs mailing list