| 394 | } |
| 395 | |
| 396 | Result HttpWebSocketHandshake::computeAccept(StringSpan clientKey, Span<char> storage, StringSpan& accept) |
| 397 | { |
| 398 | SC_TRY(validateClientKey(clientKey)); |
| 399 | |
| 400 | HttpWebSocketSha1 sha1; |
| 401 | SC_TRY( |
| 402 | sha1.add(Span<const uint8_t>::reinterpret_bytes(clientKey.bytesWithoutTerminator(), clientKey.sizeInBytes()))); |
| 403 | SC_TRY(sha1.add({reinterpret_cast<const uint8_t*>(SC_HTTP_WEBSOCKET_GUID), sizeof(SC_HTTP_WEBSOCKET_GUID) - 1})); |
| 404 | |
| 405 | uint8_t digest[20] = {0}; |
| 406 | SC_TRY(sha1.finish(digest)); |
| 407 | return scHttpWebSocketBase64Encode({digest, sizeof(digest)}, storage, accept); |
| 408 | } |
| 409 | |
| 410 | bool HttpWebSocketHandshake::headerContainsToken(StringSpan headerValue, StringSpan token) |
| 411 | { |
nothing calls this directly
no test coverage detected