summaryrefslogtreecommitdiff
path: root/lib/https.js
diff options
context:
space:
mode:
authorXadillaX <admin@xcoder.in>2017-06-10 14:09:35 -0400
committerRefael Ackermann <refack@gmail.com>2017-06-14 15:14:34 -0400
commitc1c226719f269f013f000e8ad9194254e6d83f51 (patch)
treee387688418a02a3363f54ad3a38f9d73b6d50fef /lib/https.js
parent2f34bf0f772c590f49b4b4b11ad81549d0f8b04a (diff)
downloadandroid-node-v8-c1c226719f269f013f000e8ad9194254e6d83f51.tar.gz
android-node-v8-c1c226719f269f013f000e8ad9194254e6d83f51.tar.bz2
android-node-v8-c1c226719f269f013f000e8ad9194254e6d83f51.zip
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>
Diffstat (limited to 'lib/https.js')
-rw-r--r--lib/https.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/https.js b/lib/https.js
index 457327d6bb..fb22087259 100644
--- a/lib/https.js
+++ b/lib/https.js
@@ -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'];
}