Skip to content

Commit d7bb7b8

Browse files
wtgodberokonecCopilot
authored
test(iis): scope upgrade MaxRequestBodySize assert to in-process hosting (#69326)
- in-process must clear the limit on upgrade because its read loop enforces it - out-of-process runs on Kestrel, which never enforces it once upgraded - unblocks the three WebSocketsOutOfProcessTests failures 🧪 - Generated by Copilot (cherry picked from commit befb2e9) Co-authored-by: Roman Konecny <rokonecn@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f036233 commit d7bb7b8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ private static async Task<WebSocket> Upgrade(HttpContext context)
153153

154154
// Upgrade the connection
155155
Stream opaqueTransport = await upgradeFeature.UpgradeAsync();
156-
Assert.Null(context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize);
156+
157+
// In-process reads upgraded data through the same loop that enforces MaxRequestBodySize, so it
158+
// must clear the limit. Out-of-process runs on Kestrel, which never enforces it once upgraded.
159+
if (context.Features.Get<IServerVariablesFeature>() is not null)
160+
{
161+
Assert.Null(context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize);
162+
}
157163

158164
// Get the WebSocket object
159165
var ws = WebSocket.CreateFromStream(opaqueTransport, isServer: true, subProtocol: null, keepAliveInterval: TimeSpan.FromMinutes(2));

0 commit comments

Comments
 (0)