Accept buffers for cert/key in createServer

This commit is contained in:
Tobias Muellerleile 2014-05-06 07:36:18 +02:00
parent cf8adf4a4a
commit 501fb5a46b
1 changed files with 6 additions and 4 deletions

View File

@ -258,10 +258,12 @@ function Server(options) {
if (options.certificate || options.key) {
if (!(options.certificate && options.key) ||
typeof (options.certificate) !== 'string' ||
typeof (options.key) !== 'string') {
throw new TypeError('options.certificate and options.key (string) ' +
'are both required for TLS');
(typeof (options.certificate) !== 'string' &&
!Buffer.isBuffer(options.key)) ||
(typeof (options.key) !== 'string' &&
!Buffer.isBuffer(options.key))) {
throw new TypeError('options.certificate and options.key ' +
'(string or buffer) are both required for TLS');
}
}
} else {