public override HttpPackageInfo ResolvePackage(IBufferStream bufferStream) { var numLen = (int)(bufferStream.Length - m_HeaderSize - 2); bufferStream.Skip(m_HeaderSize); var chunkSize = 0; for (var i = numLen - 1; i >= 0; i--) { chunkSize = chunkSize + (int)bufferStream.ReadByte() * (16 ^ i); } if (chunkSize > 0) { NextReceiveFilter = new HttpChunkDataReceiveFilter(this, m_HeaderSize + numLen + 2 + chunkSize, chunkSize); return(null); } // last chunk var body = m_BodyBuilder.ToString(); m_BodyBuilder = null; return(new HttpPackageInfo("Test", m_HttpHeader, body)); }
public override HttpPackageInfo ResolvePackage(IBufferStream bufferStream) { var numLen = (int)(bufferStream.Length - 2); var chunkSize = 0; var chunksizeString = bufferStream.ReadString(numLen, Encoding.ASCII); Console.WriteLine("ChunkSizeStr:" + chunksizeString); chunkSize = Convert.ToInt32(chunksizeString, 16); Console.WriteLine($"ChunkSize: {chunkSize}"); bufferStream.Buffers.Clear(); NextReceiveFilter = new HttpChunkDataReceiveFilter(this, chunkSize + 2); return(null); }