mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
https: make opts optional & immutable when create
`opts` in `createServer` will be immutable that won't change origional opts value. What's more, it's optional which can make `requestListener` be the first argument. PR-URL: https://github.com/nodejs/node/pull/13599 Fixes: https://github.com/nodejs/node/issues/13584 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
This commit is contained in:
1 parent
3bb4ec80ae
commit
74741fa52b
3 files changed
+51
-1
No files matched your search
@@ -34,6 +34,12 @@ const { urlToOptions, searchParamsSymbol } = require('internal/url');
|
||||
function Server(opts, requestListener) {
|
||||
if (!(this instanceof Server)) return new Server(opts, requestListener);
|
||||
|
||||
if (typeof opts === 'function') {
|
||||
requestListener = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
opts = util._extend({}, opts);
|
||||
|
||||
if (process.features.tls_npn && !opts.NPNProtocols) {
|
||||
opts.NPNProtocols = ['http/1.1', 'http/1.0'];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user