aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-12-16 23:24:16 +0000
committerMatthew Wild <mwild1@gmail.com>2013-12-16 23:24:16 +0000
commit741e58831a2b846e42a5a9ca8722ae218c03aa56 (patch)
treefabcd9cfbb4d813ebf8249f0105da456874cb527 /net
parent619f61c2860780d8588ad589d988535b3e2af13a (diff)
downloadprosody-741e58831a2b846e42a5a9ca8722ae218c03aa56.tar.gz
prosody-741e58831a2b846e42a5a9ca8722ae218c03aa56.zip
net.http: assert() for socket creation success so it doesn't silently fail (thanks daurnimator)
Diffstat (limited to 'net')
-rw-r--r--net/http.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua
index b7d2beb9..6ddb1900 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -20,6 +20,7 @@ local t_insert, t_concat = table.insert, table.concat;
local pairs = pairs;
local tonumber, tostring, xpcall, select, traceback =
tonumber, tostring, xpcall, select, debug.traceback;
+local assert, error = assert, error
local log = require "util.logger".init("http");
@@ -173,7 +174,7 @@ function request(u, ex, callback)
sslctx = ex and ex.sslctx or { mode = "client", protocol = "sslv23", options = { "no_sslv2" } };
end
- req.handler, req.conn = server.wrapclient(conn, host, port_number, listener, "*a", sslctx);
+ req.handler, req.conn = assert(server.wrapclient(conn, host, port_number, listener, "*a", sslctx));
req.write = function (...) return req.handler:write(...); end
req.callback = function (content, code, request, response) log("debug", "Calling callback, status %s", code or "---"); return select(2, xpcall(function () return callback(content, code, request, response) end, handleerr)); end