From 5e50439d4c5e1b38acb5262a8047cb6f0cf7185a Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 11 Mar 2021 19:41:37 +0900 Subject: [PATCH] [Modify] Move it --- websocket-sharp/Net/ChunkStream.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/Net/ChunkStream.cs b/websocket-sharp/Net/ChunkStream.cs index 7da45e3f..29bddabf 100644 --- a/websocket-sharp/Net/ChunkStream.cs +++ b/websocket-sharp/Net/ChunkStream.cs @@ -224,9 +224,6 @@ namespace WebSocketSharp.Net var b = buffer[offset++]; _saved.Append ((char) b); - if (_saved.Length > 4196) - throwProtocolViolation ("The trailer is too long."); - if (_trailerState == 1 || _trailerState == 3) { // CR or CR LF CR if (b != 10) throwProtocolViolation ("LF is expected."); @@ -248,6 +245,9 @@ namespace WebSocketSharp.Net _trailerState = 0; } + if (_saved.Length > 4196) + throwProtocolViolation ("The trailer is too long."); + if (_trailerState < 4) return InputChunkState.Trailer;