allow missing proto in local proxy

This commit is contained in:
AJ ONeal 2016-10-05 23:27:57 -06:00
parent c57b8f6a6d
commit 3a36248377
2 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,10 @@ function collectProxies(val, memo) {
// http:john.example.com:3000 // http:john.example.com:3000
// http://john.example.com:3000 // http://john.example.com:3000
var parts = location.split(':'); var parts = location.split(':');
if (!parts[1]) {
parts[1] = parts[0];
parts[0] = 'https';
}
parts[0] = parts[0].toLowerCase(); parts[0] = parts[0].toLowerCase();
parts[1] = parts[1].toLowerCase().replace(/(\/\/)?/, '') || '*'; parts[1] = parts[1].toLowerCase().replace(/(\/\/)?/, '') || '*';
parts[2] = parseInt(parts[2], 10) || 0; parts[2] = parseInt(parts[2], 10) || 0;
@ -124,6 +128,11 @@ program.net = {
return socket; return socket;
} }
}; };
program.locals.forEach(function (proxy) {
console.log('[local proxy]', proxy.protocol + '://' + proxy.hostname + ':' + proxy.port);
});
stunnel.connect(program); stunnel.connect(program);
}()); }());

View File

@ -24,7 +24,7 @@ function socketToId(socket) {
/* /*
var request = require('request'); var request = require('request');
request.get('https://pokemap.hellabit.com:3000?access_token=' + token, { rejectUnauthorized: false }, function (err, resp) { request.get('https://pokemap.hellabit.com/?access_token=' + token, { rejectUnauthorized: false }, function (err, resp) {
console.log('resp.body'); console.log('resp.body');
console.log(resp.body); console.log(resp.body);
}); });