# HG changeset patch # User Matthew Wild # Date 1363811462 0 # Node ID 8c3f28f5c1c1541028a5fa4cf41515309d6cb6c2 # Parent 901ed253bbf703beeb77cb15920f421aaadab0ef net.http: Allow passing an SSL context or options table to be used for HTTPS requests (thanks daurnimator) diff -r 901ed253bbf7 -r 8c3f28f5c1c1 net/http.lua --- 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