Added .Net framework 4.8 and upgraded to .NET 8.0
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EonaCat.Web.RateLimiter" Version="1.0.2" />
|
<PackageReference Include="EonaCat.Web.RateLimiter" Version="1.0.2" />
|
||||||
<PackageReference Include="EonaCat.Web.Tracer" Version="1.0.1" />
|
<PackageReference Include="EonaCat.Web.Tracer" Version="1.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ namespace EonaCat.Logger.Test.Web
|
|||||||
|
|
||||||
var oFS = new OffsetStream(fS, 0, limit);
|
var oFS = new OffsetStream(fS, 0, limit);
|
||||||
var request = context.Request;
|
var request = context.Request;
|
||||||
Stream s;
|
Stream stream;
|
||||||
|
|
||||||
string acceptEncoding = request.Headers["Accept-Encoding"];
|
string acceptEncoding = request.Headers["Accept-Encoding"];
|
||||||
if (string.IsNullOrEmpty(acceptEncoding))
|
if (string.IsNullOrEmpty(acceptEncoding))
|
||||||
{
|
{
|
||||||
s = response.Body;
|
stream = response.Body;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -55,36 +55,33 @@ namespace EonaCat.Logger.Test.Web
|
|||||||
if (acceptEncodingParts.Contains("br"))
|
if (acceptEncodingParts.Contains("br"))
|
||||||
{
|
{
|
||||||
response.Headers.ContentEncoding = "br";
|
response.Headers.ContentEncoding = "br";
|
||||||
s = new BrotliStream(response.Body, CompressionMode.Compress);
|
stream = new BrotliStream(response.Body, CompressionMode.Compress);
|
||||||
}
|
}
|
||||||
else if (acceptEncodingParts.Contains("gzip"))
|
else if (acceptEncodingParts.Contains("gzip"))
|
||||||
{
|
{
|
||||||
response.Headers.ContentEncoding = "gzip";
|
response.Headers.ContentEncoding = "gzip";
|
||||||
s = new GZipStream(response.Body, CompressionMode.Compress);
|
stream = new GZipStream(response.Body, CompressionMode.Compress);
|
||||||
}
|
}
|
||||||
else if (acceptEncodingParts.Contains("deflate"))
|
else if (acceptEncodingParts.Contains("deflate"))
|
||||||
{
|
{
|
||||||
response.Headers.ContentEncoding = "deflate";
|
response.Headers.ContentEncoding = "deflate";
|
||||||
s = new DeflateStream(response.Body, CompressionMode.Compress);
|
stream = new DeflateStream(response.Body, CompressionMode.Compress);
|
||||||
}
|
}
|
||||||
else
|
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)
|
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)
|
public static void Log(string message, ELogType logType = ELogType.INFO, bool writeToConsole = true)
|
||||||
{
|
{
|
||||||
if (IsDisabled)
|
if (IsDisabled)
|
||||||
|
|||||||
Reference in New Issue
Block a user