aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2013-08-06 20:30:21 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-08-07 00:57:32 +0400
commit166c405b33320a0d6aceca6dc356fc26dc8a1da1 (patch)
tree7369b181f4edf0775b3ed06d897ca44d66796fc9
parentb26d346b57fc1964bc4b20d522a7bc2b68edb1be (diff)
downloadandroid-node-v8-166c405b33320a0d6aceca6dc356fc26dc8a1da1.tar.gz
android-node-v8-166c405b33320a0d6aceca6dc356fc26dc8a1da1.tar.bz2
android-node-v8-166c405b33320a0d6aceca6dc356fc26dc8a1da1.zip
tls: fix lazy initialization of clienthello parser
`server.SNICallback` was initialized with `SNICallback.bind(this)`, and therefore check `this.SNICallback === SNICallback` was always false, and `_tls_wrap.js` always thought that it was a custom callback instead of default one. Which in turn was causing clienthello parser to be enabled regardless of presence of SNI contexts.
-rw-r--r--lib/_tls_wrap.js11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index d4c2b576ec..2dc5743f63 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -427,7 +427,7 @@ function Server(/* [options], listener */) {
requestCert: self.requestCert,
rejectUnauthorized: self.rejectUnauthorized,
NPNProtocols: self.NPNProtocols,
- SNICallback: self.SNICallback
+ SNICallback: options.SNICallback || SNICallback
});
function listener() {
@@ -517,11 +517,6 @@ Server.prototype.setOptions = function(options) {
}
if (secureOptions) this.secureOptions = secureOptions;
if (options.NPNProtocols) tls.convertNPNProtocols(options.NPNProtocols, this);
- if (options.SNICallback) {
- this.SNICallback = options.SNICallback;
- } else {
- this.SNICallback = this.SNICallback.bind(this);
- }
if (options.sessionIdContext) {
this.sessionIdContext = options.sessionIdContext;
} else if (this.requestCert) {
@@ -547,7 +542,7 @@ Server.prototype.addContext = function(servername, credentials) {
function SNICallback(servername, callback) {
var ctx;
- this._contexts.some(function(elem) {
+ this.server._contexts.some(function(elem) {
if (!util.isNull(servername.match(elem[0]))) {
ctx = elem[1];
return true;
@@ -557,8 +552,6 @@ function SNICallback(servername, callback) {
callback(null, ctx);
}
-Server.prototype.SNICallback = SNICallback;
-
// Target API:
//