Merge pull request #1486 from murgatroid99/grpc-js_sni_port_fix

Omit port number from servername option
This commit is contained in:
Michael Lumish 2020-06-19 11:15:20 -07:00 committed by GitHub
commit 95289edcaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@grpc/grpc-js", "name": "@grpc/grpc-js",
"version": "1.1.0", "version": "1.1.1",
"description": "gRPC Library for Node - pure JS implementation", "description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/", "homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -28,7 +28,7 @@ import * as logging from './logging';
import { LogVerbosity } from './constants'; import { LogVerbosity } from './constants';
import { getProxiedConnection, ProxyConnectionResult } from './http_proxy'; import { getProxiedConnection, ProxyConnectionResult } from './http_proxy';
import * as net from 'net'; import * as net from 'net';
import { GrpcUri, parseUri } from './uri-parser'; import { GrpcUri, parseUri, splitHostPort } from './uri-parser';
import { ConnectionOptions } from 'tls'; import { ConnectionOptions } from 'tls';
import { FilterFactory, Filter } from './filter'; import { FilterFactory, Filter } from './filter';
@ -309,8 +309,9 @@ export class Subchannel {
}; };
connectionOptions.servername = sslTargetNameOverride; connectionOptions.servername = sslTargetNameOverride;
} else { } else {
const authorityHostname = splitHostPort(targetAuthority)?.host ?? 'localhost';
// We want to always set servername to support SNI // We want to always set servername to support SNI
connectionOptions.servername = targetAuthority; connectionOptions.servername = authorityHostname;
} }
if (proxyConnectionResult.socket) { if (proxyConnectionResult.socket) {
/* This is part of the workaround for /* This is part of the workaround for