Ejemplo n.º 1
0
        public Http3Stream(Http3StreamContext context)
        {
            Initialize(context);

            InputRemaining = null;

            _context = context;

            _errorCodeFeature = _context.ConnectionFeatures.Get <IProtocolErrorCodeFeature>() !;
            _streamIdFeature  = _context.ConnectionFeatures.Get <IStreamIdFeature>() !;

            _frameWriter = new Http3FrameWriter(
                context.Transport.Output,
                context.StreamContext,
                context.TimeoutControl,
                context.ServiceContext.ServerOptions.Limits.MinResponseDataRate,
                context.ConnectionId,
                context.MemoryPool,
                context.ServiceContext.Log,
                _streamIdFeature,
                context.ClientPeerSettings,
                this);

            // ResponseHeaders aren't set, kind of ugly that we need to reset.
            Reset();

            _http3Output = new Http3OutputProducer(
                _frameWriter,
                context.MemoryPool,
                this,
                context.ServiceContext.Log);
            RequestBodyPipe = CreateRequestBodyPipe(64 * 1024); // windowSize?
            Output          = _http3Output;
            QPackDecoder    = new QPackDecoder(_context.ServiceContext.ServerOptions.Limits.Http3.MaxRequestHeaderFieldSize);
        }
Ejemplo n.º 2
0
        public Http3Stream(Http3Connection http3Connection, HttpConnectionContext context) : base(context)
        {
            // First, determine how we know if an Http3stream is unidirectional or bidirectional
            var httpLimits  = context.ServiceContext.ServerOptions.Limits;
            var http3Limits = httpLimits.Http3;

            _http3Connection = http3Connection;
            _context         = context;

            _frameWriter = new Http3FrameWriter(
                context.Transport.Output,
                context.ConnectionContext,
                context.TimeoutControl,
                httpLimits.MinResponseDataRate,
                context.ConnectionId,
                context.MemoryPool,
                context.ServiceContext.Log);

            // ResponseHeaders aren't set, kind of ugly that we need to reset.
            Reset();

            _http3Output = new Http3OutputProducer(
                0, // TODO streamid
                _frameWriter,
                context.MemoryPool,
                this,
                context.ServiceContext.Log);
            RequestBodyPipe = CreateRequestBodyPipe(64 * 1024); // windowSize?
            Output          = _http3Output;
        }
Ejemplo n.º 3
0
        public void Initialize(Http3StreamContext context)
        {
            base.Initialize(context);

            InputRemaining = null;

            _context = context;

            _errorCodeFeature   = _context.ConnectionFeatures.Get <IProtocolErrorCodeFeature>() !;
            _streamIdFeature    = _context.ConnectionFeatures.Get <IStreamIdFeature>() !;
            _streamAbortFeature = _context.ConnectionFeatures.Get <IStreamAbortFeature>() !;

            _appCompleted = null;
            _isClosed     = 0;
            _requestHeaderParsingState = default;
            _parsedPseudoHeaderFields  = default;
            _totalParsedHeaderSize     = 0;
            _isMethodConnect           = false;
            _completionState           = default;
            StreamTimeoutTicks         = 0;

            if (_frameWriter == null)
            {
                _frameWriter = new Http3FrameWriter(
                    context.StreamContext,
                    context.TimeoutControl,
                    context.ServiceContext.ServerOptions.Limits.MinResponseDataRate,
                    context.MemoryPool,
                    context.ServiceContext.Log,
                    _streamIdFeature,
                    context.ClientPeerSettings,
                    this);

                _http3Output = new Http3OutputProducer(
                    _frameWriter,
                    context.MemoryPool,
                    this,
                    context.ServiceContext.Log);
                Output          = _http3Output;
                RequestBodyPipe = CreateRequestBodyPipe(64 * 1024); // windowSize?
                QPackDecoder    = new QPackDecoder(_context.ServiceContext.ServerOptions.Limits.Http3.MaxRequestHeaderFieldSize);
            }
            else
            {
                _http3Output.StreamReset();
                RequestBodyPipe.Reset();
                QPackDecoder.Reset();
            }

            _frameWriter.Reset(context.Transport.Output, context.ConnectionId);
        }
Ejemplo n.º 4
0
        public Http3ControlStream(Http3Connection http3Connection, HttpConnectionContext context)
        {
            var httpLimits = context.ServiceContext.ServerOptions.Limits;

            _http3Connection = http3Connection;
            _context         = context;

            _frameWriter = new Http3FrameWriter(
                context.Transport.Output,
                context.ConnectionContext,
                context.TimeoutControl,
                httpLimits.MinResponseDataRate,
                context.ConnectionId,
                context.MemoryPool,
                context.ServiceContext.Log);
        }
Ejemplo n.º 5
0
        public Http3OutputProducer(
            Http3FrameWriter frameWriter,
            MemoryPool <byte> pool,
            Http3Stream stream,
            IKestrelTrace log)
        {
            _frameWriter = frameWriter;
            _memoryPool  = pool;
            _stream      = stream;
            _log         = log;

            var pipe = CreateDataPipe(pool);

            _pipeWriter = pipe.Writer;
            _pipeReader = pipe.Reader;

            _flusher = new TimingPipeFlusher(_pipeWriter, timeoutControl: null, log);
            _dataWriteProcessingTask = ProcessDataWrites();
        }
Ejemplo n.º 6
0
        public Http3ControlStream(Http3Connection http3Connection, Http3StreamContext context)
        {
            var httpLimits = context.ServiceContext.ServerOptions.Limits;

            _http3Connection    = http3Connection;
            _context            = context;
            _serverPeerSettings = context.ServerSettings;
            _streamIdFeature    = context.ConnectionFeatures.Get <IStreamIdFeature>() !;

            _frameWriter = new Http3FrameWriter(
                context.Transport.Output,
                context.StreamContext,
                context.TimeoutControl,
                httpLimits.MinResponseDataRate,
                context.ConnectionId,
                context.MemoryPool,
                context.ServiceContext.Log,
                _streamIdFeature);
        }
Ejemplo n.º 7
0
        public Http3ControlStream(Http3StreamContext context)
        {
            var httpLimits = context.ServiceContext.ServerOptions.Limits;

            _context            = context;
            _serverPeerSettings = context.ServerPeerSettings;
            _streamIdFeature    = context.ConnectionFeatures.Get <IStreamIdFeature>() !;
            _errorCodeFeature   = context.ConnectionFeatures.Get <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);
        }
Ejemplo n.º 8
0
        public Http3Stream(Http3Connection http3Connection, Http3StreamContext context)
        {
            Initialize(context);

            InputRemaining = null;

            // First, determine how we know if an Http3stream is unidirectional or bidirectional
            var httpLimits  = context.ServiceContext.ServerOptions.Limits;
            var http3Limits = httpLimits.Http3;

            _http3Connection = http3Connection;
            _context         = context;

            _errorCodeFeature = _context.ConnectionFeatures.Get <IProtocolErrorCodeFeature>() !;
            _streamIdFeature  = _context.ConnectionFeatures.Get <IStreamIdFeature>() !;

            _frameWriter = new Http3FrameWriter(
                context.Transport.Output,
                context.StreamContext,
                context.TimeoutControl,
                httpLimits.MinResponseDataRate,
                context.ConnectionId,
                context.MemoryPool,
                context.ServiceContext.Log,
                _streamIdFeature);

            // ResponseHeaders aren't set, kind of ugly that we need to reset.
            Reset();

            _http3Output = new Http3OutputProducer(
                _frameWriter,
                context.MemoryPool,
                this,
                context.ServiceContext.Log);
            RequestBodyPipe = CreateRequestBodyPipe(64 * 1024); // windowSize?
            Output          = _http3Output;
            QPackDecoder    = new QPackDecoder(_context.ServiceContext.ServerOptions.Limits.Http3.MaxRequestHeaderFieldSize);
        }