mirror of
https://github.com/coder/code-server.git
synced 2024-12-27 03:34:06 +03:00
Add check for missing reconnection token
This means something is misconfigured.
This commit is contained in:
parent
c4fd725875
commit
78b6b3afdf
@ -266,7 +266,7 @@ export abstract class Server {
|
|||||||
await this.preHandleWebSocket(request, socket);
|
await this.preHandleWebSocket(request, socket);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
console.error(error);
|
console.error(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,8 +421,11 @@ export class MainServer extends Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async handleWebSocket(socket: net.Socket, parsedUrl: url.UrlWithParsedQuery): Promise<void> {
|
protected async handleWebSocket(socket: net.Socket, parsedUrl: url.UrlWithParsedQuery): Promise<void> {
|
||||||
|
if (!parsedUrl.query.reconnectionToken) {
|
||||||
|
throw new Error("Reconnection token is missing from query parameters");
|
||||||
|
}
|
||||||
const protocol = new Protocol(await this.createProxy(socket), {
|
const protocol = new Protocol(await this.createProxy(socket), {
|
||||||
reconnectionToken: <string>parsedUrl.query.reconnectionToken || "",
|
reconnectionToken: <string>parsedUrl.query.reconnectionToken,
|
||||||
reconnection: parsedUrl.query.reconnection === "true",
|
reconnection: parsedUrl.query.reconnection === "true",
|
||||||
skipWebSocketFrames: parsedUrl.query.skipWebSocketFrames === "true",
|
skipWebSocketFrames: parsedUrl.query.skipWebSocketFrames === "true",
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user