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:
commit
4fb97a86b0
|
@ -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.certificate)) ||
|
||||
(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 {
|
||||
|
|
Loading…
Reference in New Issue