aboutsummaryrefslogtreecommitdiff
path: root/src/http.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/http.lua')
-rw-r--r--src/http.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/http.lua b/src/http.lua
index 558f347..9d739a4 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -107,7 +107,7 @@ local metat = { __index = {} }
107 107
108function open(host, port, create) 108function open(host, port, create)
109 -- create socket with user connect function, or with default 109 -- create socket with user connect function, or with default
110 local c = socket.try(create or socket.tcp)() 110 local c = socket.try((create or socket.tcp)())
111 local h = base.setmetatable({ c = c }, metat) 111 local h = base.setmetatable({ c = c }, metat)
112 -- create finalized try 112 -- create finalized try
113 h.try = socket.newtry(function() h:close() end) 113 h.try = socket.newtry(function() h:close() end)
@@ -228,7 +228,8 @@ local function adjustrequest(reqt)
228 -- explicit components override url 228 -- explicit components override url
229 for i,v in base.pairs(reqt) do nreqt[i] = v end 229 for i,v in base.pairs(reqt) do nreqt[i] = v end
230 if nreqt.port == "" then nreqt.port = 80 end 230 if nreqt.port == "" then nreqt.port = 80 end
231 socket.try(nreqt.host, "invalid host '" .. base.tostring(nreqt.host) .. "'") 231 socket.try(nreqt.host and nreqt.host ~= "",
232 "invalid host '" .. base.tostring(nreqt.host) .. "'")
232 -- compute uri if user hasn't overriden 233 -- compute uri if user hasn't overriden
233 nreqt.uri = reqt.uri or adjusturi(nreqt) 234 nreqt.uri = reqt.uri or adjusturi(nreqt)
234 -- ajust host and port if there is a proxy 235 -- ajust host and port if there is a proxy