about summary refs log tree commit diff
path: root/misc/http_client.c
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2007-07-01 14:48:46 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2007-07-01 14:48:46 +0000
commit340fbf47377916c92dea4cd97e132dd951179060 (patch)
treedc2fdef1092a227e68c9f6200412eebde4d3c2c0 /misc/http_client.c
parent1758597e3e8581e062234c771adf20d5268d548e (diff)
downloadbtpd-340fbf47377916c92dea4cd97e132dd951179060.tar.gz
btpd-340fbf47377916c92dea4cd97e132dd951179060.zip
The "Host" HTTP header should be placed as early as possible and also include
the port number.

Diffstat (limited to 'misc/http_client.c')
-rw-r--r--misc/http_client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/http_client.c b/misc/http_client.c
index 8fb4636..c5d8b04 100644
--- a/misc/http_client.c
+++ b/misc/http_client.c
@@ -459,11 +459,11 @@ http_get(struct http_req **out, const char *url, const char *hdrs,
     if ((req->buf = evbuffer_new()) == NULL)
         goto error;
     if (evbuffer_add_printf(req->buf, "GET %s HTTP/1.1\r\n"
+            "Host: %s:%hu\r\n"
             "Accept-Encoding:\r\n"
             "Connection: close\r\n"
-            "Host: %s\r\n"
             "%s"
-            "\r\n", req->url->uri, req->url->host, hdrs) == -1)
+            "\r\n", req->url->uri, req->url->host, req->url->port, hdrs) == -1)
         goto error;
     if (inet_aton(req->url->host, &addr) == 1) {
         if (!http_connect(req, addr))