public override void SessionReceive(IServer server, SessionReceiveEventArgs e) { base.SessionReceive(server, e); PipeStream pipeStream = e.Session.Stream.ToPipeStream(); HttpToken token = (HttpToken)e.Session.Tag; var result = pipeStream.IndexOfLine(); while (result.End != null) { if (result.Length == 2) { pipeStream.ReadFree(result.Length); OnStartRequest(token.CurrentRequest, e.Session, token, pipeStream); } else { if (token.CurrentRequest == null) { var request = new RequestData(); byte[] buffer = null; buffer = new byte[result.Length]; pipeStream.Read(buffer, 0, result.Length); request.Data = new ArraySegment <byte>(buffer, 0, result.Length); AnalysisAction(request); if (request.Action == ActionType.Plaintext) { token.CurrentRequest = request; } else { token.CurrentRequest = request; pipeStream.ReadFree((int)pipeStream.Length); OnStartRequest(request, e.Session, token, pipeStream); return; } } else { pipeStream.ReadFree(result.Length); } } if (pipeStream.Length > 0) { result = pipeStream.IndexOfLine(); } else { break; } } }