Skip to content

Conversation

@BrennanConroy
Copy link
Member

Bug filed on http.sys team.

Copilot AI review requested due to automatic review settings January 7, 2026 04:28
@github-actions github-actions bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

string address;
using (Utilities.CreateHttpServer(out address, async httpContext =>
{
httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions a bug filed on the http.sys team and that this is a workaround, but there is no code comment, issue link, or documentation explaining what the http.sys bug is, why spaces in the Content-Length header value trigger it, or when this workaround can be removed. Consider adding a comment with a reference to the filed bug to help future maintainers understand why the spaces were removed.

Suggested change
httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
// This test intentionally uses a Content-Length value without any spaces.
// There is a filed http.sys bug where Content-Length values containing spaces
// can be parsed or handled incorrectly. The product code works around that bug
// by normalizing/removing spaces before sending the header. This test verifies
// that a clean Content-Length value is passed through unchanged by http.sys.
// When the underlying http.sys bug is fixed and the workaround removed, this
// test should be revisited to ensure behavior remains correct.

Copilot uses AI. Check for mistakes.
{
httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
httpContext.Response.Headers["Content-lenGth"] = " 30 ";
httpContext.Response.Headers["Content-lenGth"] = "30";
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workaround for the http.sys bug has been applied only to this test method, but other test methods in the same file (lines 239, 253, 268, and 289) still use Content-Length header values with leading and trailing spaces. If this is a workaround for an http.sys bug, it should be consistently applied to all test methods that set the Content-Length header, or there should be a comment explaining why only this specific test needs the workaround.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BrennanConroy Do we need to fix the other cases?

@adityamandaleeka
Copy link
Member

Nice catch. I assume we don't intend to change this back once the Windows issue is fixed.

@BrennanConroy
Copy link
Member Author

No, I don't think we need to be responsible for testing edge cases in http.sys.

@BrennanConroy
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@BrennanConroy BrennanConroy merged commit a0c8830 into main Jan 8, 2026
25 checks passed
@BrennanConroy BrennanConroy deleted the BrennanConroy-patch-5 branch January 8, 2026 21:58
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview1 milestone Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants