How to use the forever-agent.SSL function in forever-agent

To help you get started, we’ve selected a few forever-agent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mafintosh / hls-buffer / index.js View on Github external
module.exports = function(url, opts) {
	if (!opts) opts = {};

	var queued = [];
	var that = {};
	var max = opts.max || 10; // default max ~10 in queue
	var onplaylist;

	var agent = undefined;

	if (opts.agent !== false) agent = /^https/.test(url) ? new ForeverAgent.SSL() : new ForeverAgent();

	var readPlaylist = function(playlistUrl, callback) {
		var ts = [];
		request(playlistUrl, {agent:agent}, function(err, response) {
			if (response.statusCode !== 200) return callback();

			var body = response.body.toString().trim();

			body = body.split('\n').map(function(line) {
				if (line[0] === '#') return line;
				var url = resolveUrl(playlistUrl, line);
				var id = '/'+md5(line)+'.ts';
				ts.push({url:url, id:id});
				return id;
			}).join('\n')+'\n';
github aol / moloch / viewer / viewer.js View on Github external
if (suser._source.emailSearch === undefined) {suser._source.emailSearch = false;}
      if (suser._source.removeEnabled === undefined) {suser._source.removeEnabled = false;}
      if (Config.get("multiES", false)) {suser._source.createEnabled = false;}

      return done(null, suser._source, {ha1: Config.store2ha1(suser._source.passStore)});
    });
  },
  function (options, done) {
      //TODO:  Should check nonce here
      return done(null, true);
  }
));

// Node 0.12 won't need this
var foreverAgent    = new ForeverAgent({minSockets: 21, maxSockets: 20});
var foreverAgentSSL = new ForeverAgent.SSL({minSockets: 21, maxSockets: 20});


app.configure(function() {
  app.enable("jsonp callback");
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.locals.molochversion =  molochversion.version;
  app.locals.isIndex = false;
  app.locals.basePath = Config.basePath();
  app.locals.elasticBase = "http://" + (escInfo[0] === "localhost"?os.hostname():escInfo[0]) + ":" + escInfo[1];
  app.locals.fieldsMap = JSON.stringify(Config.getFieldsMap());
  app.locals.fieldsArr = Config.getFields().sort(function(a,b) {return (a.exp > b.exp?1:-1);});
  app.locals.allowUploads = Config.get("uploadCommand") !== undefined;
  app.locals.sendSession = Config.getObj("sendSession");

  app.use(express.favicon(__dirname + '/public/favicon.ico'));
github mafintosh / node-modules / getJSON.js View on Github external
var request = require('request');
var ForeverAgent = require('forever-agent');
var param = require('param');
var level = require('./level');

var GITHUB_USER = {client_id:param('github.client'), client_secret:param('github.secret')};
var GITHUB_URL = /^https:\/\/api.github.com/;
var HTTP_URL = /^http:/;
var AGENT_SSL = new ForeverAgent.SSL();

var githubRequest = request.defaults({
	qs: GITHUB_USER,
	agent: AGENT_SSL,
	timeout: 30000
});

var httpRequest = request.defaults({
	agent: new ForeverAgent()
});

var matchRequest = function(url) {
	if (GITHUB_URL.test(url)) return githubRequest;
	if (HTTP_URL.test(url)) return httpRequest;
	return request;
};

forever-agent

HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.

Apache-2.0
Latest version published 9 years ago

Package Health Score

74 / 100
Full package analysis

Similar packages