Skip to content

Commit aa30ae7

Browse files
committed
Revert "IHttpRequestBodyDetectionFeature for HTTP/3 GET requests (#62275)"
This reverts commit fb4bb02.
1 parent fb4bb02 commit aa30ae7

File tree

3 files changed

+0
-53
lines changed

3 files changed

+0
-53
lines changed

src/Http/Http.Features/src/IHttpRequestBodyDetectionFeature.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public interface IHttpRequestBodyDetectionFeature
2020
/// <item><description>
2121
/// It's an HTTP/2 request that did not set the END_STREAM flag on the initial headers frame.
2222
/// </description></item>
23-
/// <item><description>
24-
/// It's an HTTP/3 request that did not set the END_STREAM flag on the initial headers frame.
25-
/// </description></item>
2623
/// </list>
2724
/// The final request body length may still be zero for the chunked or HTTP/2 scenarios.
2825
/// <para>
@@ -38,9 +35,6 @@ public interface IHttpRequestBodyDetectionFeature
3835
/// <item><description>
3936
/// It's an HTTP/2 request that set END_STREAM on the initial headers frame.
4037
/// </description></item>
41-
/// <item><description>
42-
/// It's an HTTP/3 request that set END_STREAM on the initial headers frame.
43-
/// </description></item>
4438
/// </list>
4539
/// </para>
4640
/// When false, the request body should never return data.

src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ internal abstract partial class Http3Stream : HttpProtocol, IHttp3Stream, IHttpS
5454
private bool _isMethodConnect;
5555
private bool _isWebTransportSessionAccepted;
5656
private Http3MessageBody? _messageBody;
57-
private bool _requestBodyStarted;
5857

5958
private readonly ManualResetValueTaskSource<object?> _appCompletedTaskSource = new();
6059
private readonly Lock _completionLock = new();
@@ -66,17 +65,6 @@ internal abstract partial class Http3Stream : HttpProtocol, IHttp3Stream, IHttpS
6665
private bool IsAbortedRead => (_completionState & StreamCompletionFlags.AbortedRead) == StreamCompletionFlags.AbortedRead;
6766
public bool IsCompleted => (_completionState & StreamCompletionFlags.Completed) == StreamCompletionFlags.Completed;
6867

69-
public bool ReceivedEmptyRequestBody
70-
{
71-
get
72-
{
73-
lock (_completionLock)
74-
{
75-
return EndStreamReceived && !_requestBodyStarted;
76-
}
77-
}
78-
}
79-
8068
public Pipe RequestBodyPipe { get; private set; } = default!;
8169
public long? InputRemaining { get; internal set; }
8270
public QPackDecoder QPackDecoder { get; private set; } = default!;
@@ -572,8 +560,6 @@ private void CompleteStream(bool errored)
572560
TryClose();
573561
}
574562

575-
RequestBodyPipe.Reader.Complete();
576-
577563
_http3Output.Complete();
578564

579565
// Stream will be pooled after app completed.
@@ -943,8 +929,6 @@ private Task ProcessDataFrameAsync(in ReadOnlySequence<byte> payload)
943929
return Task.CompletedTask;
944930
}
945931

946-
_requestBodyStarted = true;
947-
948932
foreach (var segment in payload)
949933
{
950934
RequestBodyPipe.Writer.Write(segment.Span);
@@ -982,11 +966,6 @@ protected override string CreateRequestId()
982966

983967
protected override MessageBody CreateMessageBody()
984968
{
985-
if (ReceivedEmptyRequestBody)
986-
{
987-
return MessageBody.ZeroContentLengthClose;
988-
}
989-
990969
if (_messageBody != null)
991970
{
992971
_messageBody.Reset();

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,32 +3291,6 @@ public async Task Control_FrameParsingSingleByteAtATimeWorks()
32913291
await outboundcontrolStream.ReceiveEndAsync();
32923292
}
32933293

3294-
[Theory]
3295-
[InlineData(true)]
3296-
[InlineData(false)]
3297-
public async Task CanHaveBody_ReturnsFalseWithoutRequestBody(bool endstream)
3298-
{
3299-
var headers = new[]
3300-
{
3301-
new KeyValuePair<string, string>(InternalHeaderNames.Method, "GET"),
3302-
new KeyValuePair<string, string>(InternalHeaderNames.Path, "/"),
3303-
new KeyValuePair<string, string>(InternalHeaderNames.Scheme, "http"),
3304-
new KeyValuePair<string, string>(InternalHeaderNames.Authority, "localhost:80"),
3305-
};
3306-
3307-
var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context =>
3308-
{
3309-
Assert.NotEqual(endstream, context.Features.Get<IHttpRequestBodyDetectionFeature>().CanHaveBody);
3310-
context.Response.StatusCode = 200;
3311-
return Task.CompletedTask;
3312-
}, headers, endStream: endstream);
3313-
3314-
var responseHeaders = await requestStream.ExpectHeadersAsync();
3315-
Assert.Equal("200", responseHeaders[InternalHeaderNames.Status]);
3316-
3317-
await requestStream.ExpectReceiveEndOfStream();
3318-
}
3319-
33203294
private async Task WriteOneByteAtATime(PipeReader reader, PipeWriter writer)
33213295
{
33223296
var res = await reader.ReadAsync();

0 commit comments

Comments
 (0)