diff options
| author | Diego Nehab <diego@impa.br> | 2014-07-15 14:49:20 -0300 |
|---|---|---|
| committer | Diego Nehab <diego@impa.br> | 2014-07-15 14:49:20 -0300 |
| commit | d80bb0d82ba105c8fdb27e6174c267965d06ffb0 (patch) | |
| tree | ac21f3af395dfc0562c86bc7181748b3b9cd7a75 | |
| parent | 6d5e40c324c84d9c1453ae88e0ad5bdd0a631448 (diff) | |
| download | luasocket-d80bb0d82ba105c8fdb27e6174c267965d06ffb0.tar.gz luasocket-d80bb0d82ba105c8fdb27e6174c267965d06ffb0.tar.bz2 luasocket-d80bb0d82ba105c8fdb27e6174c267965d06ffb0.zip | |
Fix Host: header according to RFC7230
| -rw-r--r-- | src/http.lua | 5 |
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 | ||
| 210 | local function adjustheaders(reqt) | 210 | local 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 |
| 354 | end) | 353 | end) |
| 355 | 354 | ||
| 356 | return _M \ No newline at end of file | 355 | return _M |
