diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2016-11-30 18:49:10 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-11-30 19:42:31 +0100 |
commit | 48cfff3fbec9be3a9b7bd6e654812ad58a67d1d1 (patch) | |
tree | 1157babda8d06c3d1d974468f8056d144cfc60d7 | |
parent | ccb314db2e99463de15eed9d7626360d82aec4d2 (diff) | |
download | uclient-48cfff3fbec9be3a9b7bd6e654812ad58a67d1d1.tar.gz |
uclient-http: send correct "Host:" header if port is set
When connecting to a website with a special port, uclient-fetch connects
to the correct port, but is sending an incorrect Host: header without
the corresponding port.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
-rw-r--r-- | uclient-http.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/uclient-http.c b/uclient-http.c index 899f367..8d26bd4 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -569,9 +569,11 @@ uclient_http_send_headers(struct uclient_http *uh) ustream_printf(uh->us, "%s %s HTTP/1.1\r\n" - "Host: %s\r\n", + "Host: %s%s%s\r\n", request_types[req_type], - url->location, url->host); + url->location, url->host, + url->port ? ":" : "", + url->port ? url->port : ""); blobmsg_for_each_attr(cur, uh->headers.head, rem) ustream_printf(uh->us, "%s: %s\r\n", blobmsg_name(cur), (char *) blobmsg_data(cur)); |