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>
This commit is contained in:
ofirbarak authored and Michaël Zasso committed 2022-07-31 09:44:19 +02:00
1 parent fa70c99564
commit 367454205d
2 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -3111,7 +3111,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;
}
@@ -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: '' });