@@ -15,6 +15,8 @@ var fs = require('fs'),
15
15
errs = require ( 'errs' ) ,
16
16
assign = require ( 'object-assign' ) ;
17
17
18
+ var pemFormat = / - - - - - B E G I N / ;
19
+
18
20
var CIPHERS = [
19
21
'ECDHE-RSA-AES256-SHA384' ,
20
22
'DHE-RSA-AES256-SHA384' ,
@@ -34,10 +36,10 @@ var CIPHERS = [
34
36
'!CAMELLIA'
35
37
] . join ( ':' ) ;
36
38
37
- //
38
- // ### function createServers (dispatch, options, callback)
39
- // Creates and listens on both HTTP and HTTPS servers.
40
- / /
39
+ /**
40
+ * function createServers (dispatch, options, callback)
41
+ * Creates and listens on both HTTP and HTTPS servers.
42
+ * /
41
43
module . exports = function createServers ( options , listening ) {
42
44
if ( ! options || ( ! options . http && ! options . https )
43
45
|| ( ! options . handler && ! options . http . handler && ! options . https . handler ) ) {
@@ -178,11 +180,18 @@ module.exports = function createServers(options, listening) {
178
180
. forEach ( function ( fn ) { fn ( ) ; } ) ;
179
181
} ;
180
182
181
- var pemFormat = / - - - - - B E G I N / ;
182
-
183
+ /**
184
+ * function normalizeCertFile(root, file)
185
+ * Returns the contents of `file` verbatim if it is determined to be
186
+ * certificate material and not a file path. Otherwise, returns the
187
+ * certificate material read from that file path.
188
+ */
183
189
function normalizeCertFile ( root , file ) {
190
+ //
191
+ // Assumption that this is a Buffer, a PEM file, or something broken
192
+ //
184
193
if ( typeof ( file ) !== 'string' || pemFormat . test ( file ) ) {
185
- return file ; // Assumption that this is a Buffer, a PEM file, or something broken
194
+ return file ;
186
195
}
187
196
188
197
return fs . readFileSync ( path . resolve ( root , file ) ) ;
0 commit comments