Skip to content

Commit b257c60

Browse files
committed
Fix websocket defaulting to port 80 when authority has no port
1 parent 6b579d6 commit b257c60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/vscode.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,15 +619,15 @@ index d39c5877d6..c189d6f19f 100644
619619

620620
const rootPath = path.dirname(getPathFromAmdModule(require, ''));
621621
diff --git a/src/vs/platform/remote/browser/browserWebSocketFactory.ts b/src/vs/platform/remote/browser/browserWebSocketFactory.ts
622-
index 6d9ecbcf5a..1b3499dddf 100644
622+
index 6d9ecbcf5a..a3eb980965 100644
623623
--- a/src/vs/platform/remote/browser/browserWebSocketFactory.ts
624624
+++ b/src/vs/platform/remote/browser/browserWebSocketFactory.ts
625625
@@ -79,7 +79,7 @@ class BrowserSocket implements ISocket {
626626
export const browserWebSocketFactory = new class implements IWebSocketFactory {
627627
connect(host: string, port: number, query: string, callback: IConnectCallback): void {
628628
const errorListener = (err: any) => callback(err, undefined);
629629
- const socket = new WebSocket(`ws://${host}:${port}/?${query}&skipWebSocketFrames=false`);
630-
+ const socket = new WebSocket(`${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${host}:${port}${window.location.pathname.replace(/\/+$/, '')}/?${query}&skipWebSocketFrames=false`);
630+
+ const socket = new WebSocket(`${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${window.location.host}${window.location.pathname}?${query}&skipWebSocketFrames=false`);
631631
socket.onopen = function (event) {
632632
socket.removeEventListener('error', errorListener);
633633
callback(undefined, new BrowserSocket(socket));

0 commit comments

Comments
 (0)