diff --git a/src/System.Buffers.Experimental/System.Buffers.Experimental.csproj b/src/System.Buffers.Experimental/System.Buffers.Experimental.csproj index d8a1f4f4250..ff5d1746033 100644 --- a/src/System.Buffers.Experimental/System.Buffers.Experimental.csproj +++ b/src/System.Buffers.Experimental/System.Buffers.Experimental.csproj @@ -8,6 +8,7 @@ + diff --git a/src/System.Buffers.Experimental/System/Buffers/BufferExtensions.cs b/src/System.Buffers.Experimental/System/Buffers/BufferExtensions.cs index 5cbdd8456b1..347ca73063a 100644 --- a/src/System.Buffers.Experimental/System/Buffers/BufferExtensions.cs +++ b/src/System.Buffers.Experimental/System/Buffers/BufferExtensions.cs @@ -9,7 +9,6 @@ namespace System.Buffers { - public static class MemoryListExtensions { // span creation helpers: diff --git a/src/System.Buffers.Experimental/System/Buffers/IPipeWritable.cs b/src/System.Buffers.Experimental/System/Buffers/IPipeWritable.cs new file mode 100644 index 00000000000..79f52ef6fb8 --- /dev/null +++ b/src/System.Buffers.Experimental/System/Buffers/IPipeWritable.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; + +namespace System.IO.Pipelines +{ + public interface IPipeWritable + { + Task WriteAsync(PipeWriter writer); + } +} diff --git a/src/System.Text.Http.Parser/HttpParser.cs b/src/System.Text.Http.Parser/HttpParser.cs index cc1d37872c0..a001cf13636 100644 --- a/src/System.Text.Http.Parser/HttpParser.cs +++ b/src/System.Text.Http.Parser/HttpParser.cs @@ -78,7 +78,6 @@ public unsafe bool ParseRequestLine(T handler, in ReadOnlyBuffer buffer return true; } - public unsafe bool ParseRequestLine(ref T handler, in ReadOnlyBuffer buffer, out int consumed) where T : IHttpRequestLineHandler { // Prepare the first span @@ -493,7 +492,7 @@ public bool ParseResponseLine(ref T handler, ref ReadOnlyBuffer buffer, throw new Exception("no status code"); } - handler.OnStartLine(Parser.Http.Version.Http11, code, codeSlice.Slice(consumedBytes + 1)); + handler.OnStatusLine(Http.Version.Http11, code, codeSlice.Slice(consumedBytes + 1)); consumedBytes = eol + s_Eol.Length; return true; } diff --git a/src/System.Text.Http.Parser/IHttpResponseLineHandler.cs b/src/System.Text.Http.Parser/IHttpResponseLineHandler.cs index 6c3cf050ec5..a19f67fad53 100644 --- a/src/System.Text.Http.Parser/IHttpResponseLineHandler.cs +++ b/src/System.Text.Http.Parser/IHttpResponseLineHandler.cs @@ -5,6 +5,6 @@ namespace System.Text.Http.Parser { public interface IHttpResponseLineHandler { - void OnStartLine(Http.Version version, ushort code, ReadOnlySpan status); + void OnStatusLine(Http.Version version, ushort status, ReadOnlySpan reason); } } diff --git a/src/System.Text.Http/System/Text/Http/BufferWriterHttpExtensions.cs b/src/System.Text.Http/System/Text/Http/BufferWriterHttpExtensions.cs index 7bc3539fa59..303516a37b5 100644 --- a/src/System.Text.Http/System/Text/Http/BufferWriterHttpExtensions.cs +++ b/src/System.Text.Http/System/Text/Http/BufferWriterHttpExtensions.cs @@ -20,13 +20,21 @@ public static BufferWriter AsHttpWriter(this Span buffer) return writer; } - public static void WriteRequestLine(ref this BufferWriter writer, Parser.Http.Method verb, string path) + public static void WriteRequestLine(ref this BufferWriter writer, Parser.Http.Method verb, Parser.Http.Version version, string path) { writer.WriteBytes(verb.AsBytes()); writer.Write(" /"); writer.Write(path); - writer.WriteLine(" HTTP/1.1"); + if (version == Parser.Http.Version.Http11) + { + writer.WriteLine(" HTTP/1.1"); + } + else if (version == Parser.Http.Version.Http10) + { + writer.WriteLine(" HTTP/1.0"); + } + else throw new NotSupportedException("version not supported"); } public static void WriteHeader(ref this BufferWriter writer, string headerName, string headerValue)