| 764 | } |
| 765 | |
| 766 | Result HttpWebSocketFrameReader::onHeaderReady() |
| 767 | { |
| 768 | SC_TRY_MSG(currentFrame.masked == scHttpWebSocketRequiresIncomingMask(endpointRole), |
| 769 | "HttpWebSocketFrameReader invalid frame masking for endpoint role"); |
| 770 | |
| 771 | if (currentFrame.isControlFrame()) |
| 772 | { |
| 773 | SC_TRY_MSG(currentFrame.fin, "HttpWebSocketFrameReader control frames must not be fragmented"); |
| 774 | SC_TRY_MSG(currentFrame.payloadLength <= 125, "HttpWebSocketFrameReader control frame payload too large"); |
| 775 | } |
| 776 | else |
| 777 | { |
| 778 | if (currentFrame.opcode == HttpWebSocketOpcode::Continuation) |
| 779 | { |
| 780 | SC_TRY_MSG(fragmentedMessageInProgress, "HttpWebSocketFrameReader unexpected continuation frame"); |
| 781 | } |
| 782 | else |
| 783 | { |
| 784 | SC_TRY_MSG(not fragmentedMessageInProgress, "HttpWebSocketFrameReader expected continuation frame"); |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | if (onFrameHeader.isValid()) |
| 789 | { |
| 790 | SC_TRY(onFrameHeader(currentFrame)); |
| 791 | } |
| 792 | |
| 793 | payloadBytesRemaining = currentFrame.payloadLength; |
| 794 | payloadBytesConsumed = 0; |
| 795 | |
| 796 | if (payloadBytesRemaining == 0) |
| 797 | { |
| 798 | return finishCurrentFrame(); |
| 799 | } |
| 800 | |
| 801 | state = State::Payload; |
| 802 | return Result(true); |
| 803 | } |
| 804 | |
| 805 | Result HttpWebSocketFrameReader::finishCurrentFrame() |
| 806 | { |
nothing calls this directly
no test coverage detected