protected override bool AdvanceFrame() { if (this.currentFrameIdx >= this.frames.Count - 1) { return(false); } this.currentFrameIdx++; HTTP2FrameHeaderAndPayload frame = this.frames[this.currentFrameIdx]; this.data = frame.Payload; switch (frame.Type) { case HTTP2FrameTypes.HEADERS: var header = HTTP2FrameHelper.ReadHeadersFrame(frame); this.offset = header.HeaderBlockFragmentIdx; this.maxOffset = this.offset + header.HeaderBlockFragmentLength; break; case HTTP2FrameTypes.CONTINUATION: this.offset = 0; this.maxOffset = frame.PayloadLength; break; } return(true); }
protected override long CalculateDataLengthForFrame(HTTP2FrameHeaderAndPayload frame) { switch (frame.Type) { case HTTP2FrameTypes.HEADERS: return(HTTP2FrameHelper.ReadHeadersFrame(frame).HeaderBlockFragmentLength); case HTTP2FrameTypes.CONTINUATION: return(frame.PayloadLength); } return(0); }