Beispiel #1
0
        public Http2FrameWriter(
            PipeWriter outputPipeWriter,
            BaseConnectionContext connectionContext,
            Http2Connection http2Connection,
            OutputFlowControl connectionOutputFlowControl,
            ITimeoutControl timeoutControl,
            MinDataRate?minResponseDataRate,
            string connectionId,
            MemoryPool <byte> memoryPool,
            ServiceContext serviceContext)
        {
            // Allow appending more data to the PipeWriter when a flush is pending.
            _outputWriter                = new ConcurrentPipeWriter(outputPipeWriter, memoryPool, _writeLock);
            _connectionContext           = connectionContext;
            _http2Connection             = http2Connection;
            _connectionOutputFlowControl = connectionOutputFlowControl;
            _connectionId                = connectionId;
            _log                 = serviceContext.Log;
            _timeoutControl      = timeoutControl;
            _minResponseDataRate = minResponseDataRate;
            _flusher             = new TimingPipeFlusher(timeoutControl, serviceContext.Log);
            _flusher.Initialize(_outputWriter);
            _outgoingFrame        = new Http2Frame();
            _headerEncodingBuffer = new byte[_maxFrameSize];

            _scheduleInline = serviceContext.Scheduler == PipeScheduler.Inline;

            _hpackEncoder = new DynamicHPackEncoder(serviceContext.ServerOptions.AllowResponseHeaderCompression);
        }
Beispiel #2
0
        public Http2FrameWriter(
            PipeWriter outputPipeWriter,
            PipeReader outputPipeReader,
            OutputFlowControl connectionOutputFlowControl,
            ITimeoutControl timeoutControl)
        {
            _outputWriter = outputPipeWriter;
            _outputReader = outputPipeReader;

            _connectionOutputFlowControl = connectionOutputFlowControl;
            _flusher = new StreamSafePipeFlusher(_outputWriter, timeoutControl);
        }
Beispiel #3
0
 public Http2FrameWriter(
     ConnectionContext connectionContext,
     OutputFlowControl connectionOutputFlowControl,
     ILogger log)
 {
     // Allow appending more data to the PipeWriter when a flush is pending.
     _outputWriter                = connectionContext.Transport.Output;
     _connectionContext           = connectionContext;
     _connectionOutputFlowControl = connectionOutputFlowControl;
     _connectionId                = connectionContext.ConnectionId;
     _log                  = log;
     _outgoingFrame        = new Http2Frame();
     _headerEncodingBuffer = new byte[_maxFrameSize];
 }
 public Http2FrameWriter(
     PipeWriter outputPipeWriter,
     ConnectionContext connectionContext,
     OutputFlowControl connectionOutputFlowControl,
     ITimeoutControl timeoutControl,
     string connectionId,
     IKestrelTrace log)
 {
     _outputWriter                = outputPipeWriter;
     _connectionContext           = connectionContext;
     _connectionOutputFlowControl = connectionOutputFlowControl;
     _connectionId                = connectionId;
     _log     = log;
     _flusher = new StreamSafePipeFlusher(_outputWriter, timeoutControl);
 }
Beispiel #5
0
 public Http2StreamContext(
     string connectionId,
     HttpProtocols protocols,
     ServiceContext serviceContext,
     IFeatureCollection connectionFeatures,
     MemoryPool <byte> memoryPool,
     IPEndPoint?localEndPoint,
     IPEndPoint?remoteEndPoint,
     int streamId,
     IHttp2StreamLifetimeHandler streamLifetimeHandler,
     Http2PeerSettings clientPeerSettings,
     Http2PeerSettings serverPeerSettings,
     Http2FrameWriter frameWriter,
     InputFlowControl connectionInputFlowControl,
     OutputFlowControl connectionOutputFlowControl) : base(connectionId, protocols, connectionContext: null !, serviceContext, connectionFeatures, memoryPool, localEndPoint, remoteEndPoint, transport: null !)
Beispiel #6
0
 public Http2FrameWriter(
     PipeWriter outputPipeWriter,
     ConnectionContext connectionContext,
     OutputFlowControl connectionOutputFlowControl,
     ITimeoutControl timeoutControl,
     string connectionId,
     IKestrelTrace log)
 {
     _outputWriter                = outputPipeWriter;
     _connectionContext           = connectionContext;
     _connectionOutputFlowControl = connectionOutputFlowControl;
     _connectionId                = connectionId;
     _log                  = log;
     _flusher              = new TimingPipeFlusher(_outputWriter, timeoutControl);
     _outgoingFrame        = new Http2Frame();
     _headerEncodingBuffer = new byte[_maxFrameSize];
 }
 public Http2FrameWriter(
     PipeWriter outputPipeWriter,
     ConnectionContext connectionContext,
     Http2Connection http2Connection,
     OutputFlowControl connectionOutputFlowControl,
     ITimeoutControl timeoutControl,
     MinDataRate minResponseDataRate,
     string connectionId,
     IKestrelTrace log)
 {
     _outputWriter                = outputPipeWriter;
     _connectionContext           = connectionContext;
     _http2Connection             = http2Connection;
     _connectionOutputFlowControl = connectionOutputFlowControl;
     _connectionId                = connectionId;
     _log                  = log;
     _timeoutControl       = timeoutControl;
     _minResponseDataRate  = minResponseDataRate;
     _flusher              = new TimingPipeFlusher(_outputWriter, timeoutControl, log);
     _outgoingFrame        = new Http2Frame();
     _headerEncodingBuffer = new byte[_maxFrameSize];
 }
        public static Http2StreamContext CreateHttp2StreamContext(
            string connectionId                   = null,
            ServiceContext serviceContext         = null,
            IFeatureCollection connectionFeatures = null,
            MemoryPool <byte> memoryPool          = null,
            IPEndPoint localEndPoint              = null,
            IPEndPoint remoteEndPoint             = null,
            int?streamId = null,
            IHttp2StreamLifetimeHandler streamLifetimeHandler = null,
            Http2PeerSettings clientPeerSettings          = null,
            Http2PeerSettings serverPeerSettings          = null,
            Http2FrameWriter frameWriter                  = null,
            InputFlowControl connectionInputFlowControl   = null,
            OutputFlowControl connectionOutputFlowControl = null,
            ITimeoutControl timeoutControl                = null)
        {
            var context = new Http2StreamContext
                          (
                connectionId: connectionId ?? "TestConnectionId",
                protocols: HttpProtocols.Http2,
                altSvcHeader: null,
                serviceContext: serviceContext ?? CreateServiceContext(new KestrelServerOptions()),
                connectionFeatures: connectionFeatures ?? new FeatureCollection(),
                memoryPool: memoryPool ?? MemoryPool <byte> .Shared,
                localEndPoint: localEndPoint,
                remoteEndPoint: remoteEndPoint,
                streamId: streamId ?? 0,
                streamLifetimeHandler: streamLifetimeHandler,
                clientPeerSettings: clientPeerSettings ?? new Http2PeerSettings(),
                serverPeerSettings: serverPeerSettings ?? new Http2PeerSettings(),
                frameWriter: frameWriter,
                connectionInputFlowControl: connectionInputFlowControl,
                connectionOutputFlowControl: connectionOutputFlowControl
                          );

            context.TimeoutControl = timeoutControl;

            return(context);
        }
Beispiel #9
0
 public Http2FrameWriter(
     PipeWriter outputPipeWriter,
     ConnectionContext connectionContext,
     Http2Connection http2Connection,
     OutputFlowControl connectionOutputFlowControl,
     ITimeoutControl timeoutControl,
     MinDataRate minResponseDataRate,
     string connectionId,
     MemoryPool <byte> memoryPool,
     IKestrelTrace log)
 {
     // Allow appending more data to the PipeWriter when a flush is pending.
     _outputWriter                = new ConcurrentPipeWriter(outputPipeWriter, memoryPool, _writeLock);
     _connectionContext           = connectionContext;
     _http2Connection             = http2Connection;
     _connectionOutputFlowControl = connectionOutputFlowControl;
     _connectionId                = connectionId;
     _log                  = log;
     _timeoutControl       = timeoutControl;
     _minResponseDataRate  = minResponseDataRate;
     _flusher              = new TimingPipeFlusher(_outputWriter, timeoutControl, log);
     _outgoingFrame        = new Http2Frame();
     _headerEncodingBuffer = new byte[_maxFrameSize];
 }
Beispiel #10
0
 public StreamOutputFlowControl(OutputFlowControl connectionLevelFlowControl, uint initialWindowSize)
 {
     _connectionLevelFlowControl = connectionLevelFlowControl;
     _streamLevelFlowControl     = new OutputFlowControl(new SingleAwaitableProvider(), initialWindowSize);
 }