Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
small changes to Azure Storage dependencies (#2109)
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofCwalina authored Feb 9, 2018
1 parent 0b605e2 commit a71563a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\System.Collections.Sequences\System.Collections.Sequences.csproj" />
<ProjectReference Include="..\System.IO.Pipelines\System.IO.Pipelines.csproj" />
<ProjectReference Include="..\System.Text.Primitives\System.Text.Primitives.csproj" />
<ProjectReference Include="..\System.Text.Utf8String\System.Text.Utf8String.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace System.Buffers
{

public static class MemoryListExtensions
{
// span creation helpers:
Expand Down
13 changes: 13 additions & 0 deletions src/System.Buffers.Experimental/System/Buffers/IPipeWritable.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
3 changes: 1 addition & 2 deletions src/System.Text.Http.Parser/HttpParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public unsafe bool ParseRequestLine<T>(T handler, in ReadOnlyBuffer<byte> buffer
return true;
}


public unsafe bool ParseRequestLine<T>(ref T handler, in ReadOnlyBuffer<byte> buffer, out int consumed) where T : IHttpRequestLineHandler
{
// Prepare the first span
Expand Down Expand Up @@ -493,7 +492,7 @@ public bool ParseResponseLine<T>(ref T handler, ref ReadOnlyBuffer<byte> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/System.Text.Http.Parser/IHttpResponseLineHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace System.Text.Http.Parser
{
public interface IHttpResponseLineHandler
{
void OnStartLine(Http.Version version, ushort code, ReadOnlySpan<byte> status);
void OnStatusLine(Http.Version version, ushort status, ReadOnlySpan<byte> reason);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@ public static BufferWriter AsHttpWriter(this Span<byte> 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)
Expand Down

0 comments on commit a71563a

Please sign in to comment.