Beispiel #1
0
    public Http3ControlStream(Http3StreamContext context)
    {
        var httpLimits = context.ServiceContext.ServerOptions.Limits;

        _context            = context;
        _serverPeerSettings = context.ServerPeerSettings;
        _streamIdFeature    = context.ConnectionFeatures.GetRequiredFeature <IStreamIdFeature>();
        _errorCodeFeature   = context.ConnectionFeatures.GetRequiredFeature <IProtocolErrorCodeFeature>();
        _headerType         = -1;

        _frameWriter = new Http3FrameWriter(
            context.StreamContext,
            context.TimeoutControl,
            httpLimits.MinResponseDataRate,
            context.MemoryPool,
            context.ServiceContext.Log,
            _streamIdFeature,
            context.ClientPeerSettings,
            this);
        _frameWriter.Reset(context.Transport.Output, context.ConnectionId);
    }
Beispiel #2
0
    private Http3StreamContext CreateHttpStreamContext(ConnectionContext streamContext)
    {
        var httpConnectionContext = new Http3StreamContext(
            _multiplexedContext.ConnectionId,
            HttpProtocols.Http3,
            _context.AltSvcHeader,
            _multiplexedContext,
            _context.ServiceContext,
            streamContext.Features,
            _context.MemoryPool,
            streamContext.LocalEndPoint as IPEndPoint,
            streamContext.RemoteEndPoint as IPEndPoint,
            _streamLifetimeHandler,
            streamContext,
            _clientSettings,
            _serverSettings);

        httpConnectionContext.TimeoutControl = _context.TimeoutControl;
        httpConnectionContext.Transport      = streamContext.Transport;

        return(httpConnectionContext);
    }
Beispiel #3
0
 public Http3ControlStream(IHttpApplication <TContext> application, Http3StreamContext context) : base(context)
 {
     _application = application;
 }
Beispiel #4
0
 public Http3Stream(IHttpApplication <TContext> application, Http3StreamContext context)
 {
     Initialize(context);
     _application = application;
 }
 public TestHttp3Stream(Http3Connection connection, Http3StreamContext context) : base(connection, context)
 {
 }
Beispiel #6
0
 public TestHttp3Stream(Http3StreamContext context) : base(context)
 {
 }
Beispiel #7
0
    public async ValueTask <long> ReadNextStreamHeaderAsync(Http3StreamContext context, long streamId, Http3StreamType?advanceOn)
    {
        var Input   = context.Transport.Input;
        var advance = false;
        SequencePosition consumed = default;
        SequencePosition start    = default;

        try
        {
            while (!_isClosed)
            {
                var result = await Input.ReadAsync();

                if (result.IsCanceled)
                {
                    throw new Exception();
                }

                var readableBuffer = result.Buffer;
                consumed = readableBuffer.Start;
                start    = readableBuffer.Start;

                if (!readableBuffer.IsEmpty)
                {
                    var value = VariableLengthIntegerHelper.GetInteger(readableBuffer, out consumed, out _);
                    if (value != -1)
                    {
                        if (!advanceOn.HasValue || value == (long)advanceOn)
                        {
                            advance = true;
                        }
                        return(value);
                    }
                }

                if (result.IsCompleted)
                {
                    return(-1L);
                }
            }
        }
        catch (Exception)
        {
            throw new Http3PendingStreamException(CoreStrings.AttemptedToReadHeaderOnAbortedStream, streamId, _abortedException);
        }
        finally
        {
            if (!_isClosed)
            {
                if (advance)
                {
                    Input.AdvanceTo(consumed);
                }
                else
                {
                    Input.AdvanceTo(start);
                }
            }

            StreamTimeoutTicks = default;
        }

        return(-1L);
    }
Beispiel #8
0
 public Http3PendingStream(Http3StreamContext context, long id)
 {
     Context            = context;
     StreamTimeoutTicks = default;
     StreamId           = id;
 }
 public Http3ControlStream(IHttpApplication <TContext> application, Http3StreamContext context, long?headerType) : base(context, headerType)
 {
     _application = application;
 }