@@ -41,7 +41,8 @@ var CIPHERS = [
4141 * Creates and listens on both HTTP and HTTPS servers.
4242 */
4343module . exports = function createServers ( options , listening ) {
44- if ( ! options || ( ! options . http && ! options . https )
44+ if ( ! options
45+ || ( typeof options . http === 'undefined' && typeof options . https === 'undefined' )
4546 || ( ! options . handler && ! options . http . handler && ! options . https . handler ) ) {
4647 return listening ( new Error ( 'handler, http and/or https are required options.' ) ) ;
4748 }
@@ -87,22 +88,19 @@ module.exports = function createServers(options, listening) {
8788 // Attempts to create and listen on the the HTTP server.
8889 //
8990 function createHttp ( ) {
90- if ( ! options . http ) {
91+ if ( typeof options . http === 'undefined' ) {
9192 log ( 'http | no options.http; no server' ) ;
9293 return onListen ( 'http' ) ;
9394 }
9495
9596 if ( typeof options . http !== 'object' ) {
9697 options . http = {
97- // accept both a string and a number
98- port : ! isNaN ( options . http )
99- ? + options . http
100- : false
98+ port : options . http
10199 } ;
102100 }
103101
104102 var server = http . createServer ( options . http . handler || handler ) ,
105- port = options . http . port || 80 ,
103+ port = ! isNaN ( options . http . port ) ? + options . http . port : 80 , // accepts string or number
106104 args ;
107105
108106 args = [ server , port ] ;
@@ -120,13 +118,13 @@ module.exports = function createServers(options, listening) {
120118 // Attempts to create and listen on the HTTPS server.
121119 //
122120 function createHttps ( next ) {
123- if ( ! options . https ) {
121+ if ( typeof options . https === 'undefined' ) {
124122 log ( 'https | no options.https; no server' ) ;
125123 return onListen ( 'https' ) ;
126124 }
127125
128126 var ssl = options . https ,
129- port = + ssl . port || 443 ,
127+ port = ! isNaN ( ssl . port ) ? + ssl . port : 443 , // accepts string or number
130128 ciphers = ssl . ciphers || CIPHERS ,
131129 ca = ssl . ca ,
132130 server ,
0 commit comments