From 9dde0ae3ac6c97704f64e0dee0d55c1a49faaf4b Mon Sep 17 00:00:00 2001 From: jonathonf Date: Sat, 1 Aug 2015 20:53:37 +0100 Subject: Set correct Host in request header Ensure the correct destination hostname is used in the request, otherwise the request will fail in one of a number of interesting ways when using a proxy. Fixes https://github.com/nim-lang/Nim/issues/3166 --- lib/pure/httpclient.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index e6b8088c5..98687359b 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -402,7 +402,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "", headers.add(" HTTP/1.1\c\L") - add(headers, "Host: " & r.hostname & "\c\L") + add(headers, "Host: " & parseUri(url).hostname & "\c\L") if userAgent != "": add(headers, "User-Agent: " & userAgent & "\c\L") if proxy != nil and proxy.auth != "": -- cgit 1.4.1-2-gfad0