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

Merge pull request #2261 from eeyepee/master

Add HTTP Persistent (session reuse) capability
This commit is contained in:
Nick O'Leary 2019-08-21 11:44:35 +01:00 committed by GitHub
commit 311c7b1158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 8 deletions

View File

@ -1763,7 +1763,8 @@ RED.editor = (function() {
RED.tray.resize(); RED.tray.resize();
} }
}, },
collapsible: true collapsible: true,
menu: false
}); });
var nodePropertiesTab = { var nodePropertiesTab = {
@ -2339,7 +2340,8 @@ RED.editor = (function() {
RED.tray.resize(); RED.tray.resize();
} }
}, },
collapsible: true collapsible: true,
menu: false
}); });
var nodePropertiesTab = { var nodePropertiesTab = {

View File

@ -1292,12 +1292,15 @@ RED.view = (function() {
removedLinks.push(drag_lines[i].link) removedLinks.push(drag_lines[i].link)
} }
} }
historyEvent = { if (removedLinks.length > 0) {
t:"delete", historyEvent = {
links: removedLinks, t:"delete",
dirty:RED.nodes.dirty() links: removedLinks,
}; dirty:RED.nodes.dirty()
RED.history.push(historyEvent); };
RED.history.push(historyEvent);
RED.nodes.dirty(true);
}
hideDragLines(); hideDragLines();
} }
if (lasso) { if (lasso) {

View File

@ -68,6 +68,11 @@
</div> </div>
</div> </div>
<div class="form-row">
<input type="checkbox" id="node-input-persist" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-persist" style="width: auto" data-i18n="httpin.persist"></label>
</div>
<div class="form-row"> <div class="form-row">
<input type="checkbox" id="node-input-useProxy" style="display: inline-block; width: auto; vertical-align: top;"> <input type="checkbox" id="node-input-useProxy" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-useProxy" style="width: auto;"><span data-i18n="httpin.use-proxy"></span></label> <label for="node-input-useProxy" style="width: auto;"><span data-i18n="httpin.use-proxy"></span></label>
@ -102,6 +107,7 @@
paytoqs: {value: false}, paytoqs: {value: false},
url:{value:"",validate:function(v) { return (v.trim().length === 0) || (v.indexOf("://") === -1) || (v.trim().indexOf("http") === 0)} }, url:{value:"",validate:function(v) { return (v.trim().length === 0) || (v.indexOf("://") === -1) || (v.trim().indexOf("http") === 0)} },
tls: {type:"tls-config",required: false}, tls: {type:"tls-config",required: false},
"persist":{value:true},
proxy: {type:"http proxy",required: false}, proxy: {type:"http proxy",required: false},
authType: {value: ""} authType: {value: ""}
}, },

View File

@ -29,6 +29,7 @@ module.exports = function(RED) {
var isTemplatedUrl = (nodeUrl||"").indexOf("{{") != -1; var isTemplatedUrl = (nodeUrl||"").indexOf("{{") != -1;
var nodeMethod = n.method || "GET"; var nodeMethod = n.method || "GET";
var paytoqs = n.paytoqs; var paytoqs = n.paytoqs;
var nodeHTTPPersistent = n["persist"];
if (n.tls) { if (n.tls) {
var tlsNode = RED.nodes.getNode(n.tls); var tlsNode = RED.nodes.getNode(n.tls);
} }
@ -96,6 +97,7 @@ module.exports = function(RED) {
opts.maxRedirects = 21; opts.maxRedirects = 21;
opts.jar = request.jar(); opts.jar = request.jar();
opts.proxy = null; opts.proxy = null;
opts.forever = nodeHTTPPersistent;
if (msg.requestTimeout !== undefined) { if (msg.requestTimeout !== undefined) {
if (isNaN(msg.requestTimeout)) { if (isNaN(msg.requestTimeout)) {
node.warn(RED._("httpin.errors.timeout-isnan")); node.warn(RED._("httpin.errors.timeout-isnan"));

View File

@ -413,6 +413,7 @@
"digest": "digest authentication", "digest": "digest authentication",
"bearer": "bearer authentication", "bearer": "bearer authentication",
"use-proxy": "Use proxy", "use-proxy": "Use proxy",
"persist": "Enable connection keep-alive",
"proxy-config": "Proxy Configuration", "proxy-config": "Proxy Configuration",
"use-proxyauth": "Use proxy authentication", "use-proxyauth": "Use proxy authentication",
"noproxy-hosts": "Ignore hosts", "noproxy-hosts": "Ignore hosts",