Each camp instance creates an HTTP / HTTPS server automatically.
491262
function start (settings) {

  settings = settings || {};

  // Populate security values with the corresponding files.
  if (settings.secure) {
    settings.passphrase = settings.passphrase || '1234';
    settings.key = settings.key || 'https.key';
    settings.cert = settings.cert || 'https.crt';
    settings.ca = settings.ca || [];
  }

  settings.port = settings.port || (settings.secure ? 443 : 80);

  return startServer(settings);
}
939359
def _make_session():
        

        sess = requests.Session()
        sess.mount('http://', requests.adapters.HTTPAdapter(max_retries=False))
        sess.mount('https://', requests.adapters.HTTPAdapter(max_retries=False))

        return sess
353433
function HttpServer(options) {
  options = options || {};

  if (options.root) {
    this.root = options.root;
  }
  else {
    try {
      fs.lstatSync('./public');
      this.root = './public';
    }
    catch (err) {
      this.root = './';
    }
  }

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

  this.cache = (
    options.cache === undefined ? 3600 :
    // -1 is a special case to turn off caching.
    // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Preventing_caching
    options.cache === -1 ? 'no-cache, no-store, must-revalidate' :
    options.cache // in seconds.
  );
  this.showDir = options.showDir !== 'false';
  this.autoIndex = options.autoIndex !== 'false';
  this.showDotfiles = options.showDotfiles;
  this.gzip = options.gzip === true;
  this.brotli = options.brotli === true;
  this.contentType = options.contentType || 'application/octet-stream';

  if (options.ext) {
    this.ext = options.ext === true
      ? 'html'
      : options.ext;
  }

  var before = options.before ? options.before.slice() : [];

  before.push(function (req, res) {
    if (options.logFn) {
      options.logFn(req, res);
    }

    res.emit('next');
  });

  if (options.username || options.password) {
    before.push(function (req, res) {
      var credentials = auth(req);

      // We perform these outside the if to avoid short-circuiting and giving
      // an attacker knowledge of whether the username is correct via a timing
      // attack.
      if (credentials) {
        var usernameEqual = secureCompare(options.username, credentials.name);
        var passwordEqual = secureCompare(options.password, credentials.pass);
        if (usernameEqual && passwordEqual) {
          return res.emit('next');
        }
      }

      res.statusCode = 401;
      res.setHeader('WWW-Authenticate', 'Basic realm=""');
      res.end('Access denied');
    });
  }

  if (options.cors) {
    this.headers['Access-Control-Allow-Origin'] = '*';
    this.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Range';
    if (options.corsHeaders) {
      options.corsHeaders.split(/\s*,\s*/)
          .forEach(function (h) { this.headers['Access-Control-Allow-Headers'] += ', ' + h; }, this);
    }
    before.push(corser.create(options.corsHeaders ? {
      requestHeaders: this.headers['Access-Control-Allow-Headers'].split(/\s*,\s*/)
    } : null));
  }

  if (options.robots) {
    before.push(function (req, res) {
      if (req.url === '/robots.txt') {
        res.setHeader('Content-Type', 'text/plain');
        var robots = options.robots === true
          ? 'User-agent: *\nDisallow: /'
          : options.robots.replace(/\\n/, '\n');

        return res.end(robots);
      }

      res.emit('next');
    });
  }

  before.push(ecstatic({
    root: this.root,
    cache: this.cache,
    showDir: this.showDir,
    showDotfiles: this.showDotfiles,
    autoIndex: this.autoIndex,
    defaultExt: this.ext,
    gzip: this.gzip,
    brotli: this.brotli,
    contentType: this.contentType,
    handleError: typeof options.proxy !== 'string'
  }));

  if (typeof options.proxy === 'string') {
    var proxy = httpProxy.createProxyServer({});
    before.push(function (req, res) {
      proxy.web(req, res, {
        target: options.proxy,
        changeOrigin: true
      }, function (err, req, res, target) {
        if (options.logFn) {
          options.logFn(req, res, {
            message: err.message,
            status: res.statusCode });
        }
        res.emit('next');
      });
    });
  }

  var serverOptions = {
    before: before,
    headers: this.headers,
    onError: function (err, req, res) {
      if (options.logFn) {
        options.logFn(req, res, err);
      }

      res.end();
    }
  };

  if (options.https) {
    serverOptions.https = options.https;
  }

  this.server = union.createServer(serverOptions);
}
386098
function createSession (callback) {
      var path, sessionCreate;

      _log(me.setting);
      path = me.setting.apiroot + '/session/create.json?apiKey=' + me.setting.apikey;
      _log(path);

      sessionCreate = http.request({
        port: me.setting.port,
        host: me.setting.host,
        method: 'POST',
        path: path
      });

      sessionCreate.on('response', function (response) {
        var data = '';

        _log('STATUS: ' + response.statusCode);
        _log('HEADERS: ' + JSON.stringify(response.headers));

        if (200 !== response.statusCode) {
          callback(response.statusCode);
          return;
        }

        response.on('data', function (chunk) {
          data += chunk;
        });

        response.on('end', function() {
          var sessionInfo = JSON.parse(data);
          _log('SID OK: ' + sessionInfo.sid);

          callback(response.statusCode, sessionInfo);
        });
      });

      sessionCreate.on('error', function(err) {
        console.error(err);
      });

      sessionCreate.end();
    }
1178973
def make_server(host, port, app=None, threaded=False, processes=1,
                request_handler=None, passthrough_errors=False,
                ssl_context=None):
    
    if threaded and processes > 1:
        raise ValueError("cannot have a multithreaded and "
                         "multi process server.")
    elif threaded:
        return ThreadedWSGIServer(host, port, app, request_handler,
                                  passthrough_errors, ssl_context)
    elif processes > 1:
        return ForkingWSGIServer(host, port, app, processes, request_handler,
                                 passthrough_errors, ssl_context)
    else:
        return BaseWSGIServer(host, port, app, request_handler,
                              passthrough_errors, ssl_context)
1194115
async def create_http_connection(loop, protocol_factory, host, port=25105,
                                 auth=None):
    """"""
    protocol = protocol_factory()
    transport = HttpTransport(loop, protocol, host, port, auth)
    _LOGGER.debug("create_http_connection Finished creating connection")
    return (transport, protocol)
1053480
public static void trustAllHosts () {
        // Create a trust manager that does not validate certificate chains
        TrustManager[] trustAllCerts = new TrustManager[]{
                new X509TrustManager () {
                    public X509Certificate[] getAcceptedIssuers () { return new X509Certificate[]{}; }

                    public void checkClientTrusted (X509Certificate[] chain, String authType) throws CertificateException {}

                    public void checkServerTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
                }
        };

        // Install the all-trusting trust manager
        try {
            SSLContext sslContext = SSLContext.getInstance ("TLS");
            sslContext.init (null, trustAllCerts, new java.security.SecureRandom ());
            HttpsURLConnection.setDefaultSSLSocketFactory (sslContext.getSocketFactory ());
            HttpsURLConnection.setDefaultHostnameVerifier ((String var1, SSLSession var2) -> {
                return true;
            });
        } catch (Exception exception) {
            log.error (exception);
        }
    }
1308911
function(httpServer) {
      this.stop();

      var port = isNaN(options.port) ? 3000 : +options.port;
      _httpServer = httpServer || http.createServer(function(req, res) {
        res.setHeader('Access-Control-Allow-Origin', '*');
        res.setHeader('Access-Control-Request-Method', '*');
        res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
        res.setHeader('Access-Control-Allow-Headers', '*');
        if ( req.method === 'OPTIONS' ) {
          res.writeHead(200);
          res.end();
          return;
        }
      });
      _httpServer.on('request', _handle);
      _httpServer.listen(port, function() {
        debug.log('Listening on '+port);
      });

      return _server;
    }
879063
function knStartServer(args, callback)
{
	var host, port, server;

	if (!mod_restify)
		mod_restify = require('restify');

	mod_assert.ok('uri_base' in args);
	mod_assert.equal('string', typeof (args['uri_base']));

	port = 'port' in args ? args['port'] : 80;
	host = 'host' in args ? args['host'] : '::';
	server = mod_restify.createServer({ serverName: 'Kang' });
	server.get(new RegExp(args['uri_base'] + '/.*'),
	    knRestifyHandler(args));
	server.listen(port, host, function () { callback(null, server); });
}
1000997
def http_construct(args, unknown):
    

    str_http    = ''
    b_httpSpecd = False

    if '--http' in unknown:
        try:
            str_httpArg = unknown[unknown.index('--http')+1]
            unknown.remove('--http')
            unknown.remove(str_httpArg)
        except:
            str_httpArg = ""
        str_http    = '--http %s' % str_httpArg
        b_httpSpecd = True

    if not b_httpSpecd:
        str_serverIP  = "172.17.0.2"
        str_serverPort  = '5010'
        try:
            if args.b_pman:
                str_serverIP    = os.environ['PMAN_PORT_5010_TCP_ADDR']
                str_serverPort  = os.environ['PMAN_PORT_5010_TCP_PORT']
            if args.b_pfioh:
                str_serverIP    = os.environ['PFIOH_PORT_5055_TCP_ADDR']
                str_serverPort  = os.environ['PFIOH_PORT_5055_TCP_PORT']
        except:
            pass
        str_http    = '--http %s:%s/api/v1/cmd/' % (str_serverIP, str_serverPort)

    return str_http
1021112
def build_rest_url(args)
      @server_host = args[:server]
      @port = args[:port].to_i

      if args[:server_path]
        # remove leading & trailing slashes in serverpath if any
        @server_path = args[:server_path].sub %r{^/*(.*?)/*$}, Regexp.last_match(1)
        # re-add single trailing slash
        @server_path << '/'
      end

      # we're using ssl if:
      #  1) args[:use_ssl] is anything but false
      # or
      #  2) the port is a known ssl port.
      args[:use_ssl] = args[:use_ssl] != false || SSL_PORTS.include?(@port)

      @protocol = 'http'
      @protocol << 's' if args[:use_ssl]
      # and here's the URL
      "#{@protocol}://#{@server_host}:#{@port}/#{@server_path}#{RSRC_BASE}"
    end
151931
def runserver(hostname, port, no_reloader, debugger, no_evalex, threaded, processes):
    """"""
    app = make_app()
    reloader = not no_reloader
    evalex = not no_evalex
    run_simple(
        hostname,
        port,
        app,
        use_reloader=reloader,
        use_debugger=debugger,
        use_evalex=evalex,
        threaded=threaded,
        processes=processes,
    )
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;
}
589821
function HyperServer($){

    //setup
    $ = Object.assign( defaults, $ ); 

    //injection
    let gx   = $.generator;
    let hx   = $.handler;

    //prototype
    let $ns, $n = proto();
    let dev  = ( 'development' == $n.get('env') || process.env.NODE_ENV  == 'development' );
    let port = (( dev ? $.LOCAL_PORT : $.APP_PORT ) || process.env.NODE_PORT );
 
    //config mapping
    $n.set( 'port', port );
    $n.set( 'view engine', $.VIEW_ENGINE );

    //middleware in out next
    if( dev ) $n.use( errorHandler({ dumpExceptions: true, showStack: true }) );
    $n.use( bodyParser.json() );
    $n.use( bodyParser.urlencoded({ extended:true }) );
    $n.use( override() );
    $n.use( cookieParser() );
    $n.use( sss({secret: 'secret', key:$.SESSION_ID, resave:true, saveUninitialized:true }));
    $n.use( ( i, o, n ) => { o.set('X-Powered-By', $.SERVER_ID ); n(); });
    $n.use( ( i, o, n ) => { i.baseUrl = i.originalUrl.split("?").shift(); n(); });
    $n.use( ( i, o, n ) => { console.info( `[${i.method} ${i.baseUrl}]`) || n(); }); //| q:${k(i.query)} \t | c:${k(i.cookies)}` ) || n(); });
    $n.use( favicon( $.PUBLIC_WWW + '/favicon.ico') );
    $n.use( proto.static( $.PUBLIC_WWW, {  
        setHeaders: ( res, path, stat ) => res.set('X-Timestamp', Date.now())
    }));

    //route stubs
    $.router.route( $n );

    //boot
    $ns = http.createServer($n)
          .on( 'close', ()=> {
            console.error( $.SERVER_ID + " - Shutting Down..");
          })
          .listen( port, data => {
            console.info( `Env  : [ ${( dev ? "DEV" : "UAT" )} ] \nPort : [ ${port} ]` );
            console.info( `URL  :  http://localhost:${port}` );
          });

    //termsigs
    process.once( 'SIGUSR2', ()=> {
            console.warn( 'Attempting to graceful kill...' );
            process.kill( process.pid, 'SIGUSR2');
          })
          .once( 'EADDRINUSE', ()=> {
            console.warn( 'Required port unavailable' );
            process.exit(1);
          });

    return $n;
  }
2215
public synchronized HttpServer<Buffer, Buffer> start() throws Exception {
		if (server == null) {
			server = createProtocolListener();
		}
		return server;
	}
174674
function createServer () {

    // Create server

    var server = express.createServer();

    // Configure Server

    server.configure(function () {

        // Built-in

        server.use(express.methodOverride());                           // Allow method override using _method form parameter
        server.use(express.bodyDecoder()); 	                            // Parse application/x-www-form-urlencoded
        server.use(express.staticProvider(__dirname + '/files'));       // Serve client documents in local directory

        // Local

        server.use(setResponseHeader());                                // Set default response headers for CORS
        server.use(logConsole());                                       // Display incoming requests

        // Authentication

        server.use(auth([auth.Mac({ realm: "Example",                   // Set realm, typically a domain name or application name
                                    getTokenAttributes: getToken,       // Function used to fetch the access token record, typically from a database
                                    // hostHeader: 'x-forwarded-host',  // Needed when running behind a proxy such as Apache2
                                    // isHTTPS: true,                   // Uncomment for HTTPS
                                    checkNonce: nonceCheck,             // Optional nonce checking function
                                    bodyHashMode: "require" })]));      // Require body hash validation for all non GET/HEAD/OPTIONS requests
    });

    // Setup generic OPTIONS route

    server.options(/.+/, function (req, res) {

        res.send(' ');
    });

    return server;
}
315107
protected function createServer(): void
    {
        $server = null;
        $opts   = $this->serverSettings;

        $host = $opts['host'];
        $port = $opts['port'];
        $mode = $opts['mode'] === self::MODE_BASE ? SWOOLE_BASE : SWOOLE_PROCESS;
        $type = \strtolower($opts['type']);

        $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_HTTP];

        // create swoole server
        // 使用SSL必须在编译swoole时加入--enable-openssl选项,并且配置证书文件
        switch ($type) {
            case self::PROTOCOL_TCP:
                $server      = new Server($host, $port, $mode, SWOOLE_SOCK_TCP);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_TCP];
                break;

            case self::PROTOCOL_UDP:
                $server      = new Server($host, $port, $mode, SWOOLE_SOCK_UDP);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_TCP];
                break;

            case self::PROTOCOL_HTTP:
                $server = new HttpServer($host, $port, $mode);
                break;

            case self::PROTOCOL_HTTPS:
                $this->checkEnvWhenEnableSSL();
                $server = new HttpServer($host, $port, $mode, SWOOLE_SOCK_TCP | SWOOLE_SSL);
                break;

            case self::PROTOCOL_RDS:
                $server      = new RedisServer($host, $port, $mode);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_RDS];
                break;

            case self::PROTOCOL_WS:
                $server      = new WebSocketServer($host, $port, $mode);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_WS];
                break;

            case self::PROTOCOL_WSS:
                $this->checkEnvWhenEnableSSL();
                $server      = new WebSocketServer($host, $port, $mode, SWOOLE_SOCK_TCP | SWOOLE_SSL);
                $protoEvents = self::$swooleProtocolEvents[self::PROTOCOL_WS];
                break;

            default:
                $supportedProtocol = implode(',', $this->getSupportedProtocols());
                Show::error("The socket protocol <bold>$type</bold> is not supported. Allow: $supportedProtocol", 1);
                break;
        }

        $this->server = $server;
        $this->server->set($this->swooleSettings);

        $this->log("The main server was created successfully. Listening on <cyan>$type://{$host}:{$port}</cyan>");
        $this->setSwooleEvents($protoEvents);
    }