Software /
code /
prosody
Comparison
net/http.lua @ 8200:e92585ab4998
net.http: Add option for disabling TLS certifictate validation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 07 Jul 2017 21:04:46 +0200 |
parent | 8199:8f82d3cd0631 |
child | 8201:a0ad62a269df |
child | 8706:e2919978673e |
comparison
equal
deleted
inserted
replaced
8199:8f82d3cd0631 | 8200:e92585ab4998 |
---|---|
35 | 35 |
36 function listener.onconnect(conn) | 36 function listener.onconnect(conn) |
37 local req = requests[conn]; | 37 local req = requests[conn]; |
38 | 38 |
39 -- Validate certificate | 39 -- Validate certificate |
40 if conn:ssl() then | 40 if not req.insecure and conn:ssl() then |
41 local sock = conn:socket(); | 41 local sock = conn:socket(); |
42 local chain_valid = sock.getpeerverification and sock:getpeerverification(); | 42 local chain_valid = sock.getpeerverification and sock:getpeerverification(); |
43 if not chain_valid then | 43 if not chain_valid then |
44 req.callback("certificate-chain-invalid", 0, req); | 44 req.callback("certificate-chain-invalid", 0, req); |
45 req.callback = nil; | 45 req.callback = nil; |
200 if ex.headers then | 200 if ex.headers then |
201 for k, v in pairs(ex.headers) do | 201 for k, v in pairs(ex.headers) do |
202 headers[k] = v; | 202 headers[k] = v; |
203 end | 203 end |
204 end | 204 end |
205 req.insecure = ex.insecure; | |
205 end | 206 end |
206 | 207 |
207 log("debug", "Making %s %s request '%s' to %s", req.scheme:upper(), method or "GET", req.id, (ex and ex.suppress_url and host_header) or u); | 208 log("debug", "Making %s %s request '%s' to %s", req.scheme:upper(), method or "GET", req.id, (ex and ex.suppress_url and host_header) or u); |
208 | 209 |
209 -- Attach to request object | 210 -- Attach to request object |