From 9a9e2e5a7a7eb29514575b192951d3c20e92c529 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 00:51:02 +0800 Subject: [PATCH 1/7] Update _tls_wrap.js --- lib/_tls_wrap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index c5f30c01fa18e7..c3d69b71384da0 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1436,7 +1436,8 @@ Server.prototype[EE.captureRejectionSymbol] = function( function SNICallback(servername, callback) { const contexts = this.server._contexts; - for (const elem of contexts) { + for (let i=contexts.length-1;i>=0;i--){ + const elem = contexts[i] if (elem[0].test(servername)) { callback(null, elem[1]); return; From 16e252053d83ae5dfdd141dfde48840eb1e6c8c7 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:36:22 +0800 Subject: [PATCH 2/7] Update _tls_wrap.js --- lib/_tls_wrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index c3d69b71384da0..7ef4ab1c529808 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1435,7 +1435,7 @@ Server.prototype[EE.captureRejectionSymbol] = function( function SNICallback(servername, callback) { const contexts = this.server._contexts; - +//Fixes: https://github.com//issues/34110 for (let i=contexts.length-1;i>=0;i--){ const elem = contexts[i] if (elem[0].test(servername)) { From 206a72466c5a6326311acc390374e58eda964ab6 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:37:51 +0800 Subject: [PATCH 3/7] https://github.com/nodejs/node/issues/34110 --- lib/_tls_wrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 7ef4ab1c529808..d5d1a8600826d3 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1435,7 +1435,7 @@ Server.prototype[EE.captureRejectionSymbol] = function( function SNICallback(servername, callback) { const contexts = this.server._contexts; -//Fixes: https://github.com//issues/34110 +//Fixes: https://github.com/nodejs/node/issues/34110 for (let i=contexts.length-1;i>=0;i--){ const elem = contexts[i] if (elem[0].test(servername)) { From b75bdd33ece3583c3f7900da1e2c8d5248f191f1 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:46:26 +0800 Subject: [PATCH 4/7] Update _tls_wrap.js --- lib/_tls_wrap.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index d5d1a8600826d3..31a66754f43535 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1412,6 +1412,12 @@ Server.prototype.addContext = function(servername, context) { if (!servername) { throw new ERR_TLS_REQUIRED_SERVER_NAME(); } +//https://github.com/nodejs/node/issues/34110 +servername=servername.toLowerCase() + + + + const re = new RegExp('^' + servername.replace(/([.^$+?\-\\[\]{}])/g, '\\$1') From dfd9a31336d71e2de0845da337aa9fd2a43aa584 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:50:21 +0800 Subject: [PATCH 5/7] Update lib/_tls_wrap.js Co-authored-by: James M Snell --- lib/_tls_wrap.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 31a66754f43535..97a61df7506316 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1415,10 +1415,6 @@ Server.prototype.addContext = function(servername, context) { //https://github.com/nodejs/node/issues/34110 servername=servername.toLowerCase() - - - - const re = new RegExp('^' + servername.replace(/([.^$+?\-\\[\]{}])/g, '\\$1') .replace(/\*/g, '[^.]*') + From 5549fd26ef7de87d29581a93861b07de2f89f50c Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:52:28 +0800 Subject: [PATCH 6/7] Update lib/_tls_wrap.js Co-authored-by: James M Snell --- lib/_tls_wrap.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 97a61df7506316..b31cabaf9c8dea 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1412,8 +1412,7 @@ Server.prototype.addContext = function(servername, context) { if (!servername) { throw new ERR_TLS_REQUIRED_SERVER_NAME(); } -//https://github.com/nodejs/node/issues/34110 -servername=servername.toLowerCase() +servername = servername.toLowerCase() const re = new RegExp('^' + servername.replace(/([.^$+?\-\\[\]{}])/g, '\\$1') From 9d17cb9fcd919a9db40b63b9a6523bee33056ec9 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:53:11 +0800 Subject: [PATCH 7/7] Update lib/_tls_wrap.js Co-authored-by: James M Snell --- lib/_tls_wrap.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index b31cabaf9c8dea..5961fbf0f7c782 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1436,8 +1436,7 @@ Server.prototype[EE.captureRejectionSymbol] = function( function SNICallback(servername, callback) { const contexts = this.server._contexts; -//Fixes: https://github.com/nodejs/node/issues/34110 - for (let i=contexts.length-1;i>=0;i--){ + for (let i = contexts.length - 1; i >= 0 ; i--) { const elem = contexts[i] if (elem[0].test(servername)) { callback(null, elem[1]);