Beispiel #1
0
        public async Task WriteSettings_NoSettingsWrittenWithProtocolDefault()
        {
            var pipe        = new Pipe(new PipeOptions(_dirtyMemoryPool, PipeScheduler.Inline, PipeScheduler.Inline));
            var frameWriter = new Http3FrameWriter(pipe.Writer, null, null, null, null, _dirtyMemoryPool, null);

            var settings = new Http3PeerSettings();
            await frameWriter.WriteSettingsAsync(settings.GetNonProtocolDefaults());

            var payload = await pipe.Reader.ReadForLengthAsync(2);

            Assert.Equal(new byte[] { 0x04, 0x00 }, payload.ToArray());
        }
Beispiel #2
0
        public async Task WriteSettings_TwoSettingsWritten()
        {
            var pipe        = new Pipe(new PipeOptions(_dirtyMemoryPool, PipeScheduler.Inline, PipeScheduler.Inline));
            var frameWriter = new Http3FrameWriter(pipe.Writer, null, null, null, null, _dirtyMemoryPool, null);

            var settings = new Http3PeerSettings();

            settings.HeaderTableSize           = 1234;
            settings.MaxRequestHeaderFieldSize = 567890;

            await frameWriter.WriteSettingsAsync(settings.GetNonProtocolDefaults());

            // variable length ints make it so the results isn't know without knowing the values
            var payload = await pipe.Reader.ReadForLengthAsync(10);

            Assert.Equal(new byte[] { 0x04, 0x08, 0x01, 0x44, 0xD2, 0x06, 0x80, 0x08, 0xAA, 0x52 }, payload.ToArray());
        }
Beispiel #3
0
        public async Task WriteSettings_OneSettingsWrittenWithKestrelDefaults()
        {
            var pipe        = new Pipe(new PipeOptions(_dirtyMemoryPool, PipeScheduler.Inline, PipeScheduler.Inline));
            var frameWriter = new Http3FrameWriter(pipe.Writer, null, null, null, null, _dirtyMemoryPool, null);

            var limits   = new Http3Limits();
            var settings = new Http3PeerSettings();

            settings.HeaderTableSize           = (uint)limits.HeaderTableSize;
            settings.MaxRequestHeaderFieldSize = (uint)limits.MaxRequestHeaderFieldSize;

            await frameWriter.WriteSettingsAsync(settings.GetNonProtocolDefaults());

            // variable length ints make it so the results isn't know without knowing the values
            var payload = await pipe.Reader.ReadForLengthAsync(5);

            Assert.Equal(new byte[] { 0x04, 0x03, 0x06, 0x60, 0x00 }, payload.ToArray());
        }
Beispiel #4
0
 internal async ValueTask SendSettingsFrameAsync()
 {
     await _frameWriter.WriteSettingsAsync(_serverPeerSettings.GetNonProtocolDefaults());
 }