Software / code / prosody
Comparison
net/http.lua @ 12273:c0f49a4026f8
net.http: Allow using DANE via options or per request settings
Dare to enable by default?
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 05 Feb 2022 01:32:08 +0100 |
| parent | 11749:83d6d6a70edf |
| child | 12881:91baddaeea84 |
comparison
equal
deleted
inserted
replaced
| 12272:fe0f5c47fda3 | 12273:c0f49a4026f8 |
|---|---|
| 285 if using_https and not ssl_available then | 285 if using_https and not ssl_available then |
| 286 error("SSL not available, unable to contact https URL"); | 286 error("SSL not available, unable to contact https URL"); |
| 287 end | 287 end |
| 288 local port_number = port and tonumber(port) or (using_https and 443 or 80); | 288 local port_number = port and tonumber(port) or (using_https and 443 or 80); |
| 289 | 289 |
| 290 local use_dane = self.options and self.options.use_dane; | |
| 290 local sslctx = false; | 291 local sslctx = false; |
| 291 if using_https then | 292 if using_https then |
| 292 sslctx = ex and ex.sslctx or self.options and self.options.sslctx; | 293 sslctx = ex and ex.sslctx or self.options and self.options.sslctx; |
| 293 end | 294 if ex and ex.use_dane ~= nil then |
| 294 | 295 use_dane = ex.use_dane; |
| 295 local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host }); | 296 end |
| 297 end | |
| 298 | |
| 299 local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host; use_dane = use_dane }); | |
| 296 connect(http_service, listener, { sslctx = sslctx }, req); | 300 connect(http_service, listener, { sslctx = sslctx }, req); |
| 297 | 301 |
| 298 self.events.fire_event("request", { http = self, request = req, url = u }); | 302 self.events.fire_event("request", { http = self, request = req, url = u }); |
| 299 return req; | 303 return req; |
| 300 end | 304 end |