Description
openedon Nov 8, 2022
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When serving a ASP.NET 6 MVC application using HTTP Trailers from IIS on Windows Server 2022 and accessing the application using FireFox on Windows (version 106.0.5), the responses are getting truncated.
Running in Visual Studio, served with Kestrel, and accessed via FireFox shows the trailers ("Server-Timing").
Expected Behavior
The response content should not get truncated, and the Server-Timing information should be available in the browser dev tools.
Steps To Reproduce
See https://github.com/eajhnsn1/net6-trailers-problem
OR
- Create a new ASP.NET 6 MVC application
- Add the following middleware function to the pipeline:
app.Use(async (context, next) =>
{
if (AllowsTrailers(context.Request) && context.Response.SupportsTrailers())
{
// Declare that there will be a trailer after the response body.
context.Response.DeclareTrailer("Server-Timing");
// Continue
await next(context);
// Output trailer
context.Response.AppendTrailer(
"Server-Timing",
"total;dur=123.4");
}
else
{
await next(context);
}
static bool AllowsTrailers(HttpRequest request)
{
return request.Headers.ContainsKey("TE") &&
request.Headers["TE"].Contains("trailers");
}
});
- Serve the application from IIS on Windows Server 2022 (with HTTP/2 support), access it with Firefox
The page will load without correct styling, because the response content is truncated. The out-of-the-box sample application (for me) ends up missing a single character in the response (the last > on the html closing tag). In a real application, only the first portion of the response is actually downloaded. Confirm with View Page Source. If you add HTML content to the views in the sample page, more content gets truncated.
Exceptions (if any)
No response
.NET Version
6.0.402
Anything else?
See https://github.com/eajhnsn1/net6-trailers-problem/blob/main/Program.cs