Skip to content
Merged
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
8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"sdk": {
"version": "7.0.100-preview.2.22153.17"
"version": "7.0.100-preview.5.22263.22"
},
"tools": {
"dotnet": "7.0.100-preview.2.22153.17",
"dotnet": "7.0.100-preview.5.22263.22",
"runtimes": {
"dotnet": [
"6.0.4"
"6.0.6"
],
"aspnetcore": [
"6.0.4"
"6.0.6"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion samples/BasicYarpSample/BasicYarpSample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/KubernetesIngress.Sample/Combined/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0.100-preview.3 AS publish
FROM mcr.microsoft.com/dotnet/sdk:7.0.100-preview.5 AS publish
WORKDIR /src

# Copy csproj files and other files needed for restoring (to build a nuget cache layer to speed up rebuilds)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<UserSecretsId>78d1f3b4-abce-4c5a-b914-3321fab1f8d0</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<IsPackable>$('System.TeamProject') != 'internal'</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/KubernetesIngress.Sample/Ingress/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0.100-preview.3 AS publish
FROM mcr.microsoft.com/dotnet/sdk:7.0.100-preview.5 AS publish
WORKDIR /src

# Copy csproj files and other files needed for restoring (to build a nuget cache layer to speed up rebuilds)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<UserSecretsId>b2dc6cd7-acbb-4d65-ad19-74771ff3c80f</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<IsPackable>$('System.TeamProject') != 'internal'</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/KubernetesIngress.Sample/Monitor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0.100-preview.3 AS publish
FROM mcr.microsoft.com/dotnet/sdk:7.0.100-preview.5 AS publish
WORKDIR /src

# Copy csproj files and other files needed for restoring (to build a nuget cache layer to speed up rebuilds)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<UserSecretsId>42f98116-26c4-4115-b6af-c5dec1f88c84</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<IsPackable>$('System.TeamProject') != 'internal'</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/KubernetesIngress.Sample/backend/backend.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<RootNamespace>Backend</RootNamespace>
<UserSecretsId>aaa98da6-d0d4-4ad6-9821-f66057413c3a</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Yarp.Sample</RootNamespace>
<LangVersion>latest</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion samples/SampleServer/SampleServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>SampleServer</RootNamespace>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Toolkit for building a Kubernetes Ingress Controller in .NET using the infrastructure from ASP.NET and .NET</Description>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Library</OutputType>
<NoWarn>$(NoWarn);CS8002</NoWarn>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Yarp.ReverseProxy.Configuration.ConfigProvider;
/// </summary>
internal sealed class ConfigurationConfigProvider : IProxyConfigProvider, IDisposable
{
private readonly object _lockObject = new object();
private readonly object _lockObject = new();
private readonly ILogger<ConfigurationConfigProvider> _logger;
private readonly IConfiguration _configuration;
private ConfigurationSnapshot? _snapshot;
Expand Down Expand Up @@ -161,7 +161,7 @@ private static RouteConfig CreateRoute(IConfigurationSection section)
}

return children.Select(subSection =>
subSection.GetChildren().ToDictionary(d => d.Key, d => d.Value, StringComparer.OrdinalIgnoreCase)).ToList();
subSection.GetChildren().ToDictionary(d => d.Key, d => d.Value!, StringComparer.OrdinalIgnoreCase)).ToList();
}

private static RouteMatch CreateRouteMatch(IConfigurationSection section)
Expand Down Expand Up @@ -195,7 +195,7 @@ private static RouteHeader CreateRouteHeader(IConfigurationSection section)
{
return new RouteHeader()
{
Name = section[nameof(RouteHeader.Name)],
Name = section[nameof(RouteHeader.Name)]!,
Values = section.GetSection(nameof(RouteHeader.Values)).ReadStringArray(),
Mode = section.ReadEnum<HeaderMatchMode>(nameof(RouteHeader.Mode)) ?? HeaderMatchMode.ExactHeader,
IsCaseSensitive = section.ReadBool(nameof(RouteHeader.IsCaseSensitive)) ?? false,
Expand All @@ -216,7 +216,7 @@ private static RouteQueryParameter CreateRouteQueryParameter(IConfigurationSecti
{
return new RouteQueryParameter()
{
Name = section[nameof(RouteQueryParameter.Name)],
Name = section[nameof(RouteQueryParameter.Name)]!,
Values = section.GetSection(nameof(RouteQueryParameter.Values)).ReadStringArray(),
Mode = section.ReadEnum<QueryParameterMatchMode>(nameof(RouteQueryParameter.Mode)) ?? QueryParameterMatchMode.Exact,
IsCaseSensitive = section.ReadBool(nameof(RouteQueryParameter.IsCaseSensitive)) ?? false,
Expand All @@ -235,7 +235,7 @@ private static RouteQueryParameter CreateRouteQueryParameter(IConfigurationSecti
Enabled = section.ReadBool(nameof(SessionAffinityConfig.Enabled)),
Policy = section[nameof(SessionAffinityConfig.Policy)],
FailurePolicy = section[nameof(SessionAffinityConfig.FailurePolicy)],
AffinityKeyName = section[nameof(SessionAffinityConfig.AffinityKeyName)],
AffinityKeyName = section[nameof(SessionAffinityConfig.AffinityKeyName)]!,
Cookie = CreateSessionAffinityCookieConfig(section.GetSection(nameof(SessionAffinityConfig.Cookie)))
};
}
Expand Down Expand Up @@ -317,7 +317,7 @@ private static RouteQueryParameter CreateRouteQueryParameter(IConfigurationSecti
SslProtocols? sslProtocols = null;
if (section.GetSection(nameof(HttpClientConfig.SslProtocols)) is IConfigurationSection sslProtocolsSection)
{
foreach (var protocolConfig in sslProtocolsSection.GetChildren().Select(s => Enum.Parse<SslProtocols>(s.Value, ignoreCase: true)))
foreach (var protocolConfig in sslProtocolsSection.GetChildren().Select(s => Enum.Parse<SslProtocols>(s.Value!, ignoreCase: true)))
{
sslProtocols = sslProtocols is null ? protocolConfig : sslProtocols | protocolConfig;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ private static DestinationConfig CreateDestination(IConfigurationSection section
{
return new DestinationConfig
{
Address = section[nameof(DestinationConfig.Address)],
Address = section[nameof(DestinationConfig.Address)]!,
Health = section[nameof(DestinationConfig.Health)],
Metadata = section.GetSection(nameof(DestinationConfig.Metadata)).ReadStringDictionary(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal static class ConfigurationReadingExtensions
return null;
}

return new ReadOnlyDictionary<string, string>(children.ToDictionary(s => s.Key, s => s.Value, StringComparer.OrdinalIgnoreCase));
return new ReadOnlyDictionary<string, string>(children.ToDictionary(s => s.Key, s => s.Value!, StringComparer.OrdinalIgnoreCase));
}

internal static string[]? ReadStringArray(this IConfigurationSection section)
Expand All @@ -65,6 +65,6 @@ internal static class ConfigurationReadingExtensions
return null;
}

return children.Select(s => s.Value).ToArray();
return children.Select(s => s.Value!).ToArray();
}
}
4 changes: 2 additions & 2 deletions src/ReverseProxy/Forwarder/HttpForwarder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ private async ValueTask<ForwarderError> HandleUpgradedResponse(HttpContext conte
using var clientStream = upgradeResult;

// :: Step 7-A-2: Copy duplex streams
using var destinationStream = await destinationResponse.Content.ReadAsStreamAsync();
using var destinationStream = await destinationResponse.Content.ReadAsStreamAsync(activityCancellationSource.Token);

var requestTask = StreamCopier.CopyAsync(isRequest: true, clientStream, destinationStream, StreamCopier.UnknownLength, _clock, activityCancellationSource, activityCancellationSource.Token).AsTask();
var responseTask = StreamCopier.CopyAsync(isRequest: false, destinationStream, clientStream, StreamCopier.UnknownLength, _clock, activityCancellationSource, activityCancellationSource.Token).AsTask();
Expand Down Expand Up @@ -626,7 +626,7 @@ ForwarderError ReportResult(HttpContext context, bool reqeuest, StreamCopyResult
// https://github.com/dotnet/runtime/blame/8fc68f626a11d646109a758cb0fc70a0aa7826f1/src/libraries/System.Net.Http/src/System/Net/Http/HttpResponseMessage.cs#L46
if (destinationResponseContent is not null)
{
using var destinationResponseStream = await destinationResponseContent.ReadAsStreamAsync();
using var destinationResponseStream = await destinationResponseContent.ReadAsStreamAsync(activityCancellationSource.Token);
// The response content-length is enforced by the server.
return await StreamCopier.CopyAsync(isRequest: false, destinationResponseStream, clientResponseStream, StreamCopier.UnknownLength, _clock, activityCancellationSource, activityCancellationSource.Token);
}
Expand Down
6 changes: 4 additions & 2 deletions src/ReverseProxy/Forwarder/RequestUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ internal static void AddHeader(HttpRequestMessage request, string headerName, St
{
if (value.Count == 1)
{
string headerValue = value;
string headerValue = value!;

if (ContainsNewLines(headerValue))
{
Expand All @@ -276,8 +276,9 @@ internal static void AddHeader(HttpRequestMessage request, string headerName, St
}
else
{
string[] headerValues = value;
string[] headerValues = value!;

#if !NET7_0_OR_GREATER
// HttpClient wrongly uses comma (",") instead of semi-colon (";") as a separator for Cookie headers.
// To mitigate this, we concatenate them manually and put them back as a single header value.
// A multi-header cookie header is invalid, but we get one because of
Expand All @@ -287,6 +288,7 @@ internal static void AddHeader(HttpRequestMessage request, string headerName, St
AddHeader(request, headerName, string.Join("; ", headerValues));
return;
}
#endif

foreach (var headerValue in headerValues)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ReverseProxy/Management/ProxyConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ private void ListenForConfigChanges()
// Don't register until we're done hooking everything up to avoid cancellation races.
source.Token.Register(ReloadConfig, this);

static void SignalChange(object obj)
static void SignalChange(object? obj)
{
var token = (CancellationTokenSource)obj;
var token = (CancellationTokenSource)obj!;
try
{
token.Cancel();
Expand Down
Loading