Esempio n. 1
0
        public static Http3StreamContext CreateHttp3StreamContext(
            string connectionId = null,
            ConnectionContext connectionContext   = null,
            ServiceContext serviceContext         = null,
            IFeatureCollection connectionFeatures = null,
            MemoryPool <byte> memoryPool          = null,
            IPEndPoint localEndPoint       = null,
            IPEndPoint remoteEndPoint      = null,
            IDuplexPipe transport          = null,
            ITimeoutControl timeoutControl = null,
            IHttp3StreamLifetimeHandler streamLifetimeHandler = null)
        {
            var context = new Http3StreamContext
                          (
                connectionId: connectionId ?? "TestConnectionId",
                protocols: HttpProtocols.Http3,
                connectionContext: connectionContext,
                serviceContext: serviceContext ?? CreateServiceContext(new KestrelServerOptions()),
                connectionFeatures: connectionFeatures ?? new FeatureCollection(),
                memoryPool: memoryPool ?? MemoryPool <byte> .Shared,
                localEndPoint: localEndPoint,
                remoteEndPoint: remoteEndPoint,
                transport: transport,
                streamLifetimeHandler: streamLifetimeHandler,
                streamContext: null,
                settings: null
                          );

            context.TimeoutControl = timeoutControl;

            return(context);
        }
Esempio n. 2
0
        public Http3Connection(HttpMultiplexedConnectionContext context)
        {
            _multiplexedContext    = (MultiplexedConnectionContext)context.ConnectionContext;
            _context               = context;
            _streamLifetimeHandler = this;

            _errorCodeFeature = context.ConnectionFeatures.Get <IProtocolErrorCodeFeature>() !;

            var httpLimits = context.ServiceContext.ServerOptions.Limits;

            _serverSettings.HeaderTableSize = (uint)httpLimits.Http3.HeaderTableSize;
            _serverSettings.MaxRequestHeaderFieldSectionSize = (uint)httpLimits.MaxRequestHeadersTotalSize;
        }
Esempio n. 3
0
    public Http3Connection(HttpMultiplexedConnectionContext context)
    {
        _multiplexedContext    = (MultiplexedConnectionContext)context.ConnectionContext;
        _context               = context;
        _streamLifetimeHandler = this;

        _errorCodeFeature = context.ConnectionFeatures.GetRequiredFeature <IProtocolErrorCodeFeature>();

        var httpLimits = context.ServiceContext.ServerOptions.Limits;

        _serverSettings.HeaderTableSize = (uint)httpLimits.Http3.HeaderTableSize;
        _serverSettings.MaxRequestHeaderFieldSectionSize = (uint)httpLimits.MaxRequestHeadersTotalSize;
        _serverSettings.EnableWebTransport = Convert.ToUInt32(context.ServiceContext.ServerOptions.EnableWebTransportAndH3Datagrams);
        // technically these are 2 different settings so they should have separate values but the Chromium implementation requires
        // them to both be 1 to useWebTransport.
        _serverSettings.H3Datagram = Convert.ToUInt32(context.ServiceContext.ServerOptions.EnableWebTransportAndH3Datagrams);
    }
Esempio n. 4
0
    public static Http3StreamContext CreateHttp3StreamContext(
        string connectionId = null,
        BaseConnectionContext connectionContext = null,
        ServiceContext serviceContext           = null,
        IFeatureCollection connectionFeatures   = null,
        MemoryPool <byte> memoryPool            = null,
        IPEndPoint localEndPoint       = null,
        IPEndPoint remoteEndPoint      = null,
        IDuplexPipe transport          = null,
        ITimeoutControl timeoutControl = null,
        IHttp3StreamLifetimeHandler streamLifetimeHandler = null)
    {
        var http3ConnectionContext = CreateHttp3ConnectionContext(
            null,
            serviceContext,
            connectionFeatures,
            memoryPool,
            localEndPoint,
            remoteEndPoint,
            timeoutControl);

        var http3Conection = new Http3Connection(http3ConnectionContext)
        {
            _streamLifetimeHandler = streamLifetimeHandler
        };

        return(new Http3StreamContext
               (
                   connectionId: connectionId ?? "TestConnectionId",
                   protocols: HttpProtocols.Http3,
                   altSvcHeader: null,
                   connectionContext: connectionContext,
                   serviceContext: serviceContext ?? CreateServiceContext(new KestrelServerOptions()),
                   connectionFeatures: connectionFeatures ?? new FeatureCollection(),
                   memoryPool: memoryPool ?? MemoryPool <byte> .Shared,
                   localEndPoint: localEndPoint,
                   remoteEndPoint: remoteEndPoint,
                   streamContext: new DefaultConnectionContext(),
                   connection: http3Conection
               )
        {
            TimeoutControl = timeoutControl,
            Transport = transport,
        });
    }
Esempio n. 5
0
 public Http3StreamContext(
     string connectionId,
     HttpProtocols protocols,
     ConnectionContext connectionContext,
     ServiceContext serviceContext,
     IFeatureCollection connectionFeatures,
     MemoryPool <byte> memoryPool,
     IPEndPoint?localEndPoint,
     IPEndPoint?remoteEndPoint,
     IDuplexPipe transport,
     IHttp3StreamLifetimeHandler streamLifetimeHandler,
     ConnectionContext streamContext,
     Http3PeerSettings settings) : base(connectionId, protocols, connectionContext, serviceContext, connectionFeatures, memoryPool, localEndPoint, remoteEndPoint, transport)
 {
     StreamLifetimeHandler = streamLifetimeHandler;
     StreamContext         = streamContext;
     ServerSettings        = settings;
 }
Esempio n. 6
0
 public Http3StreamContext(
     string connectionId,
     HttpProtocols protocols,
     AltSvcHeader?altSvcHeader,
     BaseConnectionContext connectionContext,
     ServiceContext serviceContext,
     IFeatureCollection connectionFeatures,
     MemoryPool <byte> memoryPool,
     IPEndPoint?localEndPoint,
     IPEndPoint?remoteEndPoint,
     IHttp3StreamLifetimeHandler streamLifetimeHandler,
     ConnectionContext streamContext,
     Http3PeerSettings clientPeerSettings,
     Http3PeerSettings serverPeerSettings) : base(connectionId, protocols, altSvcHeader, connectionContext, serviceContext, connectionFeatures, memoryPool, localEndPoint, remoteEndPoint)
 {
     StreamLifetimeHandler = streamLifetimeHandler;
     StreamContext         = streamContext;
     ClientPeerSettings    = clientPeerSettings;
     ServerPeerSettings    = serverPeerSettings;
 }
Esempio n. 7
0
 public LifetimeHandlerInterceptor(IHttp3StreamLifetimeHandler inner, Http3InMemory http3TestBase)
 {
     _inner         = inner;
     _http3TestBase = http3TestBase;
 }