using global-tunnel to connect behind a proxy
when using https (bypassing options to http) throws following Exception
ps actual request was made by the twitter js sdk
Exception has occurred: TypeError
TypeError: Request path contains unescaped characters
at new ClientRequest (_http_client.js:52:11)
at TunnelingAgent.exports.request (http.js:31:10)
at TunnelingAgent.createSocket (/Users/d062254/Documents/sap git/srch-middleware/node_modules/tunnel/lib/tunnel.js:124:25)
at TunnelingAgent.createSecureSocket [as createSocket] (/Users/d062254/Documents/sap git/srch-middleware/node_modules/tunnel/lib/tunnel.js:196:41)
at TunnelingAgent.addRequest (/Users/d062254/Documents/sap git/srch-middleware/node_modules/tunnel/lib/tunnel.js:88:8)
at new ClientRequest (_http_client.js:159:16)
at Object.exports.request (http.js:31:10)
at Object.globalTunnel._defaultedAgentRequest (/Users/d062254/Documents/sap git/srch-middleware/node_modules/global-tunnel/index.js:211:38)
at Object.exports.request (https.js:199:15)
at Object.globalTunnel._defaultedAgentRequest (/Users/d062254/Documents/sap git/srch-middleware/node_modules/global-tunnel/index.js:211:38)
i fixed the issueby adding the following in /lib/tunnel.js
//... line 69 ...
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) {
var self = this;
var options;
if (typeof host === 'object')
{
options = host;
host = options.host;
port = options.port;
}
// end bugfix
if (self.sockets.length >= this.maxSockets) {
// We are over limit so we'll add it to the queue.
self.requests.push({host: host, port: port, request: req});
return;
}
import * as globalTunnel from "global-tunnel";
globalTunnel.initialize({
tunnel: 'both',
protocol: 'http:',
host: 'proxy.sam.corp',
port: 8080,
sockets: 50 // optional pool size for each http and https
});
using global-tunnel to connect behind a proxy when using https (bypassing options to http) throws following Exception
ps actual request was made by the twitter js sdk
i fixed the issueby adding the following in /lib/tunnel.js
usage of globalTunnel
actual request is being created by twitter-node-client