Repository navigation
Disallow synchronous IIS response flushes - #68763
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates IIS in-process response flushing to honor IHttpBodyControlFeature.AllowSynchronousIO, bringing Stream.Flush() in line with existing synchronous write behavior and the repo’s “sync IO disabled by default” policy.
Changes:
- Add an
AllowSynchronousIOguard toHttpResponseStream.Flush()while keepingFlushAsync()behavior unchanged. - Add a new stream-level regression test covering sync flush when disallowed.
- Extend IIS in-process tests to cover sync flush both when disallowed by default and when explicitly enabled per-request.
Show a summary per file
| File | Description |
|---|---|
| src/Servers/IIS/IIS/src/Core/HttpResponseStream.cs | Adds the AllowSynchronousIO check to Flush() before executing the synchronous flush path. |
| src/Servers/IIS/IIS/test/IIS.Tests/HttpResponseStreamTests.cs | Introduces a regression test asserting Flush() throws when sync IO is disabled. |
| src/Servers/IIS/IIS/test/IIS.Tests/HttpBodyControlFeatureTests.cs | Expands IIS in-process coverage to validate sync Flush() is blocked by default and permitted when opted in. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot App <[email protected]>
Youssef1313
approved these changes
Aug 25, 2026
BrennanConroy
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disallow synchronous IIS response flushes
Honor AllowSynchronousIO when flushing IIS responses
Description
IIS
HttpResponseStream.Flush()did not checkIHttpBodyControlFeature.AllowSynchronousIO, even though synchronous writes do and the behavior described in #7644 includesStream.Flush.This adds the same guard used by
Write(), preservingFlushAsync()and explicit per-request opt-in behavior.HttpUpgradeStream.Flush()delegates toHttpResponseStream.Flush(), so upgraded connections inherit the check without a duplicate guard. Stream-level regression tests cover both direct and upgraded response streams, and IIS in-process tests cover the default disallowed setting and opt-in behavior.Related to #7644