aboutsummaryrefslogtreecommitdiff
path: root/src/http.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2007-03-12 04:08:40 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2007-03-12 04:08:40 +0000
commitbe2e467929be9f27fbe92fe7b94783635c920c06 (patch)
tree94054e38f33178d805a6144d3bd9cb76da4a4c76 /src/http.lua
parent8bf9fb51dd09fb066483247fccbfc979acc84071 (diff)
downloadluasocket-be2e467929be9f27fbe92fe7b94783635c920c06.tar.gz
luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.tar.bz2
luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.zip
Couple bug fixes.
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