MCPcopy Index your code
hub / github.com/nodejs/node / Server

Function Server

lib/_http_server.js:629–667  ·  view source on GitHub ↗
(options, requestListener)

Source from the content-addressed store, hash-verified

627}
628
629function Server(options, requestListener) {
630 if (!(this instanceof Server)) return new Server(options, requestListener);
631
632 if (typeof options === 'function') {
633 requestListener = options;
634 options = kEmptyObject;
635 } else if (options == null) {
636 options = kEmptyObject;
637 } else {
638 validateObject(options, 'options');
639 }
640
641 storeHTTPOptions.call(this, options);
642
643 net.Server.call(
644 this,
645 { allowHalfOpen: true, noDelay: options.noDelay ?? true,
646 keepAlive: options.keepAlive,
647 keepAliveInitialDelay: options.keepAliveInitialDelay,
648 highWaterMark: options.highWaterMark });
649
650 if (requestListener) {
651 this.on('request', requestListener);
652 }
653
654 // Similar option to this. Too lazy to write my own docs.
655 // http://www.squid-cache.org/Doc/config/half_closed_clients/
656 // https://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
657 this.httpAllowHalfOpen = false;
658
659 this.on('connection', connectionListener);
660 this.on('listening', setupConnectionsTracking);
661
662 this.timeout = 0;
663 this.maxHeadersCount = null;
664 this.maxRequestsPerSocket = 0;
665
666 this[kUniqueHeaders] = parseUniqueHeadersOption(options.uniqueHeaders);
667}
668ObjectSetPrototypeOf(Server.prototype, net.Server.prototype);
669ObjectSetPrototypeOf(Server, net.Server);
670

Callers

nothing calls this directly

Calls 3

parseUniqueHeadersOptionFunction · 0.85
callMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…