Skip to content

Commit ea7f62f

Browse files
committed
Fixes microsoft#79496: Always go through the protocol handler
1 parent fe70d57 commit ea7f62f

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/vs/base/common/network.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export namespace Schemas {
4949

5050
export const vscodeRemote: string = 'vscode-remote';
5151

52+
export const vscodeRemoteResource: string = 'vscode-remote-resource';
53+
5254
export const userData: string = 'vscode-userdata';
5355
}
5456

@@ -64,7 +66,7 @@ class RemoteAuthoritiesImpl {
6466
}
6567

6668
public set(authority: string, host: string, port: number): void {
67-
this._hosts[authority] = (host === 'localhost' ? '127.0.0.1' : host);
69+
this._hosts[authority] = host;
6870
this._ports[authority] = port;
6971
}
7072

@@ -76,9 +78,8 @@ class RemoteAuthoritiesImpl {
7678
const host = this._hosts[authority];
7779
const port = this._ports[authority];
7880
const connectionToken = this._connectionTokens[authority];
79-
const scheme = (host === '127.0.0.1' ? Schemas.http : Schemas.vscodeRemote);
8081
return URI.from({
81-
scheme: scheme,
82+
scheme: Schemas.vscodeRemoteResource,
8283
authority: `${host}:${port}`,
8384
path: `/vscode-remote2`,
8485
query: `path=${encodeURIComponent(path)}&tkn=${encodeURIComponent(connectionToken)}`

src/vs/code/browser/workbench/workbench.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
1111

1212
<meta http-equiv="Content-Security-Policy"
13-
content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote:; media-src 'none'; frame-src 'self' {{WEBVIEW_ENDPOINT}} https://*.vscode-webview-test.com; script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https:; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: https:; font-src 'self' blob: vscode-remote:;">
13+
content="default-src 'none'; img-src 'self' https: data: blob:; media-src 'none'; frame-src 'self' {{WEBVIEW_ENDPOINT}} https://*.vscode-webview-test.com; script-src 'self' https://az416426.vo.msecnd.net 'unsafe-eval' https:; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: https:; font-src 'self' blob:;">
1414

1515
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONGIGURATION}}">
1616

src/vs/code/electron-browser/workbench/workbench.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html>
44
<head>
55
<meta charset="utf-8" />
6-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote: http://127.0.0.1:*; media-src 'none'; frame-src 'self' https://*.vscode-webview-test.com; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https: vscode-remote: http://127.0.0.1:*;">
6+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' https://*.vscode-webview-test.com; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https: vscode-remote-resource:;">
77
</head>
88
<body class="vs-dark" aria-label="">
99
</body>

src/vs/code/electron-main/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,9 @@ export class CodeApplication extends Disposable {
688688
}
689689

690690
private handleRemoteAuthorities(): void {
691-
protocol.registerHttpProtocol(Schemas.vscodeRemote, (request, callback) => {
691+
protocol.registerHttpProtocol(Schemas.vscodeRemoteResource, (request, callback) => {
692692
callback({
693-
url: request.url.replace(/^vscode-remote:/, 'http:'),
693+
url: request.url.replace(/^vscode-remote-resource:/, 'http:'),
694694
method: request.method
695695
});
696696
});

0 commit comments

Comments
 (0)