aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiego Nehab <diego@impa.br>2014-07-15 14:49:20 -0300
committerDiego Nehab <diego@impa.br>2014-07-15 14:49:20 -0300
commitd80bb0d82ba105c8fdb27e6174c267965d06ffb0 (patch)
treeac21f3af395dfc0562c86bc7181748b3b9cd7a75 /src
parent6d5e40c324c84d9c1453ae88e0ad5bdd0a631448 (diff)
downloadluasocket-d80bb0d82ba105c8fdb27e6174c267965d06ffb0.tar.gz
luasocket-d80bb0d82ba105c8fdb27e6174c267965d06ffb0.tar.bz2
luasocket-d80bb0d82ba105c8fdb27e6174c267965d06ffb0.zip
Fix Host: header according to RFC7230
Diffstat (limited to 'src')
-rw-r--r--src/http.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/http.lua b/src/http.lua
index 1d0eb50..d5457f6 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -209,8 +209,7 @@ end
209 209
210local function adjustheaders(reqt) 210local function adjustheaders(reqt)
211 -- default headers 211 -- default headers
212 local host = reqt.host 212 local host = string.gsub(reqt.authority, "^.-@", "")
213 if reqt.port then host = host .. ":" .. reqt.port end
214 local lower = { 213 local lower = {
215 ["user-agent"] = _M.USERAGENT, 214 ["user-agent"] = _M.USERAGENT,
216 ["host"] = host, 215 ["host"] = host,
@@ -353,4 +352,4 @@ _M.request = socket.protect(function(reqt, body)
353 else return trequest(reqt) end 352 else return trequest(reqt) end
354end) 353end)
355 354
356return _M \ No newline at end of file 355return _M