Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IHttpRequestBodyDetectionFeature returns true for GET requests with HTTP/3 #58753

Open
1 task done
MihaZupan opened this issue Nov 2, 2024 · 0 comments
Open
1 task done
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel

Comments

@MihaZupan
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Unlike with HTTP/2, the HTTP/3 implementation does not check for ReceivedEmptyRequestBody when creating the message body, which means the body detection feature returns true even for requests without one.

protected override MessageBody CreateMessageBody()
{
if (ReceivedEmptyRequestBody)
{
return MessageBody.ZeroContentLengthClose;
}
if (_messageBody != null)
{
_messageBody.Reset();
}
else
{
_messageBody = new Http2MessageBody(this);
}
return _messageBody;
}

protected override MessageBody CreateMessageBody()
{
if (_messageBody != null)
{
_messageBody.Reset();
}
else
{
_messageBody = new Http3MessageBody(this);
}
return _messageBody;
}

Expected Behavior

IHttpRequestBodyDetectionFeature returns false for requests where it's known from the start that there is no body.

Steps To Reproduce

  • Send an HTTP/3 GET request to Kestrel
  • Check IHttpRequestBodyDetectionFeature.CanHaveBody

Exceptions (if any)

N/A

.NET Version

No response

Anything else?

Hit in YARP when downgrading HTTP/3 requests to HTTP/1.1: dotnet/yarp#2644.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Nov 2, 2024
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 feature-kestrel
Projects
None yet
Development

No branches or pull requests

1 participant