| 576 | void HttpWebSocketTransportView::reset() |
| 577 | { |
| 578 | readableStream = nullptr; |
| 579 | writableStream = nullptr; |
| 580 | buffersPool = nullptr; |
| 581 | } |
| 582 | |
| 583 | Result HttpWebSocketHandshake::createClientKey(Span<const uint8_t> nonce, Span<char> storage, StringSpan& key) |
| 584 | { |
| 585 | SC_TRY_MSG(nonce.sizeInBytes() == NonceLength, "HttpWebSocketHandshake nonce must be 16 bytes"); |
| 586 | return scHttpWebSocketBase64Encode(nonce, storage, key); |
| 587 | } |
| 588 | |
| 589 | Result HttpWebSocketHandshake::validateClientKey(StringSpan key) |
| 590 | { |
| 591 | SC_TRY_MSG(key.sizeInBytes() == ClientKeyLength, "HttpWebSocketHandshake Sec-WebSocket-Key length invalid"); |
| 592 | |
| 593 | uint8_t decoded[NonceLength] = {0}; |
| 594 | size_t decodedBytes = 0; |