-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
If using Brotli compression in combination with disabling response buffering, plain text written to the response stream seems to not be encoded correctly.
To Reproduce
Project demonstrating problem:
https://github.com/jander-msft/repros/tree/main/CompressedUnbufferedResponse
Run net6.0 web project and navigate to /test route. It should return "Hello", but it returns a handful of unprintable characters with "Hello" in the middle of it.
Running the netcoreapp3.1 build output with the same steps works as expected.
netcoreapp3.1 response in hex: EF BB BF 48 65 6C 6C 6F 21 0A
net6.0 response in hex: 0B 01 80 EF BB BF 30 00 08 48 65 6C 6C 6F 21 0A 03
Note the extra 0B 01 80 prefix, the extra 30 00 08 after the BOM, and the extra 03 postfix.
Either removing the Brotli compression OR removing the disabling of the response buffering does fix the issue.
Further technical details
ASP.NET Core version: 6.0.0-rc.1.21451.13
dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.401
Commit: 4bef5f3dbf
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x86
Base Path: C:\Program Files (x86)\dotnet\sdk\5.0.401\
Host (useful for support):
Version: 6.0.0-rc.1.21451.13
Commit: d7619cd4b1
.NET SDKs installed:
3.1.413 [C:\Program Files (x86)\dotnet\sdk]
5.0.401 [C:\Program Files (x86)\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.19 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.10 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.19 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.10 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]