mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
merge dev
This commit is contained in:
parent
535ef82e48
commit
5e3cbadffc
@ -16,12 +16,8 @@
|
||||
|
||||
module.exports = async function(RED) {
|
||||
"use strict";
|
||||
<<<<<<< HEAD
|
||||
const { getProxyForUrl, parseUrl } = require('./lib/proxyHelper');
|
||||
const got = require("got");
|
||||
=======
|
||||
const { got } = await import('got')
|
||||
>>>>>>> upstream/dev
|
||||
const {CookieJar} = require("tough-cookie");
|
||||
const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent');
|
||||
const FormData = require('form-data');
|
||||
@ -104,7 +100,6 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
if (n.paytoqs === true || n.paytoqs === "query") { paytoqs = true; }
|
||||
else if (n.paytoqs === "body") { paytobody = true; }
|
||||
|
||||
<<<<<<< HEAD
|
||||
let proxyConfig = n.proxy ? RED.nodes.getNode(n.proxy) || {} : null
|
||||
const getProxy = (url) => {
|
||||
const proxyOptions = Object.assign({}, RED.settings.proxyOptions);
|
||||
@ -115,21 +110,6 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
}
|
||||
}
|
||||
return getProxyForUrl(url, proxyOptions)
|
||||
=======
|
||||
node.insecureHTTPParser = n.insecureHTTPParser
|
||||
|
||||
var prox, noprox;
|
||||
if (process.env.http_proxy) { prox = process.env.http_proxy; }
|
||||
if (process.env.HTTP_PROXY) { prox = process.env.HTTP_PROXY; }
|
||||
if (process.env.no_proxy) { noprox = process.env.no_proxy.split(","); }
|
||||
if (process.env.NO_PROXY) { noprox = process.env.NO_PROXY.split(","); }
|
||||
|
||||
var proxyConfig = null;
|
||||
if (n.proxy) {
|
||||
proxyConfig = RED.nodes.getNode(n.proxy);
|
||||
prox = proxyConfig.url;
|
||||
noprox = proxyConfig.noproxy;
|
||||
>>>>>>> upstream/dev
|
||||
}
|
||||
let prox = getProxy(nodeUrl || '')
|
||||
|
||||
@ -160,7 +140,15 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} headersObject
|
||||
* @param {string} name
|
||||
* @return {any} value
|
||||
*/
|
||||
const getHeaderValue = (headersObject, name) => {
|
||||
const asLowercase = name.toLowercase();
|
||||
return headersObject[Object.keys(headersObject).find(k => k.toLowerCase() === asLowercase)];
|
||||
}
|
||||
this.on("input",function(msg,nodeSend,nodeDone) {
|
||||
checkNodeAgentPatch();
|
||||
//reset redirectList on each request
|
||||
@ -561,8 +549,8 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
keepAlive: true
|
||||
}
|
||||
if (proxyConfig && proxyConfig.credentials) {
|
||||
let proxyUsername = proxyConfig.credentials.username || '';
|
||||
let proxyPassword = proxyConfig.credentials.password || '';
|
||||
const proxyUsername = proxyConfig.credentials.username || '';
|
||||
const proxyPassword = proxyConfig.credentials.password || '';
|
||||
if (proxyUsername || proxyPassword) {
|
||||
proxyOptions.proxy = proxyURL
|
||||
proxyOptions.proxy.username = proxyUsername;
|
||||
@ -576,14 +564,9 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
//need both incase of http -> https redirect
|
||||
opts.agent = {
|
||||
http: new HttpProxyAgent(proxyOptions),
|
||||
<<<<<<< HEAD
|
||||
https: new HttpProxyAgent(proxyOptions)
|
||||
};
|
||||
|
||||
=======
|
||||
https: new HttpsProxyAgent(proxyOptions)
|
||||
}
|
||||
>>>>>>> upstream/dev
|
||||
} else {
|
||||
node.warn("Bad proxy url: " + proxyUrl);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user