You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2019. It is now read-only.
In ParseWebSocketReceivedData if _webSocketReceiveState == WebSocketReceiveState.Header and there is not enough ReceiveDataLength to read full header (ParseHeader returns 0) the data is neither consumed nor additional receive is started. See autobahn test suite case "2.6.1" (fuzzingclient).
Before the latest changed I had a special case for ParseHeader(...) == 0 to simply call StartReciveDataIfNotAlreadyReceiving but now it causes a StackOverflowException because no data is consumed from Callback and StartReceiveData calls ProcessReceive if ReceiveDataLength > 0. The same might happen for Close frame due to: if (Callback.ReceiveDataLength < (int)_webSocketFrameLen) as it calls start receive without consuming data.
In my case (I am using somewhat refactored version of nowin thus a straight pull request is not possible :() I added additional buffers for header, control frame, ping frame and pong frames.
I modified ParseWebSocketReceivedData in following ways:
If ReceiveDataLength == 0 I still have to check whether I have a complete frame (in body with frame length zero or a full control frame)
Even if there is no receive in progress try to read frame header (if state is Header) consume data always but start a new receive if the header is incomplete.
If the header is complete - check if the frame is for Ping/Pong - handle accordingly. Read Ping frame payload into ping buffer and start a send that copied ping buffer to pong buffer (within locks) and issues a send.
For both Ping/Close frames if there is only partial data available fill control frame buffer, consume data and request more.
In
ParseWebSocketReceivedDataif_webSocketReceiveState == WebSocketReceiveState.Headerand there is not enoughReceiveDataLengthto read full header (ParseHeaderreturns 0) the data is neither consumed nor additional receive is started. See autobahn test suite case "2.6.1" (fuzzingclient).Before the latest changed I had a special case for
ParseHeader(...) == 0to simply callStartReciveDataIfNotAlreadyReceivingbut now it causes aStackOverflowExceptionbecause no data is consumed from Callback andStartReceiveDatacallsProcessReceiveifReceiveDataLength > 0. The same might happen for Close frame due to:if (Callback.ReceiveDataLength < (int)_webSocketFrameLen)as it calls start receive without consuming data.In my case (I am using somewhat refactored version of nowin thus a straight pull request is not possible :() I added additional buffers for header, control frame, ping frame and pong frames.
I modified
ParseWebSocketReceivedDatain following ways:ReceiveDataLength == 0I still have to check whether I have a complete frame (in body with frame length zero or a full control frame)Header) consume data always but start a new receive if the header is incomplete.