aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

`IHttpRequestBodyDetectionFeature` for HTTP/3 GET requests

Open ladeak opened this issue 5 months ago • 3 comments

IHttpRequestBodyDetectionFeature for HTTP/3 GET requests

IHttpRequestBodyDetectionFeature returns false for HTTP/3 (bodyless) GET requests

Description

  • Implementation follows the HTTP/2 structure.
  • Updated IHttpRequestBodyDetectionFeature to include HTTP/3 descriptions for the END_STREAM flag.
  • In Http3Stream modified request body handling logic to return zero length content body instance when there endstream flag is set. It also completes the message body for empty requests, so that the RequestBodyPipe.Reader is closed (needs to be closed, so that when the stream is reused by the pool, the Pipe is reset which requires closed reader) - not sure if this is the best place to do this.
  • Added unit test CanHaveBody_ReturnsFalseWithoutRequestBody to validate behavior when no request body is present.

Fixes #58753

ladeak avatar Jun 07 '25 07:06 ladeak

It also completes the message body for empty requests, so that the RequestBodyPipe.Reader is closed (needs to be closed, so that when the stream is reused by the pool, the Pipe is reset which requires closed reader) - not sure if this is the best place to do this.

Http2Stream doesn't do this. It relies on the calling code the cleanup the MessageBody. Is there a reason this is different from the Http2Stream impl?

BrennanConroy avatar Jun 10 '25 00:06 BrennanConroy

@BrennanConroy - I will follow up on that.

ladeak avatar Jun 10 '25 06:06 ladeak

@BrennanConroy I addressed your concern.

ladeak avatar Jun 14 '25 14:06 ladeak

@BrennanConroy could you review the changes?

ladeak avatar Jul 01 '25 06:07 ladeak