Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
RE: dotnet/yarp#1665
YARP now uses a zero-byte read optimization when copying the request body. Http.Sys's request body stream throws an argument exception when passed a zero length buffer.
Expected Behavior
The request body stream should allow zero length buffer, wait until data is available, and then return.
Steps To Reproduce
No response
Exceptions (if any)
Error Message: (Parameter 'size') Actual value was 0.
CallStack:
at Microsoft.AspNetCore.Server.HttpSys.RequestStream.ValidateReadBuffer(Byte[] buffer, Int32 offset, Int32 size)
at Microsoft.AspNetCore.Server.HttpSys.RequestStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 size, CancellationToken cancellationToken)
at System.IO.Stream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
at Yarp.ReverseProxy.Forwarder.StreamCopier.d__3.MoveNext() in D:GItRepo\reverse-proxy\src\ReverseProxy\Forwarder\StreamCopier.cs:line 53
.NET Version
6.0
Anything else?
Recommended servicing in 6.0.