| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 85fe05e commit 5421d6e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -948,7 +948,7 @@ publicly trusted list of CAs as given in | |||
| 948 | 948 | <http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt>. | |
| 949 | 949 | ||
| 950 | 950 | ||
| 951 | - ## tls.createServer(options[, secureConnectionListener]) | ||
| 951 | + ## tls.createServer([options][, secureConnectionListener]) | ||
| 952 | 952 | <!-- YAML | |
| 953 | 953 | added: v0.3.2 | |
| 954 | 954 | --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -745,18 +745,19 @@ TLSSocket.prototype.getProtocol = function() { | |||
| 745 | 745 | // "PATH_LENGTH_EXCEEDED", "INVALID_PURPOSE" "CERT_UNTRUSTED", | |
| 746 | 746 | // "CERT_REJECTED" | |
| 747 | 747 | // | |
| 748 | - function Server(/* [options], listener */) { | ||
| 749 | - var options, listener; | ||
| 748 | + function Server(options, listener) { | ||
| 749 | + if (!(this instanceof Server)) | ||
| 750 | + return new Server(options, listener); | ||
| 750 | 751 | ||
| 751 | - if (arguments[0] !== null && typeof arguments[0] === 'object') { | ||
| 752 | - options = arguments[0]; | ||
| 753 | - listener = arguments[1]; | ||
| 754 | - } else if (typeof arguments[0] === 'function') { | ||
| 752 | + if (typeof options === 'function') { | ||
| 753 | + listener = options; | ||
| 755 | 754 | options = {}; | |
| 756 | - listener = arguments[0]; | ||
| 755 | + } else if (options == null || typeof options === 'object') { | ||
| 756 | + options = options || {}; | ||
| 757 | + } else { | ||
| 758 | + throw new TypeError('options must be an object'); | ||
| 757 | 759 | } | |
| 758 | 760 | ||
| 759 | - if (!(this instanceof Server)) return new Server(options, listener); | ||
| 760 | 761 | ||
| 761 | 762 | this._contexts = []; | |
| 762 | 763 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | + var assert = require('assert'); | ||
| 2 | 3 | var common = require('../common'); | |
| 3 | 4 | ||
| 4 | 5 | if (!common.hasCrypto) { | |
@@ -10,6 +11,20 @@ var tls = require('tls'); | |||
| 10 | 11 | // Omitting the cert or pfx option to tls.createServer() should not throw. | |
| 11 | 12 | // AECDH-NULL-SHA is a no-authentication/no-encryption cipher and hence | |
| 12 | 13 | // doesn't need a certificate. | |
| 13 | - tls.createServer({ ciphers: 'AECDH-NULL-SHA' }).listen(0, function() { | ||
| 14 | + tls.createServer({ ciphers: 'AECDH-NULL-SHA' }) | ||
| 15 | + .listen(0, common.mustCall(close)); | ||
| 16 | + | ||
| 17 | + tls.createServer(assert.fail) | ||
| 18 | + .listen(0, common.mustCall(close)); | ||
| 19 | + | ||
| 20 | + tls.createServer({}) | ||
| 21 | + .listen(0, common.mustCall(close)); | ||
| 22 | + | ||
| 23 | + assert.throws(() => tls.createServer('this is not valid'), TypeError); | ||
| 24 | + | ||
| 25 | + tls.createServer() | ||
| 26 | + .listen(0, common.mustCall(close)); | ||
| 27 | + | ||
| 28 | + function close() { | ||
| 14 | 29 | this.close(); | |
| 15 | - }); | ||
| 30 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments