File tree Expand file tree Collapse file tree 3 files changed +27
-11
lines changed
Expand file tree Collapse file tree 3 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -959,7 +959,7 @@ publicly trusted list of CAs as given in
959959< http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt > .
960960
961961
962- ## tls.createServer(options[ , secureConnectionListener] )
962+ ## tls.createServer([ options] [ , secureConnectionListener ] )
963963<!-- YAML
964964added: v0.3.2
965965-->
Original file line number Diff line number Diff line change @@ -745,18 +745,19 @@ TLSSocket.prototype.getProtocol = function() {
745745// "PATH_LENGTH_EXCEEDED", "INVALID_PURPOSE" "CERT_UNTRUSTED",
746746// "CERT_REJECTED"
747747//
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 ) ;
750751
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 ;
755754 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' ) ;
757759 }
758760
759- if ( ! ( this instanceof Server ) ) return new Server ( options , listener ) ;
760761
761762 this . _contexts = [ ] ;
762763
Original file line number Diff line number Diff line change 11'use strict' ;
2+ var assert = require ( 'assert' ) ;
23var common = require ( '../common' ) ;
34
45if ( ! common . hasCrypto ) {
@@ -10,6 +11,20 @@ var tls = require('tls');
1011// Omitting the cert or pfx option to tls.createServer() should not throw.
1112// AECDH-NULL-SHA is a no-authentication/no-encryption cipher and hence
1213// 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 ( ) {
1429 this . close ( ) ;
15- } ) ;
30+ }
You can’t perform that action at this time.
0 commit comments