Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
13500:997d9ad12477 | 13505:a97c11584042 |
---|---|
292 if using_https then | 292 if using_https then |
293 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; |
294 if ex and ex.use_dane ~= nil then | 294 if ex and ex.use_dane ~= nil then |
295 use_dane = ex.use_dane; | 295 use_dane = ex.use_dane; |
296 end | 296 end |
297 if not sslctx then | |
298 error("Attempt to make HTTPS request but no 'sslctx' provided in options"); | |
299 end | |
297 end | 300 end |
298 | 301 |
299 local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host; use_dane = use_dane }); | 302 local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host; use_dane = use_dane }); |
300 connect(http_service, listener, { sslctx = sslctx }, req); | 303 connect(http_service, listener, { sslctx = sslctx }, req); |
301 | 304 |