@@ -30,6 +30,7 @@ import {
30
30
import { ChannelOptions } from './channel-options' ;
31
31
import { GrpcUri , parseUri , splitHostPort , uriToString } from './uri-parser' ;
32
32
import { URL } from 'url' ;
33
+ import { DEFAULT_PORT } from './resolver-dns' ;
33
34
34
35
const TRACER_NAME = 'proxy' ;
35
36
@@ -189,16 +190,19 @@ export function getProxiedConnection(
189
190
if ( parsedTarget === null ) {
190
191
return Promise . resolve < ProxyConnectionResult > ( { } ) ;
191
192
}
192
- const targetHostPost = splitHostPort ( parsedTarget . path ) ;
193
- if ( targetHostPost === null ) {
193
+ const splitHostPost = splitHostPort ( parsedTarget . path ) ;
194
+ if ( splitHostPost === null ) {
194
195
return Promise . resolve < ProxyConnectionResult > ( { } ) ;
195
196
}
197
+ const hostPort = `${ splitHostPost . host } :${
198
+ splitHostPost . port ?? DEFAULT_PORT
199
+ } `;
196
200
const options : http . RequestOptions = {
197
201
method : 'CONNECT' ,
198
- path : targetHostPost . host + ':' + ( targetHostPost . port != null ? targetHostPost . port : '443' ) ,
202
+ path : hostPort ,
199
203
} ;
200
204
const headers : http . OutgoingHttpHeaders = {
201
- Host : targetHostPost . host + ':' + ( targetHostPost . port != null ? targetHostPost . port : '443' ) ,
205
+ Host : hostPort ,
202
206
} ;
203
207
// Connect to the subchannel address as a proxy
204
208
if ( isTcpSubchannelAddress ( address ) ) {
0 commit comments