diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs index d9b27dfbbf..1fe8107209 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/Http/PipelineExtensions.cs @@ -40,7 +40,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } finally { - pipelineReader.Advance(result.Buffer.Start, result.Buffer.Start); + pipelineReader.Advance(result.Buffer.Start, result.Buffer.IsEmpty + ? result.Buffer.End + : result.Buffer.Start); } input = pipelineReader.ReadAsync(); } @@ -68,7 +70,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } finally { - pipelineReader.Advance(result.Buffer.Start, result.Buffer.Start); + pipelineReader.Advance(result.Buffer.Start, result.Buffer.IsEmpty + ? result.Buffer.End + : result.Buffer.Start); } readingTask = pipelineReader.ReadAsync(); @@ -325,4 +329,4 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return bytes; } } -} \ No newline at end of file +}