(options, requestListener)
| 627 | } |
| 628 | |
| 629 | function 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 | } |
| 668 | ObjectSetPrototypeOf(Server.prototype, net.Server.prototype); |
| 669 | ObjectSetPrototypeOf(Server, net.Server); |
| 670 |
nothing calls this directly
no test coverage detected
searching dependent graphs…