Repository: dotnet/aspnetcore
File: src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs (C#)

Code before:
        {
            var message = CoreStrings.FormatHttp3StreamErrorFrameReceivedAfterTrailers(Http3Formatting.ToFormattedType(Http3FrameType.Data));
            throw new Http3ConnectionErrorException(message, Http3ErrorCode.UnexpectedFrame, ConnectionEndReason.UnexpectedFrame);
        }

        if (InputRemaining.HasValue)
        {
            // https://tools.ietf.org/html/rfc7540#section-8.1.2.6
            if (payload.Length > InputRemaining.Value)
            {
                throw new Http3StreamErrorException(CoreStrings.Http3StreamErrorMoreDataThanLength, Http3ErrorCode.ProtocolError);
            }

            InputRemaining -= payload.Length;
        }

        lock (_completionLock)
        {
            if (IsAborted || IsAbortedRead)
            {
                return Task.CompletedTask;
            }
            _requestBodyStarted = true;
            foreach (var segment in payload)
            {
                RequestBodyPipe.Writer.Write(segment.Span);
            }

            return RequestBodyPipe.Writer.FlushAsync().GetAsTask();
        }
    }

    protected override void OnReset()
    {
        _keepAlive = true;
        _connectionAborted = false;
        _userTrailers = null;
        _isWebTransportSessionAccepted = false;
        _isMethodConnect = false;

        // Reset Http3 Features
        _currentIHttpMinRequestBodyDataRateFeature = this;
        _currentIHttpResponseTrailersFeature = this;
        _currentIHttpResetFeature = this;
    }

    protected override void ApplicationAbort() => ApplicationAbort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByApplication), Http3ErrorCode.InternalError);

    private void ApplicationAbort(ConnectionAbortedException abortReason, Http3ErrorCode error)
    {
        Abort(abortReason, error);

Review comment (suggestion):
```suggestion

            _requestBodyStarted = true;

```

Code after:
        // https://quicwg.org/base-drafts/draft-ietf-quic-http.html#section-4.1
        if (_requestHeaderParsingState == RequestHeaderParsingState.Trailers)
        {
            var message = CoreStrings.FormatHttp3StreamErrorFrameReceivedAfterTrailers(Http3Formatting.ToFormattedType(Http3FrameType.Data));
            throw new Http3ConnectionErrorException(message, Http3ErrorCode.UnexpectedFrame, ConnectionEndReason.UnexpectedFrame);
        }

        if (InputRemaining.HasValue)
        {
            // https://tools.ietf.org/html/rfc7540#section-8.1.2.6
            if (payload.Length > InputRemaining.Value)
            {
                throw new Http3StreamErrorException(CoreStrings.Http3StreamErrorMoreDataThanLength, Http3ErrorCode.ProtocolError);
            }

            InputRemaining -= payload.Length;
        }

        lock (_completionLock)
        {
            if (IsAborted || IsAbortedRead)
            {
                return Task.CompletedTask;
            }

            _requestBodyStarted = true;

            foreach (var segment in payload)
            {
                RequestBodyPipe.Writer.Write(segment.Span);
            }

            return RequestBodyPipe.Writer.FlushAsync().GetAsTask();
        }
    }

    protected override void OnReset()
    {
        _keepAlive = true;
        _connectionAborted = false;
        _userTrailers = null;
        _isWebTransportSessionAccepted = false;
        _isMethodConnect = false;

        // Reset Http3 Features
        _currentIHttpMinRequestBodyDataRateFeature = this;
        _currentIHttpResponseTrailersFeature = this;
        _currentIHttpResetFeature = this;
    }

    protected override void ApplicationAbort() => ApplicationAbort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByApplication), Http3ErrorCode.InternalError);