-
Notifications
You must be signed in to change notification settings - Fork 65
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
Fix the ability to disable buffering #509
Conversation
If buffering is turned on (either because using HttpModules or the endpoint metadata), it was broken to call `ctx.Features.GetRequired<IHttpResponseBodyFeature>().DisableBuffering()`. This fixes that.
@joperezr can I get a review here? |
There is a behavior mismatch.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
I found a bug here. Repro
Expected behaviorPlease consider to raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check this.
#509 (comment)
I've created #518 for this one, but in the future, can you create new issues for additional issues you find? This PR is focused on enabling the ability to disable buffering - by allowing that, we may find other issues, but let's get that in and deal with any follow up issues separately. |
@@ -16,13 +16,15 @@ namespace Microsoft.AspNetCore.SystemWebAdapters.Features; | |||
[Experimental(Constants.ExperimentalFeatures.DiagnosticId)] | |||
public interface IHttpResponseBufferingFeature | |||
{ | |||
void EnableBuffering(int memoryThreshold, long? bufferLimit); | |||
void EnableBuffering(int? memoryThreshold = default, long? bufferLimit = default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need the defaults and nullable changes here? Trying to see if we can avoid being binary breaking here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes it easier to just enable buffering when we want the default and the default value is currently in a different layer than I wanted to call it from.
This interface is intentionally marked as "Experimental" so we can break it as much as we need
|
||
ValueTask FlushAsync(); | ||
|
||
[AllowNull] | ||
Stream Filter { get; set; } | ||
|
||
void DisableBuffering(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this member to the interface is of course also a breaking change. Do we expect this to cause any issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: this interface is intentionally marked as "Experimental" so we can break it as much as we need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the two breaking change questions I have, changes look good to me.
If buffering is turned on (either because using HttpModules or the endpoint metadata), it was broken to call
ctx.Features.GetRequired<IHttpResponseBodyFeature>().DisableBuffering()
. This fixes that.Fixes #508