diff options
author | ofirbarak <ofirbirka@gmail.com> | 2022-05-25 15:24:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-25 15:24:28 +0300 |
commit | f9f22b4b6978ccf6573f244a971f8f1e4fbe40ee (patch) | |
tree | 1d6d89733ecbf276df020bb095ceffc8d56b7c1a | |
parent | ee91acb49d64f41b2bd7fe9a094fda3557340061 (diff) |
http2: set origin name correctly when servername is empty
Fixes: https://github.com/nodejs/node/issues/39919
Refs: https://github.com/nodejs/node/pull/39934
PR-URL: https://github.com/nodejs/node/pull/42838
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
-rw-r--r-- | lib/internal/http2/core.js | 2 | ||||
-rw-r--r-- | test/parallel/test-http2-create-client-secure-session.js | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 871794f51bb..7a7c9906c03 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -3119,7 +3119,7 @@ function initializeTLSOptions(options, servername) { options.ALPNProtocols = ['h2']; if (options.allowHTTP1 === true) ArrayPrototypePush(options.ALPNProtocols, 'http/1.1'); - if (servername !== undefined && options.servername === undefined) + if (servername !== undefined && !options.servername) options.servername = servername; return options; } diff --git a/test/parallel/test-http2-create-client-secure-session.js b/test/parallel/test-http2-create-client-secure-session.js index 4303786b3e4..2f7678cc689 100644 --- a/test/parallel/test-http2-create-client-secure-session.js +++ b/test/parallel/test-http2-create-client-secure-session.js @@ -91,3 +91,9 @@ verifySecureSession( loadKey('agent1-cert.pem'), loadKey('ca1-cert.pem'), { servername: 'agent1' }); + +verifySecureSession( + loadKey('agent8-key.pem'), + loadKey('agent8-cert.pem'), + loadKey('fake-startcom-root-cert.pem'), + { servername: '' }); |