Merge pull request #3170 from jonathonf/patch-2

Set correct Host in request header
This commit is contained in:
Dominik Picheta 2015-08-01 20:55:46 +01:00
commit e205a9e3af

View file

@ -402,7 +402,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
headers.add(" HTTP/1.1\c\L") headers.add(" HTTP/1.1\c\L")
add(headers, "Host: " & r.hostname & "\c\L") add(headers, "Host: " & parseUri(url).hostname & "\c\L")
if userAgent != "": if userAgent != "":
add(headers, "User-Agent: " & userAgent & "\c\L") add(headers, "User-Agent: " & userAgent & "\c\L")
if proxy != nil and proxy.auth != "": if proxy != nil and proxy.auth != "":