diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 9d8d6bc2c860fa..4f2e1569858440 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 4303786b3e435d..2f7678cc689825 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: '' });