Пример #1
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.Transport.Output,
                context.StreamContext,
                context.TimeoutControl,
                httpLimits.MinResponseDataRate,
                context.ConnectionId,
                context.MemoryPool,
                context.ServiceContext.Log,
                _streamIdFeature,
                context.ClientPeerSettings,
                this);
        }
Пример #2
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);
        }
Пример #3
0
        //private int _unflushedBytes;

        public Http3FrameWriter(PipeWriter output, ConnectionContext connectionContext, ITimeoutControl timeoutControl, MinDataRate?minResponseDataRate, string connectionId, MemoryPool <byte> memoryPool, IKestrelTrace log, IStreamIdFeature streamIdFeature, Http3PeerSettings clientPeerSettings, IHttp3Stream http3Stream)
        {
            _outputWriter        = output;
            _connectionContext   = connectionContext;
            _timeoutControl      = timeoutControl;
            _minResponseDataRate = minResponseDataRate;
            _connectionId        = connectionId;
            _memoryPool          = memoryPool;
            _log                  = log;
            _streamIdFeature      = streamIdFeature;
            _http3Stream          = http3Stream;
            _outgoingFrame        = new Http3RawFrame();
            _flusher              = new TimingPipeFlusher(_outputWriter, timeoutControl, log);
            _headerEncodingBuffer = new byte[_maxFrameSize];

            // Note that max total header size value doesn't react to settings change during a stream.
            // Unlikely to be a problem in practice:
            // - Settings rarely change after the start of a connection.
            // - Response header size limits are a best-effort requirement in the spec.
            _maxTotalHeaderSize = clientPeerSettings.MaxRequestHeaderFieldSectionSize > int.MaxValue
                ? int.MaxValue
                : (int)clientPeerSettings.MaxRequestHeaderFieldSectionSize;
        }
Пример #4
0
        //private int _unflushedBytes;

        public Http3FrameWriter(PipeWriter output, ConnectionContext connectionContext, ITimeoutControl timeoutControl, MinDataRate?minResponseDataRate, string connectionId, MemoryPool <byte> memoryPool, IKestrelTrace log, IStreamIdFeature streamIdFeature)
        {
            _outputWriter        = output;
            _connectionContext   = connectionContext;
            _timeoutControl      = timeoutControl;
            _minResponseDataRate = minResponseDataRate;
            _connectionId        = connectionId;
            _memoryPool          = memoryPool;
            _log                  = log;
            _streamIdFeature      = streamIdFeature;
            _outgoingFrame        = new Http3RawFrame();
            _flusher              = new TimingPipeFlusher(_outputWriter, timeoutControl, log);
            _headerEncodingBuffer = new byte[_maxFrameSize];
        }