The 0-byte read should not throw and subsequent reads should return available data.
Steps To Reproduce
See yarp.zip (repro attached in the original Yarp issue)
Exceptions (if any)
Yarp.ReverseProxy.Forwarder.HttpForwarder[48]
ResponseBodyDestination: The destination reported an error when copying the response body.
System.ArgumentOutOfRangeException: (Parameter 'count')
Actual value was 0.
at Microsoft.AspNetCore.TestHost.ResponseBodyReaderStream.VerifyBuffer(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.AspNetCore.TestHost.ResponseBodyReaderStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Yarp.ReverseProxy.Forwarder.StreamCopier.CopyAsync(Stream input, Stream output, Int64 promisedContentLength, StreamCopierTelemetry telemetry, ActivityCancellationTokenSource activityToken, CancellationToken cancellation)
Is there an existing issue for this?
Describe the bug
Similar to #41287 and #41305, TestHost also doesn't expect/support 0-byte reads on the body.
aspnetcore/src/Hosting/TestHost/src/ResponseBodyReaderStream.cs
Lines 118 to 121 in 3888fda
Expected Behavior
The 0-byte read should not throw and subsequent reads should return available data.
Steps To Reproduce
See yarp.zip (repro attached in the original Yarp issue)
Exceptions (if any)
.NET Version
6.0.5
Anything else?
Discovered by a user writing unit tests that include Yarp microsoft/reverse-proxy#1720
cc: @Tratcher @adityamandaleeka
There kind of failures can be caught by StreamConformanceTests we run in runtime.
For example, here are 0-byte read tests for HttpClient response streams.
Are there any plans to include such tests in AspNetCore?
The text was updated successfully, but these errors were encountered: