Merge pull request #1609 from murgatroid99/grpc-js_http_proxy_port_80

Set the default port of 80 explicitly in http_proxy
This commit is contained in:
Michael Lumish 2020-10-23 10:45:30 -07:00 committed by GitHub
commit b44502144c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -84,8 +84,16 @@ function getProxyInfo(): ProxyInfo {
userCred = proxyUrl.username;
}
}
const hostname = proxyUrl.hostname;
let port = proxyUrl.port;
/* The proxy URL uses the scheme "http:", which has a default port number of
* 80. We need to set that explicitly here if it is omitted because otherwise
* it will use gRPC's default port 443. */
if (port === '') {
port = '80';
}
const result: ProxyInfo = {
address: proxyUrl.host,
address: `${hostname}:${port}`
};
if (userCred) {
result.creds = userCred;