Пример #1
0
        internal async Task SendHeadersPartialAsync()
        {
            // Send HEADERS frame header without content.
            var outputWriter = Pair.Application.Output;

            Http3FrameWriter.WriteHeader(Http3FrameType.Data, frameLength: 10, outputWriter);
            await SendAsync(Span <byte> .Empty);
        }
Пример #2
0
            internal async Task SendDataAsync(Memory <byte> data)
            {
                var outputWriter = _pair.Application.Output;
                var frame        = new Http3RawFrame();

                frame.PrepareData();
                frame.Length = data.Length;
                Http3FrameWriter.WriteHeader(frame, outputWriter);
                await SendAsync(data.Span);
            }
Пример #3
0
            internal async Task SendDataAsync(Memory <byte> data, bool endStream = false)
            {
                var outputWriter = _pair.Application.Output;
                var frame        = new Http3RawFrame();

                frame.PrepareData();
                frame.Length = data.Length;
                Http3FrameWriter.WriteHeader(frame, outputWriter);
                await SendAsync(data.Span);

                if (endStream)
                {
                    await _pair.Application.Output.CompleteAsync();
                }
            }
Пример #4
0
            public async Task <bool> SendHeadersAsync(IEnumerable <KeyValuePair <string, string> > headers)
            {
                var outputWriter = _pair.Application.Output;
                var frame        = new Http3RawFrame();

                frame.PrepareHeaders();
                var buffer = _headerEncodingBuffer.AsMemory();
                var done   = _qpackEncoder.BeginEncode(headers, buffer.Span, out var length);

                frame.Length = length;
                // TODO may want to modify behavior of input frames to mock different client behavior (client can send anything).
                Http3FrameWriter.WriteHeader(frame, outputWriter);
                await SendAsync(buffer.Span.Slice(0, length));

                return(done);
            }