diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-03 22:09:26 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-03 22:09:26 +0000 |
commit | b36b370fbec946290e5b3d149d4d14a0db458cfa (patch) | |
tree | 2400ee1c3f75fc2102fd47142a38c3c26476e620 /networking | |
parent | 562dc249e039878e927f8250c82507e6e844f547 (diff) | |
download | busybox-w32-b36b370fbec946290e5b3d149d4d14a0db458cfa.tar.gz busybox-w32-b36b370fbec946290e5b3d149d4d14a0db458cfa.tar.bz2 busybox-w32-b36b370fbec946290e5b3d149d4d14a0db458cfa.zip |
wget: print port# in 'Host' header, if different from 80
Diffstat (limited to 'networking')
-rw-r--r-- | networking/wget.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/networking/wget.c b/networking/wget.c index fbdbf62f6..bca66f822 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -272,8 +272,15 @@ int wget_main(int argc, char **argv) | |||
272 | fprintf(sfp, "GET /%s HTTP/1.1\r\n", target.path); | 272 | fprintf(sfp, "GET /%s HTTP/1.1\r\n", target.path); |
273 | } | 273 | } |
274 | 274 | ||
275 | fprintf(sfp, "Host: %s\r\nUser-Agent: %s\r\n", target.host, | 275 | { |
276 | user_agent); | 276 | const char *portstr = ""; |
277 | if (target.port != 80) | ||
278 | portstr = xasprintf(":%d", target.port); | ||
279 | fprintf(sfp, "Host: %s%s\r\nUser-Agent: %s\r\n", | ||
280 | target.host, portstr, user_agent); | ||
281 | if (ENABLE_FEATURE_CLEAN_UP && target.port != 80) | ||
282 | free((char*)portstr); | ||
283 | } | ||
277 | 284 | ||
278 | #if ENABLE_FEATURE_WGET_AUTHENTICATION | 285 | #if ENABLE_FEATURE_WGET_AUTHENTICATION |
279 | if (target.user) { | 286 | if (target.user) { |