Skip to content

Commit

Permalink
Merge pull request #1555 from wkchee/patch-1
Browse files Browse the repository at this point in the history
Fixed connectivity to Google PubSub over proxy
  • Loading branch information
murgatroid99 committed Aug 31, 2020
2 parents 2111c0f + 158d0dd commit 4b9da2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/grpc-js/src/http_proxy.ts
Expand Up @@ -215,8 +215,10 @@ export function getProxiedConnection(
* connection to a TLS connection.
* This is a workaround for https://github.com/nodejs/node/issues/32922
* See https://github.com/grpc/grpc-node/pull/1369 for more info. */
const remoteHost = getDefaultAuthority(parsedTarget);

const targetPath = getDefaultAuthority(parsedTarget);
const hostPort = splitHostPort(targetPath);
const remoteHost = hostPort?.host ?? targetPath;

const cts = tls.connect(
{
host: remoteHost,
Expand Down
4 changes: 3 additions & 1 deletion packages/grpc-js/src/subchannel.ts
Expand Up @@ -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?.host ?? targetPath;
}
}
}
Expand Down

0 comments on commit 4b9da2e

Please sign in to comment.