Software /
code /
prosody
Changeset
5353:8c3f28f5c1c1
net.http: Allow passing an SSL context or options table to be used for HTTPS requests (thanks daurnimator)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 20 Mar 2013 20:31:02 +0000 |
parents | 5351:901ed253bbf7 |
children | 5354:18ebc3874364 |
files | net/http.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/http.lua Sat Mar 16 17:46:43 2013 +0100 +++ b/net/http.lua Wed Mar 20 20:31:02 2013 +0000 @@ -188,7 +188,12 @@ 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