mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
let urllib parse proxy url more cleanly in http-request node.
This commit is contained in:
parent
6ccb05cb2c
commit
3a4756bd83
@ -271,14 +271,18 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
if (prox && !noproxy) {
|
if (prox && !noproxy) {
|
||||||
var match = prox.match(/^(http:\/\/)?(.+)?:([0-9]+)?/i);
|
var match = prox.match(/^(http:\/\/)?(.+)?:([0-9]+)?/i);
|
||||||
console.log("MATCH",match);
|
|
||||||
if (match) {
|
if (match) {
|
||||||
opts.protocol = "http:";
|
//opts.protocol = "http:";
|
||||||
|
//opts.host = opts.hostname = match[2];
|
||||||
|
//opts.port = (match[3] != null ? match[3] : 80);
|
||||||
opts.headers['Host'] = opts.host;
|
opts.headers['Host'] = opts.host;
|
||||||
opts.host = opts.hostname = match[2],
|
var heads = opts.headers;
|
||||||
opts.port = (match[3] != null ? match[3] : 80),
|
var path = opts.pathname = opts.href;
|
||||||
opts.path = opts.pathname = opts.href;
|
opts = urllib.parse(prox);
|
||||||
urltotest = match[2];
|
opts.path = opts.pathname = path;
|
||||||
|
opts.headers = heads;
|
||||||
|
//console.log(opts);
|
||||||
|
urltotest = match[0];
|
||||||
}
|
}
|
||||||
else { node.warn("Bad proxy url: "+process.env.http_proxy); }
|
else { node.warn("Bad proxy url: "+process.env.http_proxy); }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user