Skip to content

Commit ae900ee

Browse files
committed
Explicit conversion to byte array
1 parent 18c172b commit ae900ee

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

StandardSocketsHttpHandler/Net/Http/Headers/HeaderDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public string GetHeaderValue(ReadOnlySpan<byte> headerValue)
113113
}
114114
}
115115

116-
return HttpRuleParser.DefaultHttpEncoding.GetString(headerValue);
116+
return HttpRuleParser.DefaultHttpEncoding.GetString(headerValue.ToArray());
117117
}
118118
}
119119
}

StandardSocketsHttpHandler/Net/Http/HttpRuleParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ internal static string GetTokenString(ReadOnlySpan<byte> input)
147147
{
148148
Debug.Assert(IsToken(input));
149149

150-
return Encoding.ASCII.GetString(input);
150+
return Encoding.ASCII.GetString(input.ToArray());
151151
}
152152

153153
internal static int GetWhitespaceLength(string input, int startIndex)

StandardSocketsHttpHandler/Net/Http/SocketsHttpHandler/HttpConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ private static void ParseStatusLine(Span<byte> line, HttpResponseMessage respons
818818
ThrowInvalidHttpResponse();
819819
}
820820

821-
ulong first8Bytes = BitConverter.ToUInt64(line);
821+
ulong first8Bytes = BitConverter.ToUInt64(line.ToArray());
822822
if (first8Bytes == s_http11Bytes)
823823
{
824824
response.SetVersionWithoutValidation(HttpVersion.Version11);
@@ -866,7 +866,7 @@ private static void ParseStatusLine(Span<byte> line, HttpResponseMessage respons
866866
{
867867
try
868868
{
869-
response.ReasonPhrase = HttpRuleParser.DefaultHttpEncoding.GetString(reasonBytes);
869+
response.ReasonPhrase = HttpRuleParser.DefaultHttpEncoding.GetString(reasonBytes.ToArray());
870870
}
871871
catch (FormatException error)
872872
{

StandardSocketsHttpHandler/Net/Security/SslApplicationProtocol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public override string ToString()
9494
return null;
9595
}
9696

97-
return s_utf8.GetString(_readOnlyProtocol.Span);
97+
return s_utf8.GetString(_readOnlyProtocol.Span.ToArray());
9898
}
9999
catch
100100
{

0 commit comments

Comments
 (0)