Ejemplo n.º 1
0
        void ReadSettingsFrame(IChannelHandlerContext ctx, IByteBuffer payload, IHttp2FrameListener listener)
        {
            if (_flags.Ack())
            {
                listener.OnSettingsAckRead(ctx);
            }
            else
            {
                int           numSettings = _payloadLength / Http2CodecUtil.SettingEntryLength;
                Http2Settings settings    = new Http2Settings();
                for (int index = 0; index < numSettings; ++index)
                {
                    char id    = (char)payload.ReadUnsignedShort();
                    long value = payload.ReadUnsignedInt();
                    try
                    {
                        _ = settings.Put(id, value);
                    }
                    catch (ArgumentException e)
                    {
                        switch (id)
                        {
                        case Http2CodecUtil.SettingsMaxFrameSize:
                            ThrowHelper.ThrowConnectionError(Http2Error.ProtocolError, e);
                            break;

                        case Http2CodecUtil.SettingsInitialWindowSize:
                            ThrowHelper.ThrowConnectionError(Http2Error.FlowControlError, e);
                            break;

                        default:
                            ThrowHelper.ThrowConnectionError(Http2Error.ProtocolError, e);
                            break;
                        }
                    }
                }

                listener.OnSettingsRead(ctx, settings);
            }
        }
Ejemplo n.º 2
0
 public virtual void OnSettingsRead(IChannelHandlerContext ctx, Http2Settings settings)
 {
     _listener.OnSettingsRead(ctx, settings);
 }
Ejemplo n.º 3
0
 public void OnSettingsRead(IChannelHandlerContext ctx, Http2Settings settings)
 {
     _logger.LogSettings(Direction.Inbound, ctx, settings);
     _listener.OnSettingsRead(ctx, settings);
 }