1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 02:33:12 +02:00

tests: add tests for auth via Sec-WebSocket-Protocol

This commit is contained in:
Trygve Aaberge
2024-11-16 19:27:11 +01:00
committed by Sébastien Helleu
parent bd7c503e7b
commit a414fb9da5
2 changed files with 34 additions and 0 deletions
@@ -248,6 +248,19 @@ TEST(RelayWebsocket, ClientHandshakeValid)
"\r\n",
relay_websocket_build_handshake (request));
relay_websocket_deflate_reinit (request->ws_deflate);
hashtable_set (request->headers, "sec-websocket-protocol",
WEBSOCKET_SUB_PROTOCOL_API_WEECHAT
", base64url.bearer.authorization.weechat.cGxhaW46c2VjcmV0X3Bhc3N3b3Jk");
WEE_TEST_STR(
"HTTP/1.1 101 Switching Protocols\r\n"
"Upgrade: websocket\r\n"
"Connection: Upgrade\r\n"
"Sec-WebSocket-Accept: fhLJYtv//ugX2vQXpifQgByRZ5Y=\r\n"
"Sec-WebSocket-Protocol: " WEBSOCKET_SUB_PROTOCOL_API_WEECHAT "\r\n"
"\r\n",
relay_websocket_build_handshake (request));
relay_http_request_free (request);
}