From ba0823c38c3f80357ae608f268e502f98687a4be Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Thu, 23 Mar 2017 19:48:48 +0000 Subject: [PATCH 1/2] 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 --- nodes/core/io/21-httprequest.html | 1 + nodes/core/io/21-httprequest.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/nodes/core/io/21-httprequest.html b/nodes/core/io/21-httprequest.html index 0c23d0f11..aa83831fc 100644 --- a/nodes/core/io/21-httprequest.html +++ b/nodes/core/io/21-httprequest.html @@ -79,6 +79,7 @@
  • headers, if set, should be an object containing field/value pairs to be added as request headers
  • payload is sent as the body of the request
  • +
  • rejectUnauthorized allows requests to be made
  • When configured within the node, the URL property can contain mustache-style tags. These allow the url to be constructed using values of the incoming message. For example, if the url is set to diff --git a/nodes/core/io/21-httprequest.js b/nodes/core/io/21-httprequest.js index d6d6f42de..56f377872 100644 --- a/nodes/core/io/21-httprequest.js +++ b/nodes/core/io/21-httprequest.js @@ -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'); From 8cc9aeba4a180ec8480d4f14cce2349c0d2e71ac Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Thu, 23 Mar 2017 20:06:11 +0000 Subject: [PATCH 2/2] Fix docs --- nodes/core/io/21-httprequest.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes/core/io/21-httprequest.html b/nodes/core/io/21-httprequest.html index aa83831fc..557b51c07 100644 --- a/nodes/core/io/21-httprequest.html +++ b/nodes/core/io/21-httprequest.html @@ -79,7 +79,7 @@

  • headers, if set, should be an object containing field/value pairs to be added as request headers
  • payload is sent as the body of the request
  • -
  • rejectUnauthorized allows requests to be made
  • +
  • rejectUnauthorized allows requests to be made to https sites that use self signed certificates
  • When configured within the node, the URL property can contain mustache-style tags. These allow the url to be constructed using values of the incoming message. For example, if the url is set to