Servername is not set on TLS sockets if there is a TLS client error #27699
Labels
feature request
Issues that request new features to be added to Node.js.
tls
Issues and PRs related to the tls subsystem.
I am writing an HTTPS server and I want to try & detect when clients connect but reject my certificate. For irrelevant reasons this happens often.
If this happens, it typically triggers a
tlsClientError
event. When that happens, even though the servername has been received and SNICallback has been called successfully, theservername
field is still not set on the TLS socket provided with the event. For successful connections however (i.e.secureConnection
), it is always available.This is because it's only set on the socket in
_finishInit
, which is only gets called after a successful handshake has been completed:node/lib/_tls_wrap.js
Lines 735 to 747 in 495822f
It'd be very useful if this field was set earlier, as soon as the server name has been received, to provide extra context to TLS errors like these.
The text was updated successfully, but these errors were encountered: