Merge pull request #183 from tmuellerleile/tls-createserver

Accept certificate/key as buffers (or strings) when initializing TLS
server socket.
This commit is contained in:
Patrick Mooney 2014-05-06 23:09:52 -05:00
commit 4fb97a86b0
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) {
if (!(options.certificate && options.key) || if (!(options.certificate && options.key) ||
typeof (options.certificate) !== 'string' || (typeof (options.certificate) !== 'string' &&
typeof (options.key) !== 'string') { !Buffer.isBuffer(options.certificate)) ||
throw new TypeError('options.certificate and options.key (string) ' + (typeof (options.key) !== 'string' &&
'are both required for TLS'); !Buffer.isBuffer(options.key))) {
throw new TypeError('options.certificate and options.key ' +
'(string or buffer) are both required for TLS');
} }
} }
} else { } else {