Browse Source

tls: do not call SNICallback unless present

When asynchronously parsing ClientHello for session resumption -
SNICallback may not be set. Check if it is present before invoking
it.

fix #7010
v0.11.13-release
Fedor Indutny 11 years ago
parent
commit
d24946b1b4
  1. 4
      lib/_tls_wrap.js
  2. 1
      test/simple/test-tls-session-cache.js

4
lib/_tls_wrap.js

@ -104,7 +104,9 @@ function onclienthello(hello) {
// session. // session.
// //
// Therefore we should account session loading when dealing with servername // Therefore we should account session loading when dealing with servername
if (ret && ret.servername) { if (!self._SNICallback) {
self.ssl.endParser();
} else if (ret && ret.servername) {
self._SNICallback(ret.servername, onSNIResult); self._SNICallback(ret.servername, onSNIResult);
} else if (hello.servername && self._SNICallback) { } else if (hello.servername && self._SNICallback) {
self._SNICallback(hello.servername, onSNIResult); self._SNICallback(hello.servername, onSNIResult);

1
test/simple/test-tls-session-cache.js

@ -90,6 +90,7 @@ function doTest(testOptions, callback) {
's_client', 's_client',
'-tls1', '-tls1',
'-connect', 'localhost:' + common.PORT, '-connect', 'localhost:' + common.PORT,
'-servername', 'ohgod',
'-key', join(common.fixturesDir, 'agent.key'), '-key', join(common.fixturesDir, 'agent.key'),
'-cert', join(common.fixturesDir, 'agent.crt'), '-cert', join(common.fixturesDir, 'agent.crt'),
'-reconnect' '-reconnect'

Loading…
Cancel
Save