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