-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Milestone
Description
Describe the bug
New Write/WriteLine/WriteAsync/WriteLineAsync ReadOnlySpan/ReadOnlyMemory overloads
in HttpResponseStreamWriter.cs will not write all data if the data exceeds internal buffer.
See code from pull request (#18451) with my comments:
public override void Write(ReadOnlySpan<char> value)
{
if (_disposed)
{
throw new ObjectDisposedException(nameof(HttpResponseStreamWriter));
}
var written = 0;
while (written < value.Length)
{
if (_charBufferCount == _charBufferSize)
{
FlushInternal(flushEncoder: false);
}
written = CopyToCharBuffer(value);
if (written < value.Length)
{
value = value.Slice(written);
// if "written" >= value.Length
// then we will exit loop and last chunk will not be copied
// to fix this we should reset "written" after each Slice
}
};
}
The same problem exists in WriteAsyncAwaited(ReadOnlyMemory value)
To Reproduce
Further technical details
- ASP.NET Core version
Metadata
Metadata
Assignees
Labels
area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.