summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWebSocket
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-04-02 13:08:43 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-03 15:53:49 +0200
commit15532df83da6a8bd91db1b28431e0c14d5cbce05 (patch)
tree38811376618fee5a1fa8ae4d824db02853f3b5fe /Userland/Libraries/LibWebSocket
parent5c045b693427f35b13b40f586fa63bd1d08e06ed (diff)
downloadserenity-15532df83da6a8bd91db1b28431e0c14d5cbce05.zip
AK+Everywhere: Change AK::fill_with_random to accept a Bytes object
Rather than the very C-like API we currently have, accepting a void* and a length, let's take a Bytes object instead. In almost all existing cases, the compiler figures out the length.
Diffstat (limited to 'Userland/Libraries/LibWebSocket')
-rw-r--r--Userland/Libraries/LibWebSocket/WebSocket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWebSocket/WebSocket.cpp b/Userland/Libraries/LibWebSocket/WebSocket.cpp
index 6d7ac8630c..4be5b4613e 100644
--- a/Userland/Libraries/LibWebSocket/WebSocket.cpp
+++ b/Userland/Libraries/LibWebSocket/WebSocket.cpp
@@ -184,7 +184,7 @@ void WebSocket::send_client_handshake()
// 7. 16-byte nonce encoded as Base64
u8 nonce_data[16];
- fill_with_random(nonce_data, 16);
+ fill_with_random(nonce_data);
// FIXME: change to TRY() and make method fallible
m_websocket_key = MUST(encode_base64({ nonce_data, 16 })).to_deprecated_string();
builder.appendff("Sec-WebSocket-Key: {}\r\n", m_websocket_key);
@@ -579,7 +579,7 @@ void WebSocket::send_frame(WebSocket::OpCode op_code, ReadonlyBytes payload, boo
// > Clients MUST choose a new masking key for each frame, using an algorithm
// > that cannot be predicted by end applications that provide data
u8 masking_key[4];
- fill_with_random(masking_key, 4);
+ fill_with_random(masking_key);
m_impl->send(ReadonlyBytes(masking_key, 4));
// don't try to send empty payload
if (payload.size() == 0)