1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add support for rejectUnauthorized msg property

This update lets you pass msg.rejectUnauthorized=false
to allow you to connect to https sites that don't have
certs signed by recognised CAs
This commit is contained in:
Ben Hardill 2017-03-23 19:48:48 +00:00
parent 5c2e7ce407
commit ba0823c38c
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
2 changed files with 5 additions and 0 deletions

View File

@ -79,6 +79,7 @@
<li><code>headers</code>, if set, should be an object containing field/value
pairs to be added as request headers</li>
<li><code>payload</code> is sent as the body of the request</li>
<li><code>rejectUnauthorized</code> allows requests to be made </li>
</ul>
<p>When configured within the node, the URL property can contain <a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache-style</a> tags. These allow the
url to be constructed using values of the incoming message. For example, if the url is set to

View File

@ -154,6 +154,10 @@ module.exports = function(RED) {
}
if (tlsNode) {
tlsNode.addTLSOptions(opts);
} else {
if (msg.hasOwnProperty('rejectUnauthorized')) {
opts.rejectUnauthorized = msg.rejectUnauthorized;
}
}
var req = ((/^https/.test(urltotest))?https:http).request(opts,function(res) {
(node.ret === "bin") ? res.setEncoding('binary') : res.setEncoding('utf8');