Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '9.0.x'

- name: "Set VersionSuffix"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '9.0.x'

- name: "Set VersionSuffix for Preview"
if: "contains(github.ref, 'refs/tags') && contains(github.ref, 'preview')"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net9.0</TargetFrameworks>
<!-- NuGet Package Information -->
<Description>This package adds support for Entity Framwork Core to Rin</Description>
<PackageTags>Rin EntityFrameworkCore</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net9.0</TargetFrameworks>

<!-- NuGet Package Information -->
<Description>This package adds support for tracing with log4net to Rin</Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net9.0</TargetFrameworks>
<!-- NuGet Package Information -->
<Description>This package adds support for MagicOnion to Rin</Description>
<PackageTags>Rin MagicOnion</PackageTags>
Expand Down
2 changes: 1 addition & 1 deletion src/Rin.Mvc/Rin.Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net9.0</TargetFrameworks>

<!-- NuGet Package Information -->
<Description>This package adds support for ASP.NET Core MVC to Rin</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/Rin.Storage.Redis/Rin.Storage.Redis.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net9.0</TargetFrameworks>

<!-- NuGet Package Information -->
<Description>This package adds support for Redis storage to Rin</Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Rin.Core.Record;
using Rin.Extensions;
Expand All @@ -21,7 +18,8 @@ public static class RinRedisRecordStorageServiceExtensions
public static IRinBuilder UseRedisStorage(this IRinBuilder builder, Action<RedisRecordStorageOptions>? configure = null)
{
builder.Services.AddOptions<RedisRecordStorageOptions>();
builder.Services.Configure<RedisRecordStorageOptions>(configure);

if (configure != null) builder.Services.Configure<RedisRecordStorageOptions>(configure);

builder.Services.Replace(new ServiceDescriptor(typeof(IRecordStorage), typeof(RedisRecordStorage), ServiceLifetime.Singleton));

Expand Down
6 changes: 3 additions & 3 deletions src/Rin/Core/Resource/EmbeddedZipResourceProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -39,7 +39,7 @@ public async Task<bool> TryProcessAsync(HttpContext context)
// for SPA (+ rewrite paths in HTML)
else if (
context.Request.Headers.TryGetValue("Accept", out var acceptHeaders) &&
acceptHeaders.Any(x => x.Contains("text/html")) &&
acceptHeaders.Any(x => x != null && x.Contains("text/html")) &&
Resources.TryOpen("index.html", out resourceStream, out contentType)
)
{
Expand All @@ -63,7 +63,7 @@ private async Task WriteStreamToClientAsync(HttpContext context, Stream stream,
context.Response.StatusCode = 200;
context.Response.ContentType = contentType;

if (context.Request.Headers.TryGetValue("accept-encoding", out var headerValues) && headerValues.Any(x => x.Contains("gzip")))
if (context.Request.Headers.TryGetValue("accept-encoding", out var headerValues) && headerValues.Any(x => x != null && x.Contains("gzip")))
{
context.Response.Headers["Content-Encoding"] = "gzip";
using (var outputStream = new GZipStream(new ForceAsyncStreamWrapper(context.Response.Body), CompressionLevel.Fastest, true))
Expand Down
5 changes: 3 additions & 2 deletions src/Rin/Hubs/Payloads/BodyDataPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ public static BodyDataPayload CreateFromRecord(HttpRequestRecord record, IDictio
}
}

if (payloadBodyContentType.StartsWith("text/") ||
if (payloadBodyContentType != null && (
payloadBodyContentType.StartsWith("text/") ||
payloadBodyContentType.StartsWith("application/json") ||
payloadBodyContentType.StartsWith("application/x-www-form-urlencoded"))
payloadBodyContentType.StartsWith("application/x-www-form-urlencoded")))
{
return new BodyDataPayload(Encoding.UTF8.GetString(payloadBody), false, transformedBodyContentType);
}
Expand Down
12 changes: 10 additions & 2 deletions src/Rin/IO/CapturePipeWriter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.IO.Pipelines;
using System.Threading;
Expand Down Expand Up @@ -48,5 +48,13 @@ public override void Complete(Exception? exception = null)
{
return _pipeWriter.FlushAsync(cancellationToken);
}

#if NET9_0

public override bool CanGetUnflushedBytes => _pipeWriter.CanGetUnflushedBytes;

public override long UnflushedBytes => _pipeWriter.UnflushedBytes;

#endif
}
}
}
4 changes: 2 additions & 2 deletions src/Rin/Middlewares/Api/GetDetailByIdMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public async Task InvokeAsync(HttpContext context)
await context.Response.WriteAsync("Missing required parameter: id");
return;
}

var result = await _storage.TryGetDetailByIdAsync(id);
var result = await _storage.TryGetDetailByIdAsync(id!);
if (!result.Succeed || result.Value == null)
{
context.Response.StatusCode = 404;
Expand Down
26 changes: 21 additions & 5 deletions src/Rin/Middlewares/DownloadMiddleware.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.FileProviders;
using Microsoft.Net.Http.Headers;
using Rin.Core;
Expand All @@ -25,8 +25,16 @@ public DownloadRequestBodyMiddleware(RequestDelegate next, IRecordStorage storag

public async Task InvokeAsync(HttpContext context)
{
var result = await _storage.TryGetDetailByIdAsync(context.Request.Query["id"]);
var resultBody = await _storage.TryGetRequestBodyByIdAsync(context.Request.Query["id"]);
string? queryId = context.Request.Query["id"];

if (queryId == null)
{
context.Response.StatusCode = 404;
return;
}

var result = await _storage.TryGetDetailByIdAsync(queryId);
var resultBody = await _storage.TryGetRequestBodyByIdAsync(queryId);
var entry = result.Value;

if (!result.Succeed || !resultBody.Succeed || entry == null)
Expand Down Expand Up @@ -58,8 +66,16 @@ public DownloadResponseBodyMiddleware(RequestDelegate next, IRecordStorage stora

public async Task InvokeAsync(HttpContext context)
{
var result = await _storage.TryGetDetailByIdAsync(context.Request.Query["id"]);
var resultBody = await _storage.TryGetResponseBodyByIdAsync(context.Request.Query["id"]);
string? queryId = context.Request.Query["id"];

if (queryId == null)
{
context.Response.StatusCode = 404;
return;
}

var result = await _storage.TryGetDetailByIdAsync(queryId);
var resultBody = await _storage.TryGetResponseBodyByIdAsync(queryId);
var entry = result.Value;

if (!result.Succeed || !resultBody.Succeed || entry == null)
Expand Down
2 changes: 1 addition & 1 deletion src/Rin/Middlewares/RequestRecorderMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private async Task<HttpRequestRecord> PreprocessAsync(HttpContext context, RinOp
{
Id = Guid.NewGuid().ToString(),
IsHttps = request.IsHttps,
Host = request.Host.Value,
Host = request.Host.Value!,
QueryString = request.QueryString.Value,
Path = request.Path,
Method = request.Method,
Expand Down
2 changes: 1 addition & 1 deletion src/Rin/Rin.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net9.0</TargetFrameworks>
<nullable>enable</nullable>

<!-- NuGet Package Information -->
Expand Down