From 4f7c829b1e7e88e725ae5ccc5c5f45c92086d590 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 8 Aug 2024 19:18:22 +0200 Subject: 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 --- net/http.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'net') 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 }); -- cgit v1.2.3