Make sure we don't go into a redirect loop when using port mappings with same source and destination ports

This commit is contained in:
Matt Bierner 2019-10-16 19:38:20 -07:00
parent 201a9c8e41
commit ac719087ef

View file

@ -34,6 +34,9 @@ export class WebviewPortMappingManager extends Disposable {
if (extensionLocation && extensionLocation.scheme === REMOTE_HOST_SCHEME) {
const tunnel = await this.getOrCreateTunnel(mapping.extensionHostPort);
if (tunnel) {
if (tunnel.tunnelLocalPort === mapping.webviewPort) {
return undefined;
}
return encodeURI(uri.with({
authority: `127.0.0.1:${tunnel.tunnelLocalPort}`,
}).toString(true));