Skip to content

Commit

Permalink
Add endHeader flag to QPACK decode (#62059)
Browse files Browse the repository at this point in the history
Co-authored-by: Tratcher <Tratcher@users.noreply.github.com>
Co-authored-by: James Newton-King <james@newtonking.com>
  • Loading branch information
3 people authored Nov 26, 2021
1 parent a2af8ae commit b256b43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ public void Reset()
_state = State.RequiredInsertCount;
}

public void Decode(in ReadOnlySequence<byte> headerBlock, IHttpHeadersHandler handler)
public void Decode(in ReadOnlySequence<byte> headerBlock, bool endHeaders, IHttpHeadersHandler handler)
{
foreach (ReadOnlyMemory<byte> segment in headerBlock)
{
Decode(segment.Span, handler);
Decode(segment.Span, endHeaders: false, handler);
}
}

public void Decode(ReadOnlySpan<byte> headerBlock, IHttpHeadersHandler handler)
public void Decode(ReadOnlySpan<byte> headerBlock, bool endHeaders, IHttpHeadersHandler handler)
{
foreach (byte b in headerBlock)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,9 @@ private async ValueTask ReadHeadersAsync(long headersLength, CancellationToken c
}

int processLength = (int)Math.Min(headersLength, _recvBuffer.ActiveLength);
bool endHeaders = headersLength == processLength;

_headerDecoder.Decode(_recvBuffer.ActiveSpan.Slice(0, processLength), this);
_headerDecoder.Decode(_recvBuffer.ActiveSpan.Slice(0, processLength), endHeaders, this);
_recvBuffer.Discard(processLength);
headersLength -= processLength;
}
Expand Down

0 comments on commit b256b43

Please sign in to comment.