net.http: Allow using DANE via options or per request settings
authorKim Alvefur <zash@zash.se>
Sat, 05 Feb 2022 01:32:08 +0100
changeset 12277 c0f49a4026f8
parent 12276 fe0f5c47fda3
child 12278 10447f940fec
net.http: Allow using DANE via options or per request settings Dare to enable by default?
net/http.lua
--- a/net/http.lua	Fri Feb 04 22:11:14 2022 +0100
+++ b/net/http.lua	Sat Feb 05 01:32:08 2022 +0100
@@ -287,12 +287,16 @@
 	end
 	local port_number = port and tonumber(port) or (using_https and 443 or 80);
 
+	local use_dane = self.options and self.options.use_dane;
 	local sslctx = false;
 	if using_https then
 		sslctx = ex and ex.sslctx or self.options and self.options.sslctx;
+		if ex and ex.use_dane ~= nil then
+			use_dane = ex.use_dane;
+		end
 	end
 
-	local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host });
+	local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host; use_dane = use_dane });
 	connect(http_service, listener, { sslctx = sslctx }, req);
 
 	self.events.fire_event("request", { http = self, request = req, url = u });