diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-08 17:22:15 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-08 17:22:15 +0100 |
commit | 22baeb39fe3c291e7f98977b7fa6af8353d910dd (patch) | |
tree | b63f60f6dff8c647f5952a2a92bb0a1da8d2a94f /net/http.lua | |
parent | 4f4ea37379152abaee179a750a24f7019c405583 (diff) | |
parent | 0ce5c766ac0a68a167a9fa26b931c56d35ae785b (diff) | |
download | prosody-22baeb39fe3c291e7f98977b7fa6af8353d910dd.tar.gz prosody-22baeb39fe3c291e7f98977b7fa6af8353d910dd.zip |
Merge 0.9->trunk
Diffstat (limited to 'net/http.lua')
-rw-r--r-- | net/http.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/http.lua b/net/http.lua index a1e4e523..ec55af92 100644 --- a/net/http.lua +++ b/net/http.lua @@ -11,6 +11,8 @@ local b64 = require "util.encodings".base64.encode; local url = require "socket.url" local httpstream_new = require "util.httpstream".new; +local ssl_available = pcall(require, "ssl"); + local server = require "net.server" local t_insert, t_concat = table.insert, table.concat; @@ -177,6 +179,9 @@ function request(u, ex, callback) req.method, req.headers, req.body = method, headers, body; local using_https = req.scheme == "https"; + if using_https and not ssl_available then + error("SSL not available, unable to contact https URL"); + end local port = tonumber(req.port) or (using_https and 443 or 80); -- Connect the socket, and wrap it with net.server |