Diff

net/http.lua @ 13505:a97c11584042 0.12

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
author Kim Alvefur <zash@zash.se>
date Thu, 08 Aug 2024 19:18:22 +0200
parent 12881:91baddaeea84
child 13508:eac86b5fb04b
line wrap: on
line diff
--- a/net/http.lua	Thu Jul 11 15:24:19 2024 +0200
+++ b/net/http.lua	Thu Aug 08 19:18:22 2024 +0200
@@ -294,6 +294,9 @@
 		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 });