-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetFromJsonAsAsyncEnumerable
not working when using custom httpHanlder with compression
#102113
Comments
What server are you connecting to? Are you certain the server is putting the data on the wire as quickly as you expect? Do you have an endpoint we can try or a repro for the server side to match? |
@stephentoub thanks very much for the quick reply, I'm using the aspnet kestrel server, it could relate to the server response compression, working without the response compression I add a sample to reproduce it here |
When you return an object from the controller (in this case an When you're not using compression, the response body stream is Kestrel's HTTP/1.1 implementation where every write does an implicit flush. But if you add other stream implementations in the middle, they might buffer some data unless you call flush. Compression streams are like that, where you must manually flush them if you want "live" data. You can change your example to call app.UseResponseCompression();
app.Use((context, next) =>
{
context.Features.Get<IHttpResponseBodyFeature>()?.DisableBuffering();
return next();
}); |
@MihaZupan working with it, thanks very much |
When the HttpClient with |
Description
Trying to produce server stream response, happen to find that when I use
AutomaticDecompression
option, the response is different when not using the optionwhen using the
AutomaticDecompression
option seemed the response is consumed at the end of the response, is this by design?Reproduction Steps
output
The server is producing three items with two seconds delay in between
Expected behavior
The response should remain the same behavior
Actual behavior
The response behavior differs
Regression?
No response
Known Workarounds
No response
Configuration
The sample app is targeted for
net8.0
dotnet --info
outputOther information
No response
The text was updated successfully, but these errors were encountered: