tls: handle empty cert in checkServerIndentity · nodejs/node@d9b70f9 · GitHub
Skip to content

Commit d9b70f9

Browse files
Mike Atkinsrvagg
authored andcommitted
tls: handle empty cert in checkServerIndentity
This resolves nodejs/node-v0.x-archive#9272. `tlsSocket.getPeerCertificate` will return an empty object when the peer does not provide a certificate, but, prior to this, when the certificate is empty, `checkServerIdentity` would throw because the `subject` wasn't present on the cert. `checkServerIdentity` must return an error, not throw one, so this returns an error when the cert is empty instead of throwing a `TypeError`. PR-URL: #2343 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
1 parent 3f821b9 commit d9b70f9

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/tls.js

Lines changed: 3 additions & 1 deletion

test/parallel/test-tls-check-server-identity.js

Lines changed: 7 additions & 0 deletions

0 commit comments

Comments
 (0)