@@ -122,54 +122,54 @@ module.exports = function createServers(options, listening) {
122
122
return onListen ( 'https' ) ;
123
123
}
124
124
125
- var port = + options . https . port || 443 ,
126
- ssl = options . https ,
125
+ var ssl = options . https ,
126
+ port = + ssl . port || 443 ,
127
+ ciphers = ssl . ciphers || CIPHERS ,
128
+ ca = ssl . ca ,
129
+ key = fs . readFileSync ( path . resolve ( ssl . root , ssl . key ) ) ,
130
+ cert = fs . readFileSync ( path . resolve ( ssl . root , ssl . cert ) ) ,
131
+ honorCipherOrder = ! ! ssl . honorCipherOrder ,
127
132
server ,
128
- args ,
129
- ip ;
130
-
131
- ssl . ciphers = ssl . ciphers || CIPHERS ;
133
+ args ;
132
134
133
135
//
134
136
// Remark: If an array is passed in lets join it like we do the defaults
135
137
//
136
- if ( Array . isArray ( ssl . ciphers ) ) {
137
- ssl . ciphers = ssl . ciphers . join ( ':' ) ;
138
+ if ( Array . isArray ( ciphers ) ) {
139
+ ciphers = ciphers . join ( ':' ) ;
138
140
}
139
141
140
- if ( ssl . ca && ! Array . isArray ( ssl . ca ) ) {
141
- ssl . ca = [ ssl . ca ] ;
142
+ if ( ca && ! Array . isArray ( ca ) ) {
143
+ ca = [ ca ] ;
142
144
}
143
145
144
- log ( 'https | listening on %d' , port ) ;
145
- server = https . createServer ( {
146
+ var finalHttpsOptions = Object . assign ( { } , ssl , {
146
147
//
147
148
// Load default SSL key, cert and ca(s).
148
149
//
149
- key : fs . readFileSync ( path . resolve ( ssl . root , ssl . key ) ) ,
150
- cert : fs . readFileSync ( path . resolve ( ssl . root , ssl . cert ) ) ,
151
- ca : ssl . ca && ssl . ca . map (
152
- function ( file ) {
153
- return fs . readFileSync ( path . resolve ( ssl . root , file ) ) ;
154
- }
150
+ key : key ,
151
+ cert : cert ,
152
+ ca : ca && ca . map (
153
+ function ( file ) {
154
+ return fs . readFileSync ( path . resolve ( ssl . root , file ) ) ;
155
+ }
155
156
) ,
156
157
//
157
158
// Properly expose ciphers for an A+ SSL rating:
158
159
// https://certsimple.com/blog/a-plus-node-js-ssl
159
160
//
160
- ciphers : ssl . ciphers ,
161
- honorCipherOrder : ! ! ssl . honorCipherOrder ,
162
- //
163
- // Optionally support SNI-based SSL.
164
- //
165
- SNICallback : ssl . SNICallback ,
161
+ ciphers : ciphers ,
162
+ honorCipherOrder : honorCipherOrder ,
166
163
//
167
164
// Protect against the POODLE attack by disabling SSLv3
168
165
// @see http://googleonlinesecurity.blogspot.nl/2014/10/this-poodle-bites-exploiting-ssl-30.html
169
166
//
170
167
secureProtocol : 'SSLv23_method' ,
171
168
secureOptions : require ( 'constants' ) . SSL_OP_NO_SSLv3
172
- } , ssl . handler || handler ) ;
169
+ } ) ;
170
+
171
+ log ( 'https | listening on %d' , port ) ;
172
+ server = https . createServer ( finalHttpsOptions , ssl . handler || handler ) ;
173
173
174
174
args = [ server , port ] ;
175
175
if ( options . https . host ) {
0 commit comments