From d072bc08b4664ea31fa343eac8087236b5186297 Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Sun, 13 Oct 2024 20:27:18 -0700 Subject: [PATCH] different way of base64ing bytes and match case on connection header --- client/src/utils.rs | 2 +- client/src/websocket.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/utils.rs b/client/src/utils.rs index d473cde..d7d836c 100644 --- a/client/src/utils.rs +++ b/client/src/utils.rs @@ -403,7 +403,7 @@ export function define_property(obj, k, v) { export function ws_key() { let key = new Uint8Array(16); crypto.getRandomValues(key); - return btoa(Array.from(key).map(String.fromCharCode).join('')); + return btoa(String.fromCharCode.apply(null, key)); } export function from_entries(entries){ diff --git a/client/src/websocket.rs b/client/src/websocket.rs index af271f4..80a0f66 100644 --- a/client/src/websocket.rs +++ b/client/src/websocket.rs @@ -60,7 +60,7 @@ impl EpoxyWebSocket { .method(Method::GET) .uri(url.clone()) .header(HOST, host) - .header(CONNECTION, "upgrade") + .header(CONNECTION, "Upgrade") .header(UPGRADE, "websocket") .header(SEC_WEBSOCKET_KEY, ws_key()) .header(SEC_WEBSOCKET_VERSION, "13")