protected override int GetBodyLengthFromHeader(byte[] header, int offset, int length)
        {
            int         bodyLength  = 0;
            ChainHeader chainHeader = protocol.GetChainHeader(header);

            if (chainHeader.Method == "GET" || chainHeader.Method == "DELETE")
            {
                bodyLength += 4;
            }
            else
            {
                int contentLen = Convert.ToInt32(chainHeader.Data["Content-Length"]);

                bodyLength = length + contentLen + 4;
            }

            return(bodyLength);
        }
        /// <summary>
        /// Filters the specified session.
        /// </summary>
        /// <param name="readBuffer">The read buffer.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="length">The length.</param>
        /// <param name="toBeCopied">if set to <c>true</c> [to be copied].</param>
        /// <param name="rest">The rest.</param>
        /// <returns></returns>
        public virtual TRequestInfo Filter(byte[] readBuffer, int offset, int length, bool toBeCopied, out int rest)
        {
            //获取包头信息
            ChainProtocol hp = new ChainProtocol();

            result = readBuffer.SearchMark(offset, length, m_SearchState);
            if (result == -1)
            {
                rest = -1;
            }
            else
            {
                m_Size = result - offset;
                byte[] headerdata = new byte[m_Size];
                Buffer.BlockCopy(readBuffer, offset, headerdata, 0, m_Size);
                ChainHeader chainHeader = hp.GetChainHeader(headerdata);
                rest = m_ParsedLength + length - m_Size;
            }



            if (rest >= 0)
            {
                var requestInfo = ProcessMatchedRequest(readBuffer, offset - m_ParsedLength, m_Size, toBeCopied);
                InternalReset();
                return(requestInfo);
            }
            else
            {
                m_ParsedLength += length;
                m_OffsetDelta   = m_ParsedLength;
                rest            = 0;

                var expectedOffset = offset + length;
                var newOffset      = m_OrigOffset + m_OffsetDelta;

                if (newOffset < expectedOffset)
                {
                    Buffer.BlockCopy(readBuffer, offset - m_ParsedLength + length, readBuffer, m_OrigOffset, m_ParsedLength);
                }

                return(NullRequestInfo);
            }
        }