Remove dependency on Utf8String (#1466)
- Also remove System.IO.Pipelines.Text.Primitives
This commit is contained in:
parent
e25eb418bb
commit
dbcf34388e
|
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Pipelines;
|
using System.IO.Pipelines;
|
||||||
using System.IO.Pipelines.Text.Primitives;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
@ -1232,7 +1231,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
|
||||||
|
|
||||||
// URI was encoded, unescape and then parse as utf8
|
// URI was encoded, unescape and then parse as utf8
|
||||||
int pathLength = UrlEncoder.Decode(path, path);
|
int pathLength = UrlEncoder.Decode(path, path);
|
||||||
requestUrlPath = new Utf8String(path.Slice(0, pathLength)).ToString();
|
requestUrlPath = GetUtf8String(path.Slice(0, pathLength));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1282,6 +1281,20 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private unsafe static string GetUtf8String(Span<byte> path)
|
||||||
|
{
|
||||||
|
// .NET 451 doesn't have pointer overloads for Encoding.GetString so we
|
||||||
|
// copy to an array
|
||||||
|
#if NET451
|
||||||
|
return Encoding.UTF8.GetString(path.ToArray());
|
||||||
|
#else
|
||||||
|
fixed (byte* pointer = &path.DangerousGetPinnableReference())
|
||||||
|
{
|
||||||
|
return Encoding.UTF8.GetString(pointer, path.Length);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void OnHeader(Span<byte> name, Span<byte> value)
|
public void OnHeader(Span<byte> name, Span<byte> value)
|
||||||
{
|
{
|
||||||
_requestHeadersParsed++;
|
_requestHeadersParsed++;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
<PackageReference Include="System.Numerics.Vectors" Version="$(CoreFxVersion)" />
|
<PackageReference Include="System.Numerics.Vectors" Version="$(CoreFxVersion)" />
|
||||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(CoreFxVersion)" />
|
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(CoreFxVersion)" />
|
||||||
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxLabsPipelinesVersion)" />
|
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxLabsPipelinesVersion)" />
|
||||||
<PackageReference Include="System.IO.Pipelines.Text.Primitives" Version="$(CoreFxLabsVersion)" />
|
|
||||||
<PackageReference Include="System.Text.Encodings.Web.Utf8" Version="$(CoreFxLabsVersion)" />
|
<PackageReference Include="System.Text.Encodings.Web.Utf8" Version="$(CoreFxLabsVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue