Skip to content

Commit 941f1cd

Browse files
committed
[tiny] A bit of stylistic OCD.
1 parent 6920a87 commit 941f1cd

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

index.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var fs = require('fs'),
1515
errs = require('errs'),
1616
assign = require('object-assign');
1717

18+
var pemFormat = /-----BEGIN/;
19+
1820
var CIPHERS = [
1921
'ECDHE-RSA-AES256-SHA384',
2022
'DHE-RSA-AES256-SHA384',
@@ -34,10 +36,10 @@ var CIPHERS = [
3436
'!CAMELLIA'
3537
].join(':');
3638

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+
*/
4143
module.exports = function createServers(options, listening) {
4244
if (!options || (!options.http && !options.https)
4345
|| (!options.handler && !options.http.handler && !options.https.handler)) {
@@ -178,11 +180,18 @@ module.exports = function createServers(options, listening) {
178180
.forEach(function (fn) { fn(); });
179181
};
180182

181-
var pemFormat = /-----BEGIN/;
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+
*/
183189
function normalizeCertFile(root, file) {
190+
//
191+
// Assumption that this is a Buffer, a PEM file, or something broken
192+
//
184193
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;
186195
}
187196

188197
return fs.readFileSync(path.resolve(root, file));

0 commit comments

Comments
 (0)