Improve performance by not allocating for every single byte of an HTTP response.
MODIFY
WalletWasabi/Tor/Http/Constants.cs
WalletWasabi/Tor/Http/Constants.cs
@@ -4,8 +4,7 @@ namespace WalletWasabi.Tor.Http
{
public const string SP = " ";
public const string HTAB = "\t";
- public const string CR = "\r";
- public const string LF = "\n";
+ public const byte LF = (byte)'\n';
public const string CRLF = "\r\n";
}
}

MODIFY
WalletWasabi/Tor/Http/Helpers/HttpMessageHelper.cs
WalletWasabi/Tor/Http/Helpers/HttpMessageHelper.cs
@@ -34,7 +34,7 @@ namespace WalletWasabi.Tor.Http.Helpers
{
read = await stream.ReadByteAsync(ctsToken).ConfigureAwait(false);
bab.Append((byte)read);
- if (Encoding.ASCII.GetBytes(LF)[0] == (byte)read)
+ if (LF == (byte)read)
{
break;
}

Improve performance by not allocating for every single byte of an HTTP response.