diff --git a/websocket-sharp/Net/ChunkStream.cs b/websocket-sharp/Net/ChunkStream.cs index 4cf9c409..8a95b4d8 100644 --- a/websocket-sharp/Net/ChunkStream.cs +++ b/websocket-sharp/Net/ChunkStream.cs @@ -194,8 +194,6 @@ namespace WebSocketSharp.Net if (b != 10) return InputChunkState.None; - _chunkRead = 0; - var val = _saved.ToString (); var s = removeChunkExtension (val); @@ -206,6 +204,8 @@ namespace WebSocketSharp.Net throwProtocolViolation ("The chunk size cannot be parsed."); } + _chunkRead = 0; + if (_chunkSize == 0) { _trailerState = 2;