aspnet / BasicMiddleware

[Archived] Basic middleware components for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
169 stars 84 forks source link

ResponseBuffering middleware #6

Closed Tratcher closed 9 years ago

Tratcher commented 9 years ago

https://github.com/aspnet/Hosting/issues/299

This PR seeks to formalize the discussion from https://github.com/aspnet/HttpAbstractions/wiki/Rolling-Notes about how response buffering components should behave. In this case we've implemented a fully buffered response. Buffering is disabled via a feature interface or by calling Flush.

The one notable departure from the notes is that we use Stream.SetLength to truncate/reset the buffer, where Position is just used to move around your write marker.

@davidfowl @lodejard @Eilon

dnfclas commented 9 years ago

Hi @Tratcher, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

Eilon commented 9 years ago

Just some fairly small comments, the code overall looks good. I like the new unit tests.

Tratcher commented 9 years ago

Open question: Should there be a (configurable) limit on how much data to buffer before disabling buffering and flushing?

Tratcher commented 9 years ago

Updated

Eilon commented 9 years ago

Looks :shipit: to me.

kichalla commented 9 years ago

:shipit:

Tratcher commented 9 years ago

@davidfowl @lodejard waiting on an explicit sign-off to confirm the design concepts.

Tratcher commented 9 years ago

Updated with Louis's feedback about preventing random access to the buffer. Added a sample.

Tratcher commented 9 years ago

@lodejard