diff options
author | oyyd <oyydoibh@gmail.com> | 2019-05-17 21:19:40 +0800 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-05-23 16:15:12 +0200 |
commit | 4716caa12e1ca61c8cb66a494499ad8c8370903b (patch) | |
tree | 69d378d1a31432f8f2679e1120c4f7f8966f3fb2 /lib/_tls_wrap.js | |
parent | 1a8e67cc1fa17e0e89915b6613c07db22d557baa (diff) | |
download | android-node-v8-4716caa12e1ca61c8cb66a494499ad8c8370903b.tar.gz android-node-v8-4716caa12e1ca61c8cb66a494499ad8c8370903b.tar.bz2 android-node-v8-4716caa12e1ca61c8cb66a494499ad8c8370903b.zip |
tls: set tlsSocket.servername as early as possible
This commit makes `TLSSocket` set the `servername` property on
`SSL_CTX_set_tlsext_servername_callback` so that we could get it
later even if errors happen.
Fixes: https://github.com/nodejs/node/issues/27699
PR-URL: https://github.com/nodejs/node/pull/27759
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r-- | lib/_tls_wrap.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 618f3892ce..4f46204d06 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -774,7 +774,10 @@ TLSSocket.prototype._finishInit = function() { return; this.alpnProtocol = this._handle.getALPNNegotiatedProtocol(); - this.servername = this._handle.getServername(); + // The servername could be set by TLSWrap::SelectSNIContextCallback(). + if (this.servername === null) { + this.servername = this._handle.getServername(); + } debug('%s _finishInit', this._tlsOptions.isServer ? 'server' : 'client', |