Skip to content

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

Open
@MihaZupan

Description

@MihaZupan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestrel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions