mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add fix for HttpsProxyAgent using an incorrect default port for http:
This commit is contained in:
parent
d32d04bd4e
commit
aa86cfc55f
@ -88,8 +88,13 @@ module.exports = function(RED) {
|
|||||||
if (msg.method && n.method && (n.method === "use")) {
|
if (msg.method && n.method && (n.method === "use")) {
|
||||||
method = msg.method.toUpperCase(); // use the msg parameter
|
method = msg.method.toUpperCase(); // use the msg parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isHttps = (/^https/.test(url));
|
||||||
|
|
||||||
var opts = {};
|
var opts = {};
|
||||||
opts.url = url;
|
opts.url = url;
|
||||||
|
// set defaultport, else when using HttpsProxyAgent, it's defaultPort of 443 will be used :(.
|
||||||
|
opts.defaultPort = isHttps?443:80;
|
||||||
opts.timeout = node.reqTimeout;
|
opts.timeout = node.reqTimeout;
|
||||||
opts.method = method;
|
opts.method = method;
|
||||||
opts.headers = {};
|
opts.headers = {};
|
||||||
@ -284,6 +289,7 @@ module.exports = function(RED) {
|
|||||||
opts.headers[clSet] = opts.headers['content-length'];
|
opts.headers[clSet] = opts.headers['content-length'];
|
||||||
delete opts.headers['content-length'];
|
delete opts.headers['content-length'];
|
||||||
}
|
}
|
||||||
|
|
||||||
var noproxy;
|
var noproxy;
|
||||||
if (noprox) {
|
if (noprox) {
|
||||||
for (var i in noprox) {
|
for (var i in noprox) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user