From ddade34e808330a64902d55fdbcb496c576599db Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 3 Dec 2020 19:49:35 +0300 Subject: attempt to fix #2575 (error 404 while opening Discord gateway connection) --- src/mir_app/src/netlib_websocket.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mir_app') diff --git a/src/mir_app/src/netlib_websocket.cpp b/src/mir_app/src/netlib_websocket.cpp index 8f5a1a5316..23b30957dd 100644 --- a/src/mir_app/src/netlib_websocket.cpp +++ b/src/mir_app/src/netlib_websocket.cpp @@ -43,6 +43,10 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) WebSocket_Connect(HNETLIBUSER nlu, const char *s nlr->AddHeader("Pragma", "no-cache"); nlr->AddHeader("Cache-Control", "no-cache"); nlr->AddHeader("Connection", "keep-alive, Upgrade"); + + uint8_t binNonce[16]; + Utils_GetRandom(binNonce, sizeof(binNonce)); + nlr->AddHeader("Sec-WebSocket-Key", ptrA(mir_base64_encode(binNonce, sizeof(binNonce)))); nlr->AddHeader("Sec-WebSocket-Version", "13"); nlr->AddHeader("Sec-WebSocket-Extensions", "permessage-deflate; client_max_window_bits"); -- cgit v1.2.3