Creates a new instance of HttpManager with the provided `options`.

The HttpManager provides a client connection to the HTTP-based, Tracker
discovery system.

For more information, see the README.

@param {Object} options
428384
function HttpManager(options) {
  if (!(this instanceof HttpManager)) {
    return new HttpManager(options);
  }

  options = options || {};

  Manager.call(this, options);

  debug('New HttpManager: %j', options);

  this.hostname = options.hostname || null;
  this.port = options.port || Defaults.PORT;

  this.interval = options.interval || Defaults.INTERVAL;

  this._announceTimerId = null;

  this._startAnnouncements();
}
695687
function HTTPServer(options) {
  if (!(this instanceof HTTPServer))
    return new HTTPServer(options);

  options = new HTTPOptions(options);

  HTTPBase.call(this, options);

  this.options = options;
  this.network = this.options.network;
  this.logger = this.options.logger.context('http');
  this.node = this.options.node;

  this.chain = this.node.chain;
  this.mempool = this.node.mempool;
  this.pool = this.node.pool;
  this.fees = this.node.fees;
  this.miner = this.node.miner;
  this.rpc = this.node.rpc;

  this.init();
}
1295839
function (options, callback) {
    var self = this,
        requestOptions = {
          path: _urlPrefix
    };

    if (typeof options === 'function') {
      callback = options;
      options = {};
    }

    self._request(requestOptions, function (err, body) {
      if (err) {
        return callback(err);
      }

      else if (!body || !body.loadBalancers) {
        return callback(new Error('Unexpected empty response'));
      }

      else {
        return callback(null, body.loadBalancers.map(function (loadBalancer) {
          return new lb.LoadBalancer(self, loadBalancer);
        }));
      }
    });
  }
942000
function createDefaultLogger(options) {
	const ConsoleLogger = require('./console'),
		consoleLogger = new ConsoleLogger(options),
		config = _.mergeWith({
			name: 'logger',
			streams: [
				{
					level: options && options.level || 'trace',
					type: 'raw',
					stream: consoleLogger
				}
			]
		}, options, function (a, b) {
			return _.isArray(a) ? a.concat(b) : undefined;
		});

	consoleLogger.level = bunyan.resolveLevel(options && options.level || 'trace');

	// default is to add the problem logger
	if (!options || options.problemLogger || options.problemLogger === undefined) {
		const ProblemLogger = require('./problem');
		config.streams.push({
			level: 'trace',
			type: 'raw',
			stream: new ProblemLogger(options)
		});
	}

	const defaultLogger = bunyan.createLogger(config);
	/**
	 * Set log level
	 * Backward compatible with Arrow Cloud MVC framework
	 * @param {Object} nameOrNum log level in string or number
	 * @return {String}
	 */
	defaultLogger.setLevel = function (nameOrNum) {
		var level = 'trace';
		try {
			level = bunyan.resolveLevel(nameOrNum);
		} catch (e) {} // eslint-disable-line no-empty
		consoleLogger.level = level;
		return this.level(level);
	};
	return defaultLogger;
}
647667
function (options) {

            if (typeof options === 'object') {

                // Add implementation-specific method prefix (dashboard or app)
                options.name = this.prefix + '.' + options.name;
                return this.transport.send(options);
            }  else {
                throw new Error('Transport options must be an object.');
            }
        }
1327035
function SessionManagerFactory(options) {

	  log.debug('[chimp][session-manager-factory] options are', options);

	  if (!options) {
		  throw new Error('options is required');
	}

	  if (!options.port) {
		  throw new Error('options.port is required');
	}

	  if (!options.browser && !options.deviceName) {
		  throw new Error('[chimp][session-manager-factory] options.browser or options.deviceName is required');
	}

	  if (options.host && (options.host.indexOf('browserstack') > -1 || options.host.indexOf('saucelabs') > -1 || options.host.indexOf('testingbot') > -1)) {

		  if (!options.user || !options.key) {
			  throw new Error('[chimp][session-manager-factory] options.user and options.key are required');
		}

		  if (options.host.indexOf('browserstack') > -1) {
			  return new BsManager(options);
		} else if (options.host.indexOf('saucelabs') > -1) {
			  return new SlManager(options);
		} else if (options.host.indexOf('testingbot') > -1) {
			  return new TbManager(options);
		}

	} else {
		  return new SessionManager(options);
	}

}
548401
private HttpClientConnectionManager createHttpClientConnectionManager() {
        ConnectionSocketFactory socketFactory = PlainConnectionSocketFactory.getSocketFactory();
        LayeredConnectionSocketFactory sslSocketFactory;
        try {
            sslSocketFactory = new SSLConnectionSocketFactory(SSLContext.getDefault(),
                    SSLConnectionSocketFactory.STRICT_HOSTNAME_VERIFIER);
        } catch (NoSuchAlgorithmException e) {
            throw new BceClientException("Fail to create SSLConnectionSocketFactory", e);
        }
        Registry<ConnectionSocketFactory> registry =
                RegistryBuilder.<ConnectionSocketFactory>create().register(Protocol.HTTP.toString(), socketFactory)
                        .register(Protocol.HTTPS.toString(), sslSocketFactory).build();
        PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
        connectionManager.setDefaultMaxPerRoute(this.config.getMaxConnections());
        connectionManager
                .setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(this.config.getSocketTimeoutInMillis())
                        .setTcpNoDelay(true).build());
        connectionManager.setMaxTotal(this.config.getMaxConnections());
        return connectionManager;
    }
821958
function(server, model, options, logger) {
      // This line must come first
      validationHelper.validateModel(model, logger)
      const Log = logger.bind(chalk.yellow('Create'))

      let collectionName = model.collectionDisplayName || model.modelName
      if (config.logRoutes) {
        Log.note('Generating Create endpoint for ' + collectionName)
      }

      options = options || {}

      let resourceAliasForRoute

      if (model.routeOptions) {
        resourceAliasForRoute = model.routeOptions.alias || model.modelName
      } else {
        resourceAliasForRoute = model.modelName
      }

      let handler = HandlerHelper.generateCreateHandler(model, options, Log)

      let createModel = joiMongooseHelper.generateJoiCreateModel(model, Log)

      if (!config.enablePayloadValidation) {
        let label = createModel._flags.label
        createModel = Joi.alternatives()
          .try(createModel, Joi.any())
          .label(label)
      }

      // EXPL: support bulk creates
      createModel = Joi.alternatives().try(
        Joi.array().items(createModel),
        createModel
      )

      let readModel = joiMongooseHelper.generateJoiReadModel(model, Log)
      let label = readModel._flags.label

      readModel = Joi.alternatives()
        .try(Joi.array().items(readModel), readModel)
        .label(label)

      if (!config.enableResponseValidation) {
        readModel = Joi.alternatives()
          .try(readModel, Joi.any())
          .label(label)
      }

      let auth = false
      let createHeadersValidation = Object.assign(headersValidation, {})

      if (config.authStrategy && model.routeOptions.createAuth !== false) {
        auth = {
          strategy: config.authStrategy
        }

        let scope = authHelper.generateScopeForEndpoint(model, 'create', Log)

        if (!_.isEmpty(scope)) {
          auth.scope = scope
          if (config.logScopes) {
            Log.debug('Scope for POST/' + resourceAliasForRoute + ':', scope)
          }
        }
      } else {
        createHeadersValidation = null
      }

      let policies = []

      if (model.routeOptions.policies && config.enablePolicies) {
        policies = model.routeOptions.policies
        policies = (policies.rootPolicies || []).concat(
          policies.createPolicies || []
        )
      }

      if (config.enableDocumentScopes && auth) {
        let authorizeDocumentCreator =
          model.routeOptions.authorizeDocumentCreator === undefined
            ? config.authorizeDocumentCreator
            : model.routeOptions.authorizeDocumentCreator
        let authorizeDocumentCreatorToRead =
          model.routeOptions.authorizeDocumentCreatorToRead === undefined
            ? config.authorizeDocumentCreatorToRead
            : model.routeOptions.authorizeDocumentCreatorToRead
        let authorizeDocumentCreatorToUpdate =
          model.routeOptions.authorizeDocumentCreatorToUpdate === undefined
            ? config.authorizeDocumentCreatorToUpdate
            : model.routeOptions.authorizeDocumentCreatorToUpdate
        let authorizeDocumentCreatorToDelete =
          model.routeOptions.authorizeDocumentCreatorToDelete === undefined
            ? config.authorizeDocumentCreatorToDelete
            : model.routeOptions.authorizeDocumentCreatorToDelete
        let authorizeDocumentCreatorToAssociate =
          model.routeOptions.authorizeDocumentCreatorToAssociate === undefined
            ? config.authorizeDocumentCreatorToAssociate
            : model.routeOptions.authorizeDocumentCreatorToAssociate

        if (authorizeDocumentCreator) {
          policies.push(restHapiPolicies.authorizeDocumentCreator(model, Log))
        }
        if (authorizeDocumentCreatorToRead) {
          policies.push(
            restHapiPolicies.authorizeDocumentCreatorToRead(model, Log)
          )
        }
        if (authorizeDocumentCreatorToUpdate) {
          policies.push(
            restHapiPolicies.authorizeDocumentCreatorToUpdate(model, Log)
          )
        }
        if (authorizeDocumentCreatorToDelete) {
          policies.push(
            restHapiPolicies.authorizeDocumentCreatorToDelete(model, Log)
          )
        }
        if (authorizeDocumentCreatorToAssociate) {
          policies.push(
            restHapiPolicies.authorizeDocumentCreatorToAssociate(model, Log)
          )
        }

        if (model.routeOptions.documentScope) {
          policies.push(restHapiPolicies.addDocumentScope(model, Log))
        }
      }

      if (config.enableCreatedBy) {
        policies.push(restHapiPolicies.addCreatedBy(model, Log))
      }

      if (config.enableDuplicateFields) {
        policies.push(
          restHapiPolicies.populateDuplicateFields(model, mongoose, Log)
        )
      }

      if (config.enableAuditLog) {
        policies.push(restHapiPolicies.logCreate(mongoose, model, Log))
      }

      server.route({
        method: 'POST',
        path: '/' + resourceAliasForRoute,
        config: {
          handler: handler,
          auth: auth,
          cors: config.cors,
          description: 'Create one or more new ' + collectionName + 's',
          tags: ['api', collectionName],
          validate: {
            payload: createModel,
            headers: createHeadersValidation
          },
          plugins: {
            model: model,
            'hapi-swagger': {
              responseMessages: [
                {
                  code: 201,
                  message: 'The resource was created successfully.'
                },
                { code: 400, message: 'The request was malformed.' },
                {
                  code: 401,
                  message:
                    'The authentication header was missing/malformed, or the token has expired.'
                },
                { code: 500, message: 'There was an unknown error.' },
                {
                  code: 503,
                  message: 'There was a problem with the database.'
                }
              ]
            },
            policies: policies
          },
          response: {
            failAction: config.enableResponseFail ? 'error' : 'log',
            schema: readModel
          }
        }
      })
    }
1327572
function(options, zookeeperOptions) {
    EventEmitter.call(this);

    this.modules = {};
    this.middlewares = [];

    this.options = options || {};
    this.zookeeperOptions = zookeeperOptions || {};

    this.zookeeper = undefined;
    if(this.zookeeperOptions && Object.keys(this.zookeeperOptions).length) {
        this.zookeeper = new Zookeeper(
            this.zookeeperOptions.connectString,
            this.zookeeperOptions,
            this.zookeeperOptions.root,
            this.zookeeperOptions.prefix);
    }

    this.server = helper.createServer(options, this._onClientConnected.bind(this));
}
909985
function Logger(options)
{
  var common;
  var winstonLogger;

  /**
   * Logs a message at a given level.
   *
   * @param {String} levelTag the tag associated with the level at which to log
   *   the message.
   * @param {String} message the message to log.
   * @param {Number} bufferMaxLength the maximum size to which the message
   *   buffer can grow.
   */
  var logMessage = function(levelTag, message, bufferMaxLength)
  {
    // initialize the winston logger if needed
    if (!winstonLogger)
    {
      winstonLogger = new winston.createLogger(
      {
        transports:
        [
          new (winston.transports.Console)(),
          new (winston.transports.File)({ filename: 'snowflake.log' })
        ],
        level: common.getLevelTag(),
        levels: common.getLevelTagsMap()
      });
    }

    // get the appropriate logging method using the level tag and use this
    // method to log the message
    winstonLogger[levelTag](message);
  };

  // create an inner implementation to which all our methods will be forwarded
  common = Core.createLogger(options, logMessage);

  /**
   * Configures this logger.
   *
   * @param {Object} options
   */
  this.configure = function(options)
  {
    common.configure(options);
  };

  /**
   * Returns the current log level.
   *
   * @returns {Number}
   */
  this.getLevel = function()
  {
    return common.getLevelNumber();
  };

  /**
   * Logs a given message at the error level.
   *
   * @param {String} message
   */
  this.error = function(message)
  {
    common.error.apply(common, arguments);
  };

  /**
   * Logs a given message at the warning level.
   *
   * @param {String} message
   */
  this.warn = function(message)
  {
    common.warn.apply(common, arguments);
  };

  /**
   * Logs a given message at the info level.
   *
   * @param {String} message
   */
  this.info = function(message)
  {
    common.info.apply(common, arguments);
  };

  /**
   * Logs a given message at the debug level.
   *
   * @param {String} message
   */
  this.debug = function(message)
  {
    common.debug.apply(common, arguments);
  };

  /**
   * Logs a given message at the trace level.
   *
   * @param {String} message
   */
  this.trace = function(message)
  {
    common.trace.apply(common, arguments);
  };

  /**
   * Returns the log buffer.
   *
   * @returns {String[]}
   */
  this.getLogBuffer = function()
  {
    return common.getLogBuffer();
  };
}
702137
function RequestOptions(options) {
  if (!(this instanceof RequestOptions))
    return new RequestOptions(options);

  this.uri = 'http://localhost:80/';
  this.host = 'localhost';
  this.path = '/';
  this.port = 80;
  this.ssl = false;
  this.method = 'GET';
  this.strictSSL = true;
  this.pool = false;
  this.agent = USER_AGENT;

  this.type = null;
  this.expect = null;
  this.query = null;
  this.body = null;
  this.auth = null;
  this.limit = 10 << 20;
  this.maxRedirects = 5;
  this.timeout = 5000;
  this.buffer = false;
  this.headers = null;

  // Hack
  ensureRequires();

  if (options)
    this.fromOptions(options);
}
1208684
function createHttpsServer(options, requestHandler, keys) {
  net
    .createServer(function(socket){
      socket.once('data', function(buffer){
        // Pause the socket
        socket.pause();

        // Determine if this is an HTTP(s) request
        var byte = buffer[0];
        var proxy;

        if (byte === 22)
          proxy = server.https;
        else if (32 < byte && byte < 127)
          proxy = server.http;

        if (proxy)
        {
          // Push the buffer back onto the front of the data stream
          socket.unshift(buffer);

          // Emit the socket to the HTTP(s) server
          proxy.emit('connection', socket);
        }

        // Resume the socket data stream
        socket.resume();
      });
    })
    .on('error', function(error){
      onError(error, options);
    })
    .listen(options.port, function(){
      onListen(this, options);
    });

  var server = {
    http: http.createServer(requestHandler),
    https: https.createServer(keys, requestHandler)
  };

  return server;
}
688061
function Options(options) {
  if (!(this instanceof Options)) {
    return new Options(options);
  }
  this.defaults = this.defaults || {};
  this.options = this.options || {};
  if (options) {
    this.option(options);
  }
}
1082233
function urlmon(options) {
    
    this.url = options.url;
    this.interval = options.interval || 5000;
    this.timeout = options.timeout || 3000;
    this.handle = null;
        
}
634898
function createOptions( options ) {
	var object = optionsCache[ options ] = {};
	jQuery.each( options.split( core_rspace ), function( _, flag ) {
		object[ flag ] = true;
	});
	return object;
}
18513
function HTTPBaseOptions(options) {
  if (!(this instanceof HTTPBaseOptions))
    return new HTTPBaseOptions(options);

  this.host = '127.0.0.1';
  this.port = 8080;
  this.sockets = true;

  this.ssl = false;
  this.keyFile = null;
  this.certFile = null;
  this.key = null;
  this.cert = null;
  this.ca = null;

  if (options)
    this.fromOptions(options);
}
73826
function createUrlFromEndpointAndOptions (endpoint, options) {
  const query = qs.stringify(options);
  const baseURL = `${host}${endpoint}`;
  return query ? `${baseURL}?${query}` : baseURL;
}