Exemple #1
0
    public static void WriteSettings(this PipeWriter writer, Http2PeerSettings clientSettings)
    {
        var frame = new Http2Frame();

        frame.PrepareSettings(Http2SettingsFrameFlags.NONE);
        var settings = clientSettings.GetNonProtocolDefaults();
        var payload  = new byte[settings.Count * Http2FrameReader.SettingSize];

        frame.PayloadLength = payload.Length;
        Http2FrameWriter.WriteSettings(settings, payload);
        Http2FrameWriter.WriteHeader(frame, writer);
        writer.Write(payload);
    }
Exemple #2
0
 public Http2StreamContext(
     string connectionId,
     HttpProtocols protocols,
     AltSvcHeader?altSvcHeader,
     ServiceContext serviceContext,
     IFeatureCollection connectionFeatures,
     MemoryPool <byte> memoryPool,
     IPEndPoint?localEndPoint,
     IPEndPoint?remoteEndPoint,
     int streamId,
     IHttp2StreamLifetimeHandler streamLifetimeHandler,
     Http2PeerSettings clientPeerSettings,
     Http2PeerSettings serverPeerSettings,
     Http2FrameWriter frameWriter,
     InputFlowControl connectionInputFlowControl) : base(connectionId, protocols, altSvcHeader, connectionContext: null !, serviceContext, connectionFeatures, memoryPool, localEndPoint, remoteEndPoint)
        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);
        }