Skip to content

Commit

Permalink
http2: set origin name correctly when servername is empty
Browse files Browse the repository at this point in the history
Fixes: #39919
Refs: #39934
  • Loading branch information
ofir committed May 22, 2022
1 parent 40fa2e9 commit 10cb6da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions test/parallel/test-http2-create-client-secure-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '' });

0 comments on commit 10cb6da

Please sign in to comment.