svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Wed Jan 3 22:09:28 UTC 2007


Author: vda
Date: 2007-01-03 14:09:26 -0800 (Wed, 03 Jan 2007)
New Revision: 17147

Log:
wget: print port# in 'Host' header, if different from 80


Modified:
   trunk/busybox/networking/wget.c


Changeset:
Modified: trunk/busybox/networking/wget.c
===================================================================
--- trunk/busybox/networking/wget.c	2007-01-03 21:55:50 UTC (rev 17146)
+++ trunk/busybox/networking/wget.c	2007-01-03 22:09:26 UTC (rev 17147)
@@ -272,8 +272,15 @@
 				fprintf(sfp, "GET /%s HTTP/1.1\r\n", target.path);
 			}
 
-			fprintf(sfp, "Host: %s\r\nUser-Agent: %s\r\n", target.host,
-			        user_agent);
+			{
+				const char *portstr = "";
+				if (target.port != 80)
+					portstr = xasprintf(":%d", target.port);
+				fprintf(sfp, "Host: %s%s\r\nUser-Agent: %s\r\n",
+					target.host, portstr, user_agent);
+				if (ENABLE_FEATURE_CLEAN_UP && target.port != 80)
+					free((char*)portstr);
+			}
 
 #if ENABLE_FEATURE_WGET_AUTHENTICATION
 			if (target.user) {




More information about the busybox-cvs mailing list