azzlack / Microsoft.AspNet.WebApi.MessageHandlers.Compression

Drop-in module for ASP.Net WebAPI that enables GZip and Deflate support
Apache License 2.0
194 stars 54 forks source link

Response.Content of type PushStreamContent problem #57

Closed marcocenzato closed 2 years ago

marcocenzato commented 6 years ago

I'm using a specialized Response.Content of type PushStreamContent to stream content in chunks to client for long-running operations with client progress advance using pairs of stream.WriteAsync() and stream.Flush() (Transfer-Encoding: chunked). To keep controller working, I've to mark it with [Compression(Enabled = false)] attribute: I suppose the compression filter read all the buffer to compress it invalidating my chunk trasmission. Do you think is it possibile to test the type of Content and automatically disable compression if of type PushStreamContent or (better if possibile) test the property .buffered of the response stream? Obviously this is not a big issue (I can mark my controllers with [Compression(Enabled = false)]) but it'll be very nice to have all automatically detected and managed. Thanks