summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-12-03 19:49:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-12-03 19:49:35 +0300
commitddade34e808330a64902d55fdbcb496c576599db (patch)
tree46cf2be358b1f602c8e231d781b38f2dd35990cf /src/mir_app
parent360c80ddd03d84b257bb797463fceffa545c1139 (diff)
attempt to fix #2575 (error 404 while opening Discord gateway connection)
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/netlib_websocket.cpp4
1 files changed, 4 insertions, 0 deletions
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");