aboutsummaryrefslogtreecommitdiffstats
path: root/net/http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-08-08 19:18:22 +0200
committerKim Alvefur <zash@zash.se>2024-08-08 19:18:22 +0200
commit4f7c829b1e7e88e725ae5ccc5c5f45c92086d590 (patch)
treeee82b179d844c094beaf3758921374e6bde7ac78 /net/http.lua
parentbb278430cf13e3fbbdf0d36a5884c74a067e4a86 (diff)
downloadprosody-4f7c829b1e7e88e725ae5ccc5c5f45c92086d590.tar.gz
prosody-4f7c829b1e7e88e725ae5ccc5c5f45c92086d590.zip
net.http: Throw error if missing TLS context for HTTPS request
Prevents the mistake of creating a http context without any TLS context and then trying to use HTTPS, which doesn't work right. Thanks nils
Diffstat (limited to 'net/http.lua')
-rw-r--r--net/http.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/http.lua b/net/http.lua
index aa435719..e81975fd 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -294,6 +294,9 @@ local function request(self, u, ex, callback)
if ex and ex.use_dane ~= nil then
use_dane = ex.use_dane;
end
+ if not sslctx then
+ error("Attempt to make HTTPS request but no 'sslctx' provided in options");
+ end
end
local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host; use_dane = use_dane });