Update subchannel.ts

This commit is contained in:
WK 2020-08-30 14:52:20 +08:00 committed by GitHub
parent 6f3db6f4d8
commit 08350ec0ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -467,11 +467,13 @@ export class Subchannel {
* if a connection is successfully established through the proxy.
* If the proxy is not used, these connectionOptions are discarded
* anyway */
connectionOptions.servername = getDefaultAuthority(
const targetPath = getDefaultAuthority(
parseUri(this.options['grpc.http_connect_target'] as string) ?? {
path: 'localhost',
}
);
const hostPort = splitHostPort(targetPath);
connectionOptions.servername = (hostPort !== null) ? hostPort.host : targetPath;
}
}
}