aboutsummaryrefslogtreecommitdiffstats
path: root/net/http.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-03-20 20:31:02 +0000
committerMatthew Wild <mwild1@gmail.com>2013-03-20 20:31:02 +0000
commit375e615103568f5de0f2f8722768f48850760a29 (patch)
treed047ec3165afed6c6c0c77ede044663a0e9cab25 /net/http.lua
parentee9ef878c4f1702f3bacfd8d3c0c98844c3b481f (diff)
downloadprosody-375e615103568f5de0f2f8722768f48850760a29.tar.gz
prosody-375e615103568f5de0f2f8722768f48850760a29.zip
net.http: Allow passing an SSL context or options table to be used for HTTPS requests (thanks daurnimator)
Diffstat (limited to 'net/http.lua')
-rw-r--r--net/http.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua
index 273eee09..9ed837e2 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -188,7 +188,12 @@ function request(u, ex, callback)
return nil, err;
end
- req.handler, req.conn = server.wrapclient(conn, req.host, port, listener, "*a", using_https and { mode = "client", protocol = "sslv23" });
+ local sslctx = false;
+ if using_https then
+ sslctx = ex and ex.sslctx or { mode = "client", protocol = "sslv23" };
+ end
+
+ req.handler, req.conn = server.wrapclient(conn, req.host, port, 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