different way of base64ing bytes and match case on connection header

This commit is contained in:
Toshit Chawda 2024-10-13 20:27:18 -07:00
parent 4ab0320c98
commit d072bc08b4
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
2 changed files with 2 additions and 2 deletions

View file

@ -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){

View file

@ -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")