# HG changeset patch # User Matthew Wild # Date 1387236256 0 # Node ID 1341384628ec51ea278ecfb051cf50fb1a0e4db1 # Parent f3817912e8b2357332d46f374ae51e7bc81dc745 net.http: assert() for socket creation success so it doesn't silently fail (thanks daurnimator) diff -r f3817912e8b2 -r 1341384628ec net/http.lua --- a/net/http.lua Mon Dec 16 02:03:35 2013 +0000 +++ b/net/http.lua Mon Dec 16 23:24:16 2013 +0000 @@ -20,6 +20,7 @@ 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 @@ 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