summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-03 22:09:26 +0000
committerDenis Vlasenko2007-01-03 22:09:26 +0000
commitb36b370fbec946290e5b3d149d4d14a0db458cfa (patch)
tree2400ee1c3f75fc2102fd47142a38c3c26476e620
parent562dc249e039878e927f8250c82507e6e844f547 (diff)
downloadbusybox-b36b370fbec946290e5b3d149d4d14a0db458cfa.zip
busybox-b36b370fbec946290e5b3d149d4d14a0db458cfa.tar.gz
wget: print port# in 'Host' header, if different from 80
-rw-r--r--networking/wget.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/networking/wget.c b/networking/wget.c
index fbdbf62..bca66f8 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -272,8 +272,15 @@ int wget_main(int argc, char **argv)
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) {