From 340fbf47377916c92dea4cd97e132dd951179060 Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Sun, 1 Jul 2007 14:48:46 +0000 Subject: [PATCH] The "Host" HTTP header should be placed as early as possible and also include the port number. --- misc/http_client.c | 4 ++-- 1 file 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))