Added .Net framework 4.8 and upgraded to .NET 8.0

This commit is contained in:
2024-02-08 20:33:06 +01:00
parent b4cc44866e
commit 54239a44c7
2 changed files with 9 additions and 13 deletions

View File

@@ -9,7 +9,6 @@
<ItemGroup>
<PackageReference Include="EonaCat.Web.RateLimiter" Version="1.0.2" />
<PackageReference Include="EonaCat.Web.Tracer" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
</ItemGroup>
<ItemGroup>

View File

@@ -41,12 +41,12 @@ namespace EonaCat.Logger.Test.Web
var oFS = new OffsetStream(fS, 0, limit);
var request = context.Request;
Stream s;
Stream stream;
string acceptEncoding = request.Headers["Accept-Encoding"];
if (string.IsNullOrEmpty(acceptEncoding))
{
s = response.Body;
stream = response.Body;
}
else
{
@@ -55,36 +55,33 @@ namespace EonaCat.Logger.Test.Web
if (acceptEncodingParts.Contains("br"))
{
response.Headers.ContentEncoding = "br";
s = new BrotliStream(response.Body, CompressionMode.Compress);
stream = new BrotliStream(response.Body, CompressionMode.Compress);
}
else if (acceptEncodingParts.Contains("gzip"))
{
response.Headers.ContentEncoding = "gzip";
s = new GZipStream(response.Body, CompressionMode.Compress);
stream = new GZipStream(response.Body, CompressionMode.Compress);
}
else if (acceptEncodingParts.Contains("deflate"))
{
response.Headers.ContentEncoding = "deflate";
s = new DeflateStream(response.Body, CompressionMode.Compress);
stream = new DeflateStream(response.Body, CompressionMode.Compress);
}
else
{
s = response.Body;
stream = response.Body;
}
}
await using (s)
await using (stream)
{
await oFS.CopyToAsync(s).ConfigureAwait(false);
await oFS.CopyToAsync(stream).ConfigureAwait(false);
if (fS.Length > limit)
await s.WriteAsync("\r\n####__EONACATLOGGER_TRUNCATED___####"u8.ToArray()).ConfigureAwait(false);
await stream.WriteAsync("\r\n####__EONACATLOGGER_TRUNCATED___####"u8.ToArray()).ConfigureAwait(false);
}
}
public static void Log(string message, ELogType logType = ELogType.INFO, bool writeToConsole = true)
{
if (IsDisabled)