diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2007-03-12 04:08:40 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2007-03-12 04:08:40 +0000 |
commit | be2e467929be9f27fbe92fe7b94783635c920c06 (patch) | |
tree | 94054e38f33178d805a6144d3bd9cb76da4a4c76 /src/http.lua | |
parent | 8bf9fb51dd09fb066483247fccbfc979acc84071 (diff) | |
download | luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.tar.gz luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.tar.bz2 luasocket-be2e467929be9f27fbe92fe7b94783635c920c06.zip |
Couple bug fixes.
Diffstat (limited to 'src/http.lua')
-rw-r--r-- | src/http.lua | 5 |
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 | ||
108 | function open(host, port, create) | 108 | function 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 |