From 22435950bf9de689b926dceb0bedc2ec07f280db Mon Sep 17 00:00:00 2001 From: vseanreesermsft <78103370+vseanreesermsft@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:55:27 -0700 Subject: [PATCH 01/54] Update branding to 7.0.10 (#49235) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 5b3e2eed2a9b..c8a200bfd4e0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ 7 0 - 9 + 10 false - + + + @@ -26,9 +28,11 @@ - + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 08c476cea384..05138f44f95e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,37 +9,37 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - e00be013488a9a56a0e29230be0fe10026dbb209 + 55c77de6a6b0b40c76ebecef89645a131d58f3f3 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime diff --git a/eng/Versions.props b/eng/Versions.props index 3d567eda0d1a..bebc97ae95dd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -125,14 +125,14 @@ 7.0.4 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 7.0.0-beta.23313.4 7.0.0-beta.23313.4 From c942d1407e369e19d48d2597d499724cd748a571 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Thu, 6 Jul 2023 10:48:49 +0000 Subject: [PATCH 03/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 8 ++------ eng/Version.Details.xml | 30 +++++++++++++++--------------- eng/Versions.props | 14 +++++++------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/NuGet.config b/NuGet.config index e29884b19912..48126d309251 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,9 +7,7 @@ - - - + @@ -31,9 +29,7 @@ - - - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 05138f44f95e..74ed8b941963 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 https://github.com/dotnet/source-build-externals @@ -262,33 +262,33 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 https://github.com/dotnet/xdt @@ -300,7 +300,7 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 + 35c9fbc0729d445325c65f9df9bb92df1c771ed7 https://github.com/dotnet/arcade diff --git a/eng/Versions.props b/eng/Versions.props index bebc97ae95dd..8cd1406ebd77 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -63,12 +63,12 @@ 7.0.0 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9 - 7.0.9-servicing.23320.18 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10 + 7.0.10-servicing.23355.11 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.9-servicing.23320.18 + 7.0.10-servicing.23355.11 7.0.0 7.0.2 7.0.0 From 9b978940046464e45e384e30eb35dde0b456653b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:53:06 -0700 Subject: [PATCH 04/54] [release/7.0] (deps): Bump src/submodules/googletest (#49136) Bumps [src/submodules/googletest](https://github.com/google/googletest) from `04cf298` to `be03d00`. - [Release notes](https://github.com/google/googletest/releases) - [Commits](https://github.com/google/googletest/compare/04cf2989168a3f9218d463bea6f15f8ade2032fd...be03d00f5f0cc3a997d1a368bee8a1fe93651f48) --- updated-dependencies: - dependency-name: src/submodules/googletest dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/submodules/googletest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/submodules/googletest b/src/submodules/googletest index 04cf2989168a..be03d00f5f0c 160000 --- a/src/submodules/googletest +++ b/src/submodules/googletest @@ -1 +1 @@ -Subproject commit 04cf2989168a3f9218d463bea6f15f8ade2032fd +Subproject commit be03d00f5f0cc3a997d1a368bee8a1fe93651f48 From 6031483ab8b61d0427a49901c1f33cb8f25d9d8b Mon Sep 17 00:00:00 2001 From: Brennan Conroy Date: Thu, 6 Jul 2023 20:12:26 +0000 Subject: [PATCH 05/54] Merged PR 31899: Avoid Redis pattern matching Avoid Redis pattern matching --- .../src/Internal/RedisChannels.cs | 3 + .../src/RedisHubLifetimeManager.cs | 22 +++--- .../StackExchangeRedis/test/RedisEndToEnd.cs | 67 +++++++++++++++++++ .../test/RedisHubLifetimeManagerTests.cs | 20 ++++++ .../test/TestConnectionMultiplexer.cs | 29 ++++++++ 5 files changed, 130 insertions(+), 11 deletions(-) diff --git a/src/SignalR/server/StackExchangeRedis/src/Internal/RedisChannels.cs b/src/SignalR/server/StackExchangeRedis/src/Internal/RedisChannels.cs index 676e07bc7f1a..b9b819ccce4b 100644 --- a/src/SignalR/server/StackExchangeRedis/src/Internal/RedisChannels.cs +++ b/src/SignalR/server/StackExchangeRedis/src/Internal/RedisChannels.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.CompilerServices; +using StackExchange.Redis; namespace Microsoft.AspNetCore.SignalR.StackExchangeRedis.Internal; @@ -77,4 +78,6 @@ public string Ack(string serverName) { return _prefix + ":internal:ack:" + serverName; } + + public static RedisChannel GetChannel(string channelName) => new RedisChannel(channelName, RedisChannel.PatternMode.Literal); } diff --git a/src/SignalR/server/StackExchangeRedis/src/RedisHubLifetimeManager.cs b/src/SignalR/server/StackExchangeRedis/src/RedisHubLifetimeManager.cs index 84c9e5d41af0..db6ec58f35eb 100644 --- a/src/SignalR/server/StackExchangeRedis/src/RedisHubLifetimeManager.cs +++ b/src/SignalR/server/StackExchangeRedis/src/RedisHubLifetimeManager.cs @@ -123,7 +123,7 @@ public override Task OnDisconnectedAsync(HubConnectionContext connection) var tasks = new List(); RedisLog.Unsubscribe(_logger, connectionChannel); - tasks.Add(_bus.UnsubscribeAsync(connectionChannel)); + tasks.Add(_bus.UnsubscribeAsync(RedisChannels.GetChannel(connectionChannel))); var feature = connection.Features.GetRequiredFeature(); var groupNames = feature.Groups; @@ -324,7 +324,7 @@ private async Task PublishAsync(string channel, byte[] payload) { await EnsureRedisServerConnection(); RedisLog.PublishToChannel(_logger, channel); - return await _bus!.PublishAsync(channel, payload); + return await _bus!.PublishAsync(RedisChannels.GetChannel(channel), payload); } private Task AddGroupAsyncCore(HubConnectionContext connection, string groupName) @@ -357,7 +357,7 @@ await _groups.RemoveSubscriptionAsync(groupChannel, connection, this, static (st { var lifetimeManager = (RedisHubLifetimeManager)state; RedisLog.Unsubscribe(lifetimeManager._logger, channelName); - return lifetimeManager._bus!.UnsubscribeAsync(channelName); + return lifetimeManager._bus!.UnsubscribeAsync(RedisChannels.GetChannel(channelName)); }); var feature = connection.Features.GetRequiredFeature(); @@ -390,7 +390,7 @@ private Task RemoveUserAsync(HubConnectionContext connection) { var lifetimeManager = (RedisHubLifetimeManager)state; RedisLog.Unsubscribe(lifetimeManager._logger, channelName); - return lifetimeManager._bus!.UnsubscribeAsync(channelName); + return lifetimeManager._bus!.UnsubscribeAsync(RedisChannels.GetChannel(channelName)); }); } @@ -480,7 +480,7 @@ public override bool TryGetReturnType(string invocationId, [NotNullWhen(true)] o private async Task SubscribeToAll() { RedisLog.Subscribing(_logger, _channels.All); - var channel = await _bus!.SubscribeAsync(_channels.All); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(_channels.All)); channel.OnMessage(async channelMessage => { try @@ -510,7 +510,7 @@ private async Task SubscribeToAll() private async Task SubscribeToGroupManagementChannel() { - var channel = await _bus!.SubscribeAsync(_channels.GroupManagement); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(_channels.GroupManagement)); channel.OnMessage(async channelMessage => { try @@ -547,7 +547,7 @@ private async Task SubscribeToGroupManagementChannel() private async Task SubscribeToAckChannel() { // Create server specific channel in order to send an ack to a single server - var channel = await _bus!.SubscribeAsync(_channels.Ack(_serverName)); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(_channels.Ack(_serverName))); channel.OnMessage(channelMessage => { var ackId = RedisProtocol.ReadAck((byte[])channelMessage.Message); @@ -561,7 +561,7 @@ private async Task SubscribeToConnection(HubConnectionContext connection) var connectionChannel = _channels.Connection(connection.ConnectionId); RedisLog.Subscribing(_logger, connectionChannel); - var channel = await _bus!.SubscribeAsync(connectionChannel); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(connectionChannel)); channel.OnMessage(channelMessage => { var invocation = RedisProtocol.ReadInvocation((byte[])channelMessage.Message); @@ -618,7 +618,7 @@ private Task SubscribeToUser(HubConnectionContext connection) return _users.AddSubscriptionAsync(userChannel, connection, async (channelName, subscriptions) => { RedisLog.Subscribing(_logger, channelName); - var channel = await _bus!.SubscribeAsync(channelName); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(channelName)); channel.OnMessage(async channelMessage => { try @@ -644,7 +644,7 @@ private Task SubscribeToUser(HubConnectionContext connection) private async Task SubscribeToGroupAsync(string groupChannel, HubConnectionStore groupConnections) { RedisLog.Subscribing(_logger, groupChannel); - var channel = await _bus!.SubscribeAsync(groupChannel); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(groupChannel)); channel.OnMessage(async (channelMessage) => { try @@ -673,7 +673,7 @@ private async Task SubscribeToGroupAsync(string groupChannel, HubConnectionStore private async Task SubscribeToReturnResultsAsync() { - var channel = await _bus!.SubscribeAsync(_channels.ReturnResults); + var channel = await _bus!.SubscribeAsync(RedisChannels.GetChannel(_channels.ReturnResults)); channel.OnMessage((channelMessage) => { var completion = RedisProtocol.ReadCompletion(channelMessage.Message); diff --git a/src/SignalR/server/StackExchangeRedis/test/RedisEndToEnd.cs b/src/SignalR/server/StackExchangeRedis/test/RedisEndToEnd.cs index db4312874c74..6047bbab39ef 100644 --- a/src/SignalR/server/StackExchangeRedis/test/RedisEndToEnd.cs +++ b/src/SignalR/server/StackExchangeRedis/test/RedisEndToEnd.cs @@ -147,6 +147,73 @@ public async Task CanSendAndReceiveUserMessagesWhenOneConnectionWithUserDisconne } } + [ConditionalTheory] + [SkipIfDockerNotPresent] + [MemberData(nameof(TransportTypesAndProtocolTypes))] + public async Task HubConnectionCanSendAndReceiveGroupMessagesGroupNameWithPatternIsTreatedAsLiteral(HttpTransportType transportType, string protocolName) + { + using (StartVerifiableLog()) + { + var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); + + var connection = CreateConnection(_serverFixture.FirstServer.Url + "/echo", transportType, protocol, LoggerFactory); + var secondConnection = CreateConnection(_serverFixture.SecondServer.Url + "/echo", transportType, protocol, LoggerFactory); + + var tcs = new TaskCompletionSource(); + connection.On("Echo", message => tcs.TrySetResult(message)); + var tcs2 = new TaskCompletionSource(); + secondConnection.On("Echo", message => tcs2.TrySetResult(message)); + + var groupName = $"TestGroup_{transportType}_{protocolName}_{Guid.NewGuid()}"; + + await secondConnection.StartAsync().DefaultTimeout(); + await connection.StartAsync().DefaultTimeout(); + await connection.InvokeAsync("AddSelfToGroup", "*").DefaultTimeout(); + await secondConnection.InvokeAsync("AddSelfToGroup", groupName).DefaultTimeout(); + await connection.InvokeAsync("EchoGroup", groupName, "Hello, World!").DefaultTimeout(); + + Assert.Equal("Hello, World!", await tcs2.Task.DefaultTimeout()); + Assert.False(tcs.Task.IsCompleted); + + await connection.InvokeAsync("EchoGroup", "*", "Hello, World!").DefaultTimeout(); + Assert.Equal("Hello, World!", await tcs.Task.DefaultTimeout()); + + await connection.DisposeAsync().DefaultTimeout(); + } + } + + [ConditionalTheory] + [SkipIfDockerNotPresent] + [MemberData(nameof(TransportTypesAndProtocolTypes))] + public async Task CanSendAndReceiveUserMessagesUserNameWithPatternIsTreatedAsLiteral(HttpTransportType transportType, string protocolName) + { + using (StartVerifiableLog()) + { + var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); + + var connection = CreateConnection(_serverFixture.FirstServer.Url + "/echo", transportType, protocol, LoggerFactory, userName: "*"); + var secondConnection = CreateConnection(_serverFixture.SecondServer.Url + "/echo", transportType, protocol, LoggerFactory, userName: "userA"); + + var tcs = new TaskCompletionSource(); + connection.On("Echo", message => tcs.TrySetResult(message)); + var tcs2 = new TaskCompletionSource(); + secondConnection.On("Echo", message => tcs2.TrySetResult(message)); + + await secondConnection.StartAsync().DefaultTimeout(); + await connection.StartAsync().DefaultTimeout(); + await connection.InvokeAsync("EchoUser", "userA", "Hello, World!").DefaultTimeout(); + + Assert.Equal("Hello, World!", await tcs2.Task.DefaultTimeout()); + Assert.False(tcs.Task.IsCompleted); + + await connection.InvokeAsync("EchoUser", "*", "Hello, World!").DefaultTimeout(); + Assert.Equal("Hello, World!", await tcs.Task.DefaultTimeout()); + + await connection.DisposeAsync().DefaultTimeout(); + await secondConnection.DisposeAsync().DefaultTimeout(); + } + } + private static HubConnection CreateConnection(string url, HttpTransportType transportType, IHubProtocol protocol, ILoggerFactory loggerFactory, string userName = null) { var hubConnectionBuilder = new HubConnectionBuilder() diff --git a/src/SignalR/server/StackExchangeRedis/test/RedisHubLifetimeManagerTests.cs b/src/SignalR/server/StackExchangeRedis/test/RedisHubLifetimeManagerTests.cs index 57827e499c67..e6cd2d53e912 100644 --- a/src/SignalR/server/StackExchangeRedis/test/RedisHubLifetimeManagerTests.cs +++ b/src/SignalR/server/StackExchangeRedis/test/RedisHubLifetimeManagerTests.cs @@ -125,6 +125,26 @@ public async Task ErrorFromConnectionFactoryLogsAndAllowsDisconnect() Assert.Equal("throw from connect", logs[0].Exception.Message); } + // Smoke test that Debug.Asserts in TestSubscriber aren't hit + [Fact] + public async Task PatternGroupAndUser() + { + var server = new TestRedisServer(); + using (var client = new TestClient()) + { + var manager = CreateLifetimeManager(server); + + var connection = HubConnectionContextUtils.Create(client.Connection); + connection.UserIdentifier = "*"; + + await manager.OnConnectedAsync(connection).DefaultTimeout(); + + var groupName = "*"; + + await manager.AddToGroupAsync(connection.ConnectionId, groupName).DefaultTimeout(); + } + } + public override TestRedisServer CreateBackplane() { return new TestRedisServer(); diff --git a/src/SignalR/server/StackExchangeRedis/test/TestConnectionMultiplexer.cs b/src/SignalR/server/StackExchangeRedis/test/TestConnectionMultiplexer.cs index 99190e6488ac..56ecea3816b2 100644 --- a/src/SignalR/server/StackExchangeRedis/test/TestConnectionMultiplexer.cs +++ b/src/SignalR/server/StackExchangeRedis/test/TestConnectionMultiplexer.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Net; using System.Reflection; @@ -11,6 +12,7 @@ using System.Threading.Tasks; using StackExchange.Redis; using StackExchange.Redis.Profiling; +using Xunit; namespace Microsoft.AspNetCore.SignalR.Tests; @@ -230,6 +232,8 @@ public class TestRedisServer public long Publish(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None) { + AssertRedisChannel(channel); + if (_subscriptions.TryGetValue(channel, out var handlers)) { lock (handlers) @@ -246,6 +250,8 @@ public long Publish(RedisChannel channel, RedisValue message, CommandFlags flags public void Subscribe(ChannelMessageQueue messageQueue, int subscriberId, CommandFlags flags = CommandFlags.None) { + AssertRedisChannel(messageQueue.Channel); + Action handler = (channel, value) => { // Workaround for https://github.com/StackExchange/StackExchange.Redis/issues/969 @@ -266,6 +272,8 @@ public void Subscribe(ChannelMessageQueue messageQueue, int subscriberId, Comman public void Unsubscribe(RedisChannel channel, int subscriberId, CommandFlags flags = CommandFlags.None) { + AssertRedisChannel(channel); + if (_subscriptions.TryGetValue(channel, out var list)) { lock (list) @@ -274,6 +282,13 @@ public void Unsubscribe(RedisChannel channel, int subscriberId, CommandFlags fla } } } + + internal static void AssertRedisChannel(RedisChannel channel) + { + var patternField = typeof(RedisChannel).GetField("IsPatternBased", BindingFlags.NonPublic | BindingFlags.Instance); + Assert.NotNull(patternField); + Assert.False((bool)patternField.GetValue(channel)); + } } public class TestSubscriber : ISubscriber @@ -319,11 +334,15 @@ public Task PingAsync(CommandFlags flags = CommandFlags.None) public long Publish(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + return _server.Publish(channel, message, flags); } public async Task PublishAsync(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + await Task.Yield(); return Publish(channel, message, flags); } @@ -335,6 +354,8 @@ public void Subscribe(RedisChannel channel, Action han public Task SubscribeAsync(RedisChannel channel, Action handler, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + Subscribe(channel, handler, flags); return Task.CompletedTask; } @@ -351,6 +372,8 @@ public bool TryWait(Task task) public void Unsubscribe(RedisChannel channel, Action handler = null, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + _server.Unsubscribe(channel, _id, flags); } @@ -366,6 +389,8 @@ public Task UnsubscribeAllAsync(CommandFlags flags = CommandFlags.None) public Task UnsubscribeAsync(RedisChannel channel, Action handler = null, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + Unsubscribe(channel, handler, flags); return Task.CompletedTask; } @@ -387,6 +412,8 @@ public void WaitAll(params Task[] tasks) public ChannelMessageQueue Subscribe(RedisChannel channel, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + // Workaround for https://github.com/StackExchange/StackExchange.Redis/issues/969 var redisSubscriberType = typeof(RedisChannel).Assembly.GetType("StackExchange.Redis.RedisSubscriber"); var ctor = typeof(ChannelMessageQueue).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, @@ -400,6 +427,8 @@ public ChannelMessageQueue Subscribe(RedisChannel channel, CommandFlags flags = public Task SubscribeAsync(RedisChannel channel, CommandFlags flags = CommandFlags.None) { + TestRedisServer.AssertRedisChannel(channel); + var t = Subscribe(channel, flags); return Task.FromResult(t); } From e3e2ef17476704c42ab5932e1768ebcfacd9e576 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 7 Jul 2023 14:43:00 +1000 Subject: [PATCH 06/54] [release/7.0] Backport pr 48892 to 7.0 (#48911) * Backport PR 48892. * Fix bug found in unit test on main. --- .../WebSockets/src/ServerWebSocket.cs | 80 ++++++++++ .../WebSockets/src/WebSocketMiddleware.cs | 4 +- .../UnitTests/WebSocketMiddlewareTests.cs | 141 ++++++++++++++++++ 3 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 src/Middleware/WebSockets/src/ServerWebSocket.cs diff --git a/src/Middleware/WebSockets/src/ServerWebSocket.cs b/src/Middleware/WebSockets/src/ServerWebSocket.cs new file mode 100644 index 000000000000..70be31cb0459 --- /dev/null +++ b/src/Middleware/WebSockets/src/ServerWebSocket.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Net.WebSockets; +using Microsoft.AspNetCore.Http; + +namespace Microsoft.AspNetCore.WebSockets; + +/// +/// Used in ASP.NET Core to wrap a WebSocket with its associated HttpContext so that when the WebSocket is aborted +/// the underlying HttpContext is aborted. All other methods are delegated to the underlying WebSocket. +/// +internal sealed class ServerWebSocket : WebSocket +{ + private readonly WebSocket _wrappedSocket; + private readonly HttpContext _context; + + internal ServerWebSocket(WebSocket wrappedSocket, HttpContext context) + { + ArgumentNullException.ThrowIfNull(wrappedSocket); + ArgumentNullException.ThrowIfNull(context); + + _wrappedSocket = wrappedSocket; + _context = context; + } + + public override WebSocketCloseStatus? CloseStatus => _wrappedSocket.CloseStatus; + + public override string? CloseStatusDescription => _wrappedSocket.CloseStatusDescription; + + public override WebSocketState State => _wrappedSocket.State; + + public override string? SubProtocol => _wrappedSocket.SubProtocol; + + public override void Abort() + { + _wrappedSocket.Abort(); + _context.Abort(); + } + + public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken) + { + return _wrappedSocket.CloseAsync(closeStatus, statusDescription, cancellationToken); + } + + public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken) + { + return _wrappedSocket.CloseOutputAsync(closeStatus, statusDescription, cancellationToken); + } + + public override void Dispose() + { + _wrappedSocket.Dispose(); + } + + public override Task ReceiveAsync(ArraySegment buffer, CancellationToken cancellationToken) + { + return _wrappedSocket.ReceiveAsync(buffer, cancellationToken); + } + + public override ValueTask ReceiveAsync(Memory buffer, CancellationToken cancellationToken) + { + return _wrappedSocket.ReceiveAsync(buffer, cancellationToken); + } + + public override ValueTask SendAsync(ReadOnlyMemory buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) + { + return _wrappedSocket.SendAsync(buffer, messageType, endOfMessage, cancellationToken); + } + + public override ValueTask SendAsync(ReadOnlyMemory buffer, WebSocketMessageType messageType, WebSocketMessageFlags messageFlags, CancellationToken cancellationToken) + { + return _wrappedSocket.SendAsync(buffer, messageType, messageFlags, cancellationToken); + } + + public override Task SendAsync(ArraySegment buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) + { + return _wrappedSocket.SendAsync(buffer, messageType, endOfMessage, cancellationToken); + } +} diff --git a/src/Middleware/WebSockets/src/WebSocketMiddleware.cs b/src/Middleware/WebSockets/src/WebSocketMiddleware.cs index 8f2bcca80ef6..0d9f61947c20 100644 --- a/src/Middleware/WebSockets/src/WebSocketMiddleware.cs +++ b/src/Middleware/WebSockets/src/WebSocketMiddleware.cs @@ -207,13 +207,15 @@ public async Task AcceptAsync(WebSocketAcceptContext acceptContext) opaqueTransport = await _upgradeFeature!.UpgradeAsync(); // Sets status code to 101 } - return WebSocket.CreateFromStream(opaqueTransport, new WebSocketCreationOptions() + var wrappedSocket = WebSocket.CreateFromStream(opaqueTransport, new WebSocketCreationOptions() { IsServer = true, KeepAliveInterval = keepAliveInterval, SubProtocol = subProtocol, DangerousDeflateOptions = deflateOptions }); + + return new ServerWebSocket(wrappedSocket, _context); } public static bool CheckSupportedWebSocketRequest(string method, IHeaderDictionary requestHeaders) diff --git a/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs b/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs index 90fa6f08c9c0..a89b161212c6 100644 --- a/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs +++ b/src/Middleware/WebSockets/test/UnitTests/WebSocketMiddlewareTests.cs @@ -5,6 +5,7 @@ using System.Net.Http; using System.Net.WebSockets; using System.Text; +using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Testing; using Microsoft.Net.Http.Headers; @@ -495,6 +496,146 @@ public async Task CloseFromCloseReceived_Success() } } + [Fact] + public async Task WebSocket_Abort_Interrupts_Pending_ReceiveAsync() + { + WebSocket serverSocket = null; + + // Events that we want to sequence execution across client and server. + var socketWasAccepted = new ManualResetEventSlim(); + var socketWasAborted = new ManualResetEventSlim(); + var firstReceiveOccured = new ManualResetEventSlim(); + var secondReceiveInitiated = new ManualResetEventSlim(); + + Exception receiveException = null; + + await using (var server = KestrelWebSocketHelpers.CreateServer(LoggerFactory, out var port, async context => + { + Assert.True(context.WebSockets.IsWebSocketRequest); + serverSocket = await context.WebSockets.AcceptWebSocketAsync(); + socketWasAccepted.Set(); + + var serverBuffer = new byte[1024]; + + try + { + while (serverSocket.State is WebSocketState.Open or WebSocketState.CloseSent) + { + if (firstReceiveOccured.IsSet) + { + var pendingResponse = serverSocket.ReceiveAsync(serverBuffer, default); + secondReceiveInitiated.Set(); + var response = await pendingResponse; + } + else + { + var response = await serverSocket.ReceiveAsync(serverBuffer, default); + firstReceiveOccured.Set(); + } + } + } + catch (ConnectionAbortedException ex) + { + socketWasAborted.Set(); + receiveException = ex; + } + catch (Exception ex) + { + // Capture this exception so a test failure can give us more information. + receiveException = ex; + } + finally + { + Assert.IsType(receiveException); + } + })) + { + var clientBuffer = new byte[1024]; + + using (var client = new ClientWebSocket()) + { + await client.ConnectAsync(new Uri($"ws://127.0.0.1:{port}/"), CancellationToken.None); + + var socketWasAcceptedDidNotTimeout = socketWasAccepted.Wait(10000); + Assert.True(socketWasAcceptedDidNotTimeout, "Socket was not accepted within the allotted time."); + + await client.SendAsync(clientBuffer, WebSocketMessageType.Binary, false, default); + + var firstReceiveOccuredDidNotTimeout = firstReceiveOccured.Wait(10000); + Assert.True(firstReceiveOccuredDidNotTimeout, "First receive did not occur within the allotted time."); + + var secondReceiveInitiatedDidNotTimeout = secondReceiveInitiated.Wait(10000); + Assert.True(secondReceiveInitiatedDidNotTimeout, "Second receive was not initiated within the allotted time."); + + serverSocket.Abort(); + + var socketWasAbortedDidNotTimeout = socketWasAborted.Wait(1000); // Give it a second to process the abort. + Assert.True(socketWasAbortedDidNotTimeout, "Abort did not occur within the allotted time."); + } + } + } + + [Fact] + public async Task WebSocket_AllowsCancelling_Pending_ReceiveAsync_When_CancellationTokenProvided() + { + WebSocket serverSocket = null; + CancellationTokenSource cts = new CancellationTokenSource(); + + var socketWasAccepted = new ManualResetEventSlim(); + var operationWasCancelled = new ManualResetEventSlim(); + var firstReceiveOccured = new ManualResetEventSlim(); + + await using (var server = KestrelWebSocketHelpers.CreateServer(LoggerFactory, out var port, async context => + { + Assert.True(context.WebSockets.IsWebSocketRequest); + serverSocket = await context.WebSockets.AcceptWebSocketAsync(); + socketWasAccepted.Set(); + + var serverBuffer = new byte[1024]; + + var finishedWithOperationCancelled = false; + + try + { + while (serverSocket.State is WebSocketState.Open or WebSocketState.CloseSent) + { + var response = await serverSocket.ReceiveAsync(serverBuffer, cts.Token); + firstReceiveOccured.Set(); + } + } + catch (OperationCanceledException) + { + operationWasCancelled.Set(); + finishedWithOperationCancelled = true; + } + finally + { + Assert.True(finishedWithOperationCancelled); + } + })) + { + var clientBuffer = new byte[1024]; + + using (var client = new ClientWebSocket()) + { + await client.ConnectAsync(new Uri($"ws://127.0.0.1:{port}/"), CancellationToken.None); + + var socketWasAcceptedDidNotTimeout = socketWasAccepted.Wait(10000); + Assert.True(socketWasAcceptedDidNotTimeout, "Socket was not accepted within the allotted time."); + + await client.SendAsync(clientBuffer, WebSocketMessageType.Binary, false, default); + + var firstReceiveOccuredDidNotTimeout = firstReceiveOccured.Wait(10000); + Assert.True(firstReceiveOccuredDidNotTimeout, "First receive did not occur within the allotted time."); + + cts.Cancel(); + + var operationWasCancelledDidNotTimeout = operationWasCancelled.Wait(1000); // Give it a second to process the abort. + Assert.True(operationWasCancelledDidNotTimeout, "Cancel did not occur within the allotted time."); + } + } + } + [Theory] [InlineData(HttpStatusCode.OK, null)] [InlineData(HttpStatusCode.Forbidden, "")] From cb6d26d93d6e85b2b367042833c62d9f773e7727 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Mon, 10 Jul 2023 14:32:12 +0000 Subject: [PATCH 07/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore dnceng/internal/dotnet-runtime --- NuGet.config | 8 ++++---- eng/Version.Details.xml | 36 ++++++++++++++++++------------------ eng/Versions.props | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/NuGet.config b/NuGet.config index 48126d309251..c162e2daf09e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,10 +4,10 @@ - + - + @@ -26,10 +26,10 @@ - + - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 74ed8b941963..2a3833e9f107 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,35 +11,35 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 55c77de6a6b0b40c76ebecef89645a131d58f3f3 + 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://github.com/dotnet/xdt @@ -300,7 +300,7 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 35c9fbc0729d445325c65f9df9bb92df1c771ed7 + 8587d13a2764c025277d628471984bae8e16427c https://github.com/dotnet/arcade diff --git a/eng/Versions.props b/eng/Versions.props index 8cd1406ebd77..9a607df9876e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.10 7.0.10 7.0.10 - 7.0.10-servicing.23355.11 + 7.0.10-servicing.23359.4 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.10-servicing.23355.11 + 7.0.10-servicing.23359.4 7.0.0 7.0.2 7.0.0 From 8a8b4a27bf8b115f8a6e4312693a18061ad1d189 Mon Sep 17 00:00:00 2001 From: wtgodbe Date: Tue, 11 Jul 2023 13:27:31 -0700 Subject: [PATCH 08/54] Update baseline, SDK --- eng/Baseline.Designer.props | 420 ++++++++++++++++++------------------ eng/Baseline.xml | 208 +++++++++--------- eng/Versions.props | 4 +- global.json | 4 +- 4 files changed, 318 insertions(+), 318 deletions(-) diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index 543b6cca8d1f..b1d5699a770c 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -2,28 +2,28 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - - - + + + @@ -35,105 +35,105 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 @@ -141,121 +141,121 @@ - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - - - + + + - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - - + + @@ -263,7 +263,7 @@ - 7.0.7 + 7.0.9 @@ -272,50 +272,50 @@ - 7.0.7 + 7.0.9 - + - + - + - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - - + + @@ -325,8 +325,8 @@ - - + + @@ -334,8 +334,8 @@ - - + + @@ -346,58 +346,58 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 @@ -414,7 +414,7 @@ - 7.0.7 + 7.0.9 @@ -422,71 +422,71 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 - - + + - 7.0.7 + 7.0.9 @@ -502,27 +502,27 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 @@ -531,151 +531,151 @@ - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - - + + - - + + - - + + - 7.0.7 + 7.0.9 - - + + - - + + - - + + - - + + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - - - - + + + + - 7.0.7 + 7.0.9 @@ -684,60 +684,60 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 @@ -756,7 +756,7 @@ - 7.0.7 + 7.0.9 @@ -778,7 +778,7 @@ - 7.0.7 + 7.0.9 @@ -794,46 +794,46 @@ - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - - - + + + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 @@ -843,7 +843,7 @@ - 7.0.7 + 7.0.9 @@ -852,73 +852,73 @@ - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - + - + - + - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 @@ -947,11 +947,11 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 @@ -969,13 +969,13 @@ - 7.0.7 + 7.0.9 - 7.0.7 + 7.0.9 - + \ No newline at end of file diff --git a/eng/Baseline.xml b/eng/Baseline.xml index b428ac509c8f..643cca8262ee 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -4,109 +4,109 @@ This file contains a list of all the packages and their versions which were rele Update this list when preparing for a new patch. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index 3d567eda0d1a..002468f4dddd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 7 0 10 - false + true @@ -238,7 +238,7 @@ 5.0.17-servicing-22215-7 $(MicrosoftAspNetCoreAzureAppServicesSiteExtension50Version) $(MicrosoftAspNetCoreAzureAppServicesSiteExtension50Version) - 6.0.18-servicing-23269-9 + 6.0.20-servicing-23321-6 $(MicrosoftAspNetCoreAzureAppServicesSiteExtension60Version) $(MicrosoftAspNetCoreAzureAppServicesSiteExtension60Version) diff --git a/global.json b/global.json index afc8fc984bd9..0b919edcb4f4 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "7.0.107" + "version": "7.0.109" }, "tools": { - "dotnet": "7.0.107", + "dotnet": "7.0.109", "runtimes": { "dotnet/x86": [ "$(MicrosoftNETCoreBrowserDebugHostTransportVersion)" From e0b934233d74563da2dcdc13a20dbf8c56bbd11c Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Wed, 12 Jul 2023 00:47:57 +0000 Subject: [PATCH 09/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore --- NuGet.config | 4 ++-- eng/Version.Details.xml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NuGet.config b/NuGet.config index c162e2daf09e..864ce92ac8a9 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2a3833e9f107..ebdb88af3bbc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,35 +11,35 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 52e1a71aecf60610d8fdcd2b3ad5a25f0bd635a7 + a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime From 710325ec1053ee0b4e85e52e2a7f0d82d94fb507 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 13:47:54 -0700 Subject: [PATCH 10/54] Update dependencies from https://github.com/dotnet/arcade build 20230711.2 (#49368) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Helix.Sdk From Version 7.0.0-beta.23313.4 -> To Version 7.0.0-beta.23361.2 Co-authored-by: dotnet-maestro[bot] --- NuGet.config | 4 ---- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 4 ++-- global.json | 4 ++-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/NuGet.config b/NuGet.config index 80454d301e83..ecf11c3e4032 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,10 +4,8 @@ - - @@ -26,10 +24,8 @@ - - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 08c476cea384..7c4ca4c4606e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -302,22 +302,22 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 diff --git a/eng/Versions.props b/eng/Versions.props index 002468f4dddd..65db8ee764f1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -134,8 +134,8 @@ 7.0.9 7.0.9 - 7.0.0-beta.23313.4 - 7.0.0-beta.23313.4 + 7.0.0-beta.23361.2 + 7.0.0-beta.23361.2 7.0.0-alpha.1.22505.1 diff --git a/global.json b/global.json index 0b919edcb4f4..7bf29f3341d9 100644 --- a/global.json +++ b/global.json @@ -27,7 +27,7 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.22.10", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23313.4", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23313.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23361.2", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23361.2" } } From 9de1c06c130139a3a24ed9e731154b7b07fb6476 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 12 Jul 2023 22:47:16 +0000 Subject: [PATCH 11/54] Merged PR 32557: [internal/release/7.0] Merge from public Merge from public release/7.0 to internal/release/7.0 and resolve conflicts if necessary --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 4 ++-- global.json | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ebdb88af3bbc..f0c4527215de 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -302,22 +302,22 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 8587d13a2764c025277d628471984bae8e16427c - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 - + https://github.com/dotnet/arcade - 59ac824080b9807fd91dbc8a6d2b4447e74874ab + cae11bc40b691f546d788f7ab37f7eaf0e24ded8 diff --git a/eng/Versions.props b/eng/Versions.props index 1cce93e46fd2..0fcee4be96be 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -134,8 +134,8 @@ 7.0.10 7.0.10 - 7.0.0-beta.23313.4 - 7.0.0-beta.23313.4 + 7.0.0-beta.23361.2 + 7.0.0-beta.23361.2 7.0.0-alpha.1.22505.1 diff --git a/global.json b/global.json index 0b919edcb4f4..7bf29f3341d9 100644 --- a/global.json +++ b/global.json @@ -27,7 +27,7 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.22.10", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23313.4", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23313.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23361.2", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23361.2" } } From cfac574e357da15a2bc486e01236d824ae568d6e Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Wed, 12 Jul 2023 23:30:47 +0000 Subject: [PATCH 12/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore --- NuGet.config | 4 ++-- eng/Version.Details.xml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NuGet.config b/NuGet.config index 864ce92ac8a9..042d8b7b522a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f0c4527215de..d5bcb663feff 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,35 +11,35 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - a4937ab1225f4ebb81ea6f63ee7e5d29706e97d9 + 8907538f3d4da2fffdb0516f05542802585757e6 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime From 2b9d3cfcd710a3808c30b4adb5ac09cab34b3155 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Thu, 13 Jul 2023 07:31:59 +0000 Subject: [PATCH 13/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index 042d8b7b522a..b0d64e701b6f 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d5bcb663feff..16dc8709eb4f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 8587d13a2764c025277d628471984bae8e16427c + dfb685ad0ae6f45be747779be94f02c79b9c7035 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 0fcee4be96be..b6cf15d184ac 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.10 7.0.10 7.0.10 - 7.0.10-servicing.23359.4 + 7.0.10-servicing.23362.17 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.10-servicing.23359.4 + 7.0.10-servicing.23362.17 7.0.0 7.0.2 7.0.0 From 1b6ac8f1fd2891c3a22e3931683a140e8a4abefb Mon Sep 17 00:00:00 2001 From: DotNet-Bot Date: Fri, 14 Jul 2023 03:00:27 +0000 Subject: [PATCH 14/54] Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-runtime build 20230713.12 Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport From Version 7.0.10-servicing.23362.17 -> To Version 7.0.10-servicing.23363.12 --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index b0d64e701b6f..45259ade15af 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 16dc8709eb4f..a2a3057d6787 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - dfb685ad0ae6f45be747779be94f02c79b9c7035 + a6dbb800a47735bde43187350fd3aff4071c7f9c https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index b6cf15d184ac..fbb276d59d1d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.10 7.0.10 7.0.10 - 7.0.10-servicing.23362.17 + 7.0.10-servicing.23363.12 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.10-servicing.23362.17 + 7.0.10-servicing.23363.12 7.0.0 7.0.2 7.0.0 From 5a4c82ec57fadddef9ce841d608de5c7c8c74446 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Sat, 15 Jul 2023 02:25:23 +0000 Subject: [PATCH 15/54] Merged PR 32090: [7.0] Forcibly close socket on abort Forcibly close socket when connection is aborted. --- .../test/Common.LongTests/ShutdownTests.cs | 7 + .../Core/src/Internal/Http/Http1Connection.cs | 9 +- .../src/Internal/Http/Http1MessageBody.cs | 2 +- .../src/Internal/Http2/Http2Connection.cs | 3 +- .../Kestrel/Core/src/KestrelServerOptions.cs | 10 + .../src/Internal/SocketConnection.cs | 17 +- .../src/Internal/SocketsLog.cs | 11 + .../src/SocketConnectionContextFactory.cs | 3 +- .../src/SocketConnectionFactoryOptions.cs | 4 + .../src/SocketTransportOptions.cs | 11 + .../shared/test/StreamBackedTestConnection.cs | 2 +- .../test/TransportTestHelpers/TestServer.cs | 7 +- .../FunctionalTests/Http2/ShutdownTests.cs | 54 +++++ .../test/FunctionalTests/RequestTests.cs | 228 ++++++++++++++++-- .../test/FunctionalTests/ResponseTests.cs | 139 ++++++++--- 15 files changed, 443 insertions(+), 64 deletions(-) diff --git a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs index fe4f3735c2b3..bebd1743f725 100644 --- a/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs +++ b/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs @@ -535,8 +535,15 @@ public async Task ClosesConnectionOnServerAbortOutOfProcess() var response = await deploymentResult.HttpClient.GetAsync("/Abort").TimeoutAfter(TimeoutExtensions.DefaultTimeoutValue); Assert.Equal(HttpStatusCode.BadGateway, response.StatusCode); + +#if NEWSHIM_FUNCTIONALS + // In-proc SocketConnection isn't used and there's no abort // 0x80072f78 ERROR_HTTP_INVALID_SERVER_RESPONSE The server returned an invalid or unrecognized response Assert.Contains("0x80072f78", await response.Content.ReadAsStringAsync()); +#else + // 0x80072efe ERROR_INTERNET_CONNECTION_ABORTED The connection with the server was terminated abnormally + Assert.Contains("0x80072efe", await response.Content.ReadAsStringAsync()); +#endif } catch (HttpRequestException) { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs index 87998e408288..6608c8a2f6e8 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs @@ -98,7 +98,14 @@ protected override void OnRequestProcessingEnded() _http1Output.Dispose(); } - public void OnInputOrOutputCompleted() + void IRequestProcessor.OnInputOrOutputCompleted() + { + // Closed gracefully. + _http1Output.Abort(ServerOptions.FinOnError ? new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient) : null!); + CancelRequestAbortedToken(); + } + + void IHttpOutputAborter.OnInputOrOutputCompleted() { _http1Output.Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient)); CancelRequestAbortedToken(); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs index 5b346164b93b..178326795cb6 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs @@ -204,7 +204,7 @@ protected void ThrowUnexpectedEndOfRequestContent() // so we call OnInputOrOutputCompleted() now to prevent a race in our tests where a 400 // response is written after observing the unexpected end of request content instead of just // closing the connection without a response as expected. - _context.OnInputOrOutputCompleted(); + ((IHttpOutputAborter)_context).OnInputOrOutputCompleted(); KestrelBadHttpRequestException.Throw(RequestRejectionReason.UnexpectedEndOfRequestContent); } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index 45aae35e77c4..10c2766507e0 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -159,7 +159,8 @@ public Http2Connection(HttpConnectionContext context) public void OnInputOrOutputCompleted() { TryClose(); - _frameWriter.Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient)); + var useException = _context.ServiceContext.ServerOptions.FinOnError || _clientActiveStreamCount != 0; + _frameWriter.Abort(useException ? new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient) : null!); } public void Abort(ConnectionAbortedException ex) diff --git a/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs b/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs index ba5c6151b4eb..2d59e83b0975 100644 --- a/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs +++ b/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs @@ -26,10 +26,20 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core; public class KestrelServerOptions { internal const string DisableHttp1LineFeedTerminatorsSwitchKey = "Microsoft.AspNetCore.Server.Kestrel.DisableHttp1LineFeedTerminators"; + private const string FinOnErrorSwitch = "Microsoft.AspNetCore.Server.Kestrel.FinOnError"; + private static readonly bool _finOnError; + + static KestrelServerOptions() + { + AppContext.TryGetSwitch(FinOnErrorSwitch, out _finOnError); + } // internal to fast-path header decoding when RequestHeaderEncodingSelector is unchanged. internal static readonly Func DefaultHeaderEncodingSelector = _ => null; + // Opt-out flag for back compat. Remove in 9.0 (or make public). + internal bool FinOnError { get; set; } = _finOnError; + private Func _requestHeaderEncodingSelector = DefaultHeaderEncodingSelector; private Func _responseHeaderEncodingSelector = DefaultHeaderEncodingSelector; diff --git a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs index fc1be0b47e13..d3a1b8f6927b 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs @@ -30,6 +30,7 @@ internal sealed partial class SocketConnection : TransportConnection private readonly TaskCompletionSource _waitForConnectionClosedTcs = new TaskCompletionSource(); private bool _connectionClosed; private readonly bool _waitForData; + private readonly bool _finOnError; internal SocketConnection(Socket socket, MemoryPool memoryPool, @@ -38,7 +39,8 @@ internal SocketConnection(Socket socket, SocketSenderPool socketSenderPool, PipeOptions inputOptions, PipeOptions outputOptions, - bool waitForData = true) + bool waitForData = true, + bool finOnError = false) { Debug.Assert(socket != null); Debug.Assert(memoryPool != null); @@ -49,6 +51,7 @@ internal SocketConnection(Socket socket, _logger = logger; _waitForData = waitForData; _socketSenderPool = socketSenderPool; + _finOnError = finOnError; LocalEndPoint = _socket.LocalEndPoint; RemoteEndPoint = _socket.RemoteEndPoint; @@ -380,11 +383,21 @@ private void Shutdown(Exception? shutdownReason) // ever observe the nondescript ConnectionAbortedException except for connection middleware attempting // to half close the connection which is currently unsupported. _shutdownReason = shutdownReason ?? new ConnectionAbortedException("The Socket transport's send loop completed gracefully."); + + // NB: not _shutdownReason since we don't want to do this on graceful completion + if (!_finOnError && shutdownReason is not null) + { + SocketsLog.ConnectionWriteRst(_logger, this, shutdownReason.Message); + + // This forces an abortive close with linger time 0 (and implies Dispose) + _socket.Close(timeout: 0); + return; + } + SocketsLog.ConnectionWriteFin(_logger, this, _shutdownReason.Message); try { - // Try to gracefully close the socket even for aborts to match libuv behavior. _socket.Shutdown(SocketShutdown.Both); } catch diff --git a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsLog.cs b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsLog.cs index 7d5c791fc98f..e0cdbf77e5c1 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsLog.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsLog.cs @@ -31,6 +31,17 @@ public static void ConnectionWriteFin(ILogger logger, SocketConnection connectio } } + [LoggerMessage(8, LogLevel.Debug, @"Connection id ""{ConnectionId}"" sending RST because: ""{Reason}""", EventName = "ConnectionWriteRst", SkipEnabledCheck = true)] + private static partial void ConnectionWriteRstCore(ILogger logger, string connectionId, string reason); + + public static void ConnectionWriteRst(ILogger logger, SocketConnection connection, string reason) + { + if (logger.IsEnabled(LogLevel.Debug)) + { + ConnectionWriteRstCore(logger, connection.ConnectionId, reason); + } + } + // Reserved: Event ID 11, EventName = ConnectionWrite // Reserved: Event ID 12, EventName = ConnectionWriteCallback diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs index 4029ddc022de..2bcc98ee11b9 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs @@ -113,7 +113,8 @@ public ConnectionContext Create(Socket socket) setting.SocketSenderPool, setting.InputOptions, setting.OutputOptions, - waitForData: _options.WaitForDataBeforeAllocatingBuffer); + waitForData: _options.WaitForDataBeforeAllocatingBuffer, + finOnError: _options.FinOnError); connection.Start(); return connection; diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionFactoryOptions.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionFactoryOptions.cs index 69d524adf41e..35ce2bd8fd75 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionFactoryOptions.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionFactoryOptions.cs @@ -23,8 +23,12 @@ internal SocketConnectionFactoryOptions(SocketTransportOptions transportOptions) MaxWriteBufferSize = transportOptions.MaxWriteBufferSize; UnsafePreferInlineScheduling = transportOptions.UnsafePreferInlineScheduling; MemoryPoolFactory = transportOptions.MemoryPoolFactory; + FinOnError = transportOptions.FinOnError; } + // Opt-out flag for back compat. Remove in 9.0 (or make public). + internal bool FinOnError { get; set; } + /// /// The number of I/O queues used to process requests. Set to 0 to directly schedule I/O to the ThreadPool. /// diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs index d6d93b08dd19..06ac641e0b51 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs @@ -13,6 +13,17 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets; /// public class SocketTransportOptions { + private const string FinOnErrorSwitch = "Microsoft.AspNetCore.Server.Kestrel.FinOnError"; + private static readonly bool _finOnError; + + static SocketTransportOptions() + { + AppContext.TryGetSwitch(FinOnErrorSwitch, out _finOnError); + } + + // Opt-out flag for back compat. Remove in 9.0 (or make public). + internal bool FinOnError { get; set; } = _finOnError; + /// /// The number of I/O queues used to process requests. Set to 0 to directly schedule I/O to the ThreadPool. /// diff --git a/src/Servers/Kestrel/shared/test/StreamBackedTestConnection.cs b/src/Servers/Kestrel/shared/test/StreamBackedTestConnection.cs index 9edcd7e5c253..787e7ff4bdc7 100644 --- a/src/Servers/Kestrel/shared/test/StreamBackedTestConnection.cs +++ b/src/Servers/Kestrel/shared/test/StreamBackedTestConnection.cs @@ -138,7 +138,7 @@ public async Task ReceiveEnd(params string[] lines) public async Task WaitForConnectionClose() { var buffer = new byte[128]; - var bytesTransferred = await _stream.ReadAsync(buffer, 0, 128).TimeoutAfter(Timeout); + var bytesTransferred = await _stream.ReadAsync(buffer, 0, 128).ContinueWith(t => t.IsFaulted ? 0 : t.Result).TimeoutAfter(Timeout); if (bytesTransferred > 0) { diff --git a/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs b/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs index 5b249eb97d8a..5c322f4eadb8 100644 --- a/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs +++ b/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs @@ -48,7 +48,7 @@ public TestServer(RequestDelegate app, TestServiceContext context, ListenOptions { } - public TestServer(RequestDelegate app, TestServiceContext context, Action configureListenOptions) + public TestServer(RequestDelegate app, TestServiceContext context, Action configureListenOptions, Action configureServices = null) : this(app, context, options => { var listenOptions = new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)) @@ -57,7 +57,10 @@ public TestServer(RequestDelegate app, TestServiceContext context, Action { }) + }, s => + { + configureServices?.Invoke(s); + }) { } diff --git a/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs b/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs index 26fe5d07d0bc..037d6a1cd8cd 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs @@ -44,6 +44,60 @@ public ShutdownTests() }; } + [ConditionalFact] + public async Task ConnectionClosedWithoutActiveRequestsOrGoAwayFIN() + { + var connectionClosed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var readFin = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var writeFin = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + TestSink.MessageLogged += context => + { + + if (context.EventId.Name == "Http2ConnectionClosed") + { + connectionClosed.SetResult(); + } + else if (context.EventId.Name == "ConnectionReadFin") + { + readFin.SetResult(); + } + else if (context.EventId.Name == "ConnectionWriteFin") + { + writeFin.SetResult(); + } + }; + + var testContext = new TestServiceContext(LoggerFactory); + + testContext.InitializeHeartbeat(); + + await using (var server = new TestServer(context => + { + return context.Response.WriteAsync("hello world " + context.Request.Protocol); + }, + testContext, + kestrelOptions => + { + kestrelOptions.Listen(IPAddress.Loopback, 0, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + listenOptions.UseHttps(_x509Certificate2); + }); + })) + { + var response = await Client.GetStringAsync($"https://localhost:{server.Port}/"); + Assert.Equal("hello world HTTP/2", response); + Client.Dispose(); // Close the socket, no GoAway is sent. + + await readFin.Task.DefaultTimeout(); + await writeFin.Task.DefaultTimeout(); + await connectionClosed.Task.DefaultTimeout(); + + await server.StopAsync(); + } + } + [CollectDump] [ConditionalFact] public async Task GracefulShutdownWaitsForRequestsToFinish() diff --git a/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs b/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs index fff5268a4bbb..e1d4cdd6886a 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs @@ -21,7 +21,9 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.FunctionalTests; +using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets; using Microsoft.AspNetCore.Testing; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Moq; @@ -38,6 +40,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests; public class RequestTests : LoggedTest { private const int _connectionStartedEventId = 1; + private const int _connectionReadFinEventId = 6; private const int _connectionResetEventId = 19; private static readonly int _semaphoreWaitTimeout = Debugger.IsAttached ? 10000 : 2500; @@ -232,6 +235,58 @@ await connection2.Receive($"HTTP/1.1 200 OK", } } + [Fact] + public async Task ConnectionClosedPriorToRequestIsLoggedAsDebug() + { + var connectionStarted = new SemaphoreSlim(0); + var connectionReadFin = new SemaphoreSlim(0); + var loggedHigherThanDebug = false; + + TestSink.MessageLogged += context => + { + if (context.LoggerName != "Microsoft.AspNetCore.Server.Kestrel" && + context.LoggerName != "Microsoft.AspNetCore.Server.Kestrel.Connections" && + context.LoggerName != "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets") + { + return; + } + + if (context.EventId.Id == _connectionStartedEventId) + { + connectionStarted.Release(); + } + else if (context.EventId.Id == _connectionReadFinEventId) + { + connectionReadFin.Release(); + } + + if (context.LogLevel > LogLevel.Debug) + { + loggedHigherThanDebug = true; + } + }; + + await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory))) + { + using (var connection = server.CreateConnection()) + { + // Wait until connection is established + Assert.True(await connectionStarted.WaitAsync(TestConstants.DefaultTimeout)); + + connection.ShutdownSend(); + + // If the reset is correctly logged as Debug, the wait below should complete shortly. + // This check MUST come before disposing the server, otherwise there's a race where the RST + // is still in flight when the connection is aborted, leading to the reset never being received + // and therefore not logged. + Assert.True(await connectionReadFin.WaitAsync(TestConstants.DefaultTimeout)); + await connection.ReceiveEnd(); + } + } + + Assert.False(loggedHigherThanDebug); + } + [Fact] public async Task ConnectionResetPriorToRequestIsLoggedAsDebug() { @@ -283,6 +338,65 @@ public async Task ConnectionResetPriorToRequestIsLoggedAsDebug() Assert.False(loggedHigherThanDebug); } + [Fact] + public async Task ConnectionClosedBetweenRequestsIsLoggedAsDebug() + { + var connectionReadFin = new SemaphoreSlim(0); + var loggedHigherThanDebug = false; + + TestSink.MessageLogged += context => + { + if (context.LoggerName != "Microsoft.AspNetCore.Server.Kestrel" && + context.LoggerName != "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets") + { + return; + } + + if (context.LogLevel > LogLevel.Debug) + { + loggedHigherThanDebug = true; + } + + if (context.EventId.Id == _connectionReadFinEventId) + { + connectionReadFin.Release(); + } + }; + + await using (var server = new TestServer(context => Task.CompletedTask, new TestServiceContext(LoggerFactory))) + { + using (var connection = server.CreateConnection()) + { + await connection.Send( + "GET / HTTP/1.1", + "Host:", + "", + ""); + + // Make sure the response is fully received, so a write failure (e.g. EPIPE) doesn't cause + // a more critical log message. + await connection.Receive( + "HTTP/1.1 200 OK", + "Content-Length: 0", + $"Date: {server.Context.DateHeaderValue}", + "", + ""); + + connection.ShutdownSend(); + + // If the reset is correctly logged as Debug, the wait below should complete shortly. + // This check MUST come before disposing the server, otherwise there's a race where the RST + // is still in flight when the connection is aborted, leading to the reset never being received + // and therefore not logged. + Assert.True(await connectionReadFin.WaitAsync(TestConstants.DefaultTimeout)); + + await connection.ReceiveEnd(); + } + } + + Assert.False(loggedHigherThanDebug); + } + [Fact] public async Task ConnectionResetBetweenRequestsIsLoggedAsDebug() { @@ -341,10 +455,13 @@ await connection.Receive( Assert.False(loggedHigherThanDebug); } - [Fact] - public async Task ConnectionResetMidRequestIsLoggedAsDebug() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ConnectionClosedOrResetMidRequestIsLoggedAsDebug(bool close) { var requestStarted = new SemaphoreSlim(0); + var connectionReadFin = new SemaphoreSlim(0); var connectionReset = new SemaphoreSlim(0); var connectionClosing = new SemaphoreSlim(0); var loggedHigherThanDebug = false; @@ -362,6 +479,11 @@ public async Task ConnectionResetMidRequestIsLoggedAsDebug() loggedHigherThanDebug = true; } + if (context.EventId.Id == _connectionReadFinEventId) + { + connectionReadFin.Release(); + } + if (context.EventId.Id == _connectionResetEventId) { connectionReset.Release(); @@ -382,15 +504,23 @@ public async Task ConnectionResetMidRequestIsLoggedAsDebug() // Wait until connection is established Assert.True(await requestStarted.WaitAsync(TestConstants.DefaultTimeout), "request should have started"); - connection.Reset(); - } + if (close) + { + connection.ShutdownSend(); + Assert.True(await connectionReadFin.WaitAsync(TestConstants.DefaultTimeout), "Connection close event should have been logged"); + } + else + { + connection.Reset(); - // If the reset is correctly logged as Debug, the wait below should complete shortly. - // This check MUST come before disposing the server, otherwise there's a race where the RST - // is still in flight when the connection is aborted, leading to the reset never being received - // and therefore not logged. - Assert.True(await connectionReset.WaitAsync(TestConstants.DefaultTimeout), "Connection reset event should have been logged"); - connectionClosing.Release(); + // If the reset is correctly logged as Debug, the wait below should complete shortly. + // This check MUST come before disposing the server, otherwise there's a race where the RST + // is still in flight when the connection is aborted, leading to the reset never being received + // and therefore not logged. + Assert.True(await connectionReset.WaitAsync(TestConstants.DefaultTimeout), "Connection reset event should have been logged"); + } + connectionClosing.Release(); + } } Assert.False(loggedHigherThanDebug, "Logged event should not have been higher than debug."); @@ -534,14 +664,23 @@ await connection1.Send( Assert.Equal(beforeAbort.Value, afterAbort.Value); } - [Fact] - public async Task AbortingTheConnectionSendsFIN() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task AbortingTheConnection(bool fin) { var builder = TransportSelector.GetHostBuilder() .ConfigureWebHost(webHostBuilder => { webHostBuilder - .UseKestrel() + .UseSockets(options => + { + options.FinOnError = fin; + }) + .UseKestrel(o => + { + o.FinOnError = fin; + }) .UseUrls("http://127.0.0.1:0") .Configure(app => app.Run(context => { @@ -559,8 +698,15 @@ public async Task AbortingTheConnectionSendsFIN() { socket.Connect(new IPEndPoint(IPAddress.Loopback, host.GetPort())); socket.Send(Encoding.ASCII.GetBytes("GET / HTTP/1.1\r\nHost:\r\n\r\n")); - int result = socket.Receive(new byte[32]); - Assert.Equal(0, result); + if (fin) + { + int result = socket.Receive(new byte[32]); + Assert.Equal(0, result); + } + else + { + Assert.Throws(() => socket.Receive(new byte[32])); + } } await host.StopAsync(); @@ -770,16 +916,21 @@ await connection.Send("POST / HTTP/1.1", } [Theory] - [MemberData(nameof(ConnectionMiddlewareDataName))] - public async Task ServerCanAbortConnectionAfterUnobservedClose(string listenOptionsName) + [InlineData("Loopback", true)] + [InlineData("Loopback", false)] + [InlineData("PassThrough", true)] + [InlineData("PassThrough", false)] + public async Task ServerCanAbortConnectionAfterUnobservedClose(string listenOptionsName, bool fin) { const int connectionPausedEventId = 4; const int connectionFinSentEventId = 7; + const int connectionRstSentEventId = 8; const int maxRequestBufferSize = 4096; var readCallbackUnwired = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var clientClosedConnection = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - var serverClosedConnection = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var serverFinConnection = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var serverRstConnection = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var appFuncCompleted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => @@ -795,7 +946,11 @@ public async Task ServerCanAbortConnectionAfterUnobservedClose(string listenOpti } else if (context.EventId == connectionFinSentEventId) { - serverClosedConnection.SetResult(); + serverFinConnection.SetResult(); + } + else if (context.EventId == connectionRstSentEventId) + { + serverRstConnection.SetResult(); } }; @@ -803,6 +958,7 @@ public async Task ServerCanAbortConnectionAfterUnobservedClose(string listenOpti { ServerOptions = { + FinOnError = fin, Limits = { MaxRequestBufferSize = maxRequestBufferSize, @@ -820,10 +976,30 @@ public async Task ServerCanAbortConnectionAfterUnobservedClose(string listenOpti context.Abort(); - await serverClosedConnection.Task; + if (fin) + { + await serverFinConnection.Task.DefaultTimeout(); + } + else + { + await serverRstConnection.Task.DefaultTimeout(); + } appFuncCompleted.SetResult(); - }, testContext, ConnectionMiddlewareData[listenOptionsName]())) + }, testContext, listen => + { + if (listenOptionsName == "PassThrough") + { + listen.UsePassThrough(); + } + }, + services => + { + services.Configure(options => + { + options.FinOnError = fin; + }); + })) { using (var connection = server.CreateConnection()) { @@ -949,21 +1125,21 @@ await context.Response.WriteAsync(JsonConvert.SerializeObject(new private static async Task AssertStreamContains(Stream stream, string expectedSubstring) { var expectedBytes = Encoding.ASCII.GetBytes(expectedSubstring); - var exptectedLength = expectedBytes.Length; - var responseBuffer = new byte[exptectedLength]; + var expectedLength = expectedBytes.Length; + var responseBuffer = new byte[expectedLength]; var matchedChars = 0; - while (matchedChars < exptectedLength) + while (matchedChars < expectedLength) { - var count = await stream.ReadAsync(responseBuffer, 0, exptectedLength - matchedChars).DefaultTimeout(); + var count = await stream.ReadAsync(responseBuffer, 0, expectedLength - matchedChars).DefaultTimeout(); if (count == 0) { Assert.True(false, "Stream completed without expected substring."); } - for (var i = 0; i < count && matchedChars < exptectedLength; i++) + for (var i = 0; i < count && matchedChars < expectedLength; i++) { if (responseBuffer[i] == expectedBytes[matchedChars]) { diff --git a/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs b/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs index fb0b7446a3ab..d631a1c51ab5 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs @@ -22,7 +22,9 @@ using Microsoft.AspNetCore.Server.Kestrel.FunctionalTests; using Microsoft.AspNetCore.Server.Kestrel.Https; using Microsoft.AspNetCore.Server.Kestrel.Https.Internal; +using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets; using Microsoft.AspNetCore.Testing; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; @@ -453,8 +455,10 @@ await connection.Send( Assert.Empty(coreLogs.Where(w => w.LogLevel > LogLevel.Information)); } - [Fact] - public async Task ConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate(bool fin) { var logger = LoggerFactory.CreateLogger($"{ typeof(ResponseTests).FullName}.{ nameof(ConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate)}"); const int chunkSize = 1024; @@ -464,18 +468,27 @@ public async Task ConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate() var responseRateTimeoutMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var connectionStopMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var connectionWriteFinMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var connectionWriteRstMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var requestAborted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var appFuncCompleted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => { - if (context.EventId.Name == "ResponseMinimumDataRateNotSatisfied") - { - responseRateTimeoutMessageLogged.SetResult(); - } - if (context.EventId.Name == "ConnectionStop") + switch (context.EventId.Name) { - connectionStopMessageLogged.SetResult(); + case "ResponseMinimumDataRateNotSatisfied": + responseRateTimeoutMessageLogged.SetResult(); + break; + case "ConnectionStop": + connectionStopMessageLogged.SetResult(); + break; + case "ConnectionWriteFin": + connectionWriteFinMessageLogged.SetResult(); + break; + case "ConnectionWriteRst": + connectionWriteRstMessageLogged.SetResult(); + break; } }; @@ -483,6 +496,7 @@ public async Task ConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate() { ServerOptions = { + FinOnError = fin, Limits = { MinResponseDataRate = new MinDataRate(bytesPerSecond: 1024 * 1024, gracePeriod: TimeSpan.FromSeconds(2)) @@ -528,7 +542,14 @@ async Task App(HttpContext context) } } - await using (var server = new TestServer(App, testContext)) + await using (var server = new TestServer(App, testContext, configureListenOptions: _ => { }, + services => + { + services.Configure(o => + { + o.FinOnError = fin; + }); + })) { using (var connection = server.CreateConnection()) { @@ -548,6 +569,14 @@ await connection.Send( await requestAborted.Task.DefaultTimeout(TimeSpan.FromSeconds(30)); await responseRateTimeoutMessageLogged.Task.DefaultTimeout(); await connectionStopMessageLogged.Task.DefaultTimeout(); + if (fin) + { + await connectionWriteFinMessageLogged.Task.DefaultTimeout(); + } + else + { + await connectionWriteRstMessageLogged.Task.DefaultTimeout(); + } await appFuncCompleted.Task.DefaultTimeout(); await AssertStreamAborted(connection.Stream, chunkSize * chunks); @@ -557,8 +586,10 @@ await connection.Send( } } - [Fact] - public async Task HttpsConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task HttpsConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate(bool fin) { const int chunkSize = 1024; const int chunks = 256 * 1024; @@ -568,18 +599,27 @@ public async Task HttpsConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate var responseRateTimeoutMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var connectionStopMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var connectionWriteFinMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var connectionWriteRstMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var aborted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var appFuncCompleted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => { - if (context.EventId.Name == "ResponseMinimumDataRateNotSatisfied") - { - responseRateTimeoutMessageLogged.SetResult(); - } - if (context.EventId.Name == "ConnectionStop") + switch (context.EventId.Name) { - connectionStopMessageLogged.SetResult(); + case "ResponseMinimumDataRateNotSatisfied": + responseRateTimeoutMessageLogged.SetResult(); + break; + case "ConnectionStop": + connectionStopMessageLogged.SetResult(); + break; + case "ConnectionWriteFin": + connectionWriteFinMessageLogged.SetResult(); + break; + case "ConnectionWriteRst": + connectionWriteRstMessageLogged.SetResult(); + break; } }; @@ -587,6 +627,7 @@ public async Task HttpsConnectionClosedWhenResponseDoesNotSatisfyMinimumDataRate { ServerOptions = { + FinOnError = fin, Limits = { MinResponseDataRate = new MinDataRate(bytesPerSecond: 1024 * 1024, gracePeriod: TimeSpan.FromSeconds(2)) @@ -626,7 +667,14 @@ void ConfigureListenOptions(ListenOptions listenOptions) { await aborted.Task.DefaultTimeout(); } - }, testContext, ConfigureListenOptions)) + }, testContext, ConfigureListenOptions, + services => + { + services.Configure(o => + { + o.FinOnError = fin; + }); + })) { using (var connection = server.CreateConnection()) { @@ -641,6 +689,14 @@ void ConfigureListenOptions(ListenOptions listenOptions) await aborted.Task.DefaultTimeout(TimeSpan.FromSeconds(30)); await responseRateTimeoutMessageLogged.Task.DefaultTimeout(); await connectionStopMessageLogged.Task.DefaultTimeout(); + if (fin) + { + await connectionWriteFinMessageLogged.Task.DefaultTimeout(); + } + else + { + await connectionWriteRstMessageLogged.Task.DefaultTimeout(); + } await appFuncCompleted.Task.DefaultTimeout(); await AssertStreamAborted(connection.Stream, chunkSize * chunks); @@ -649,8 +705,10 @@ void ConfigureListenOptions(ListenOptions listenOptions) } } - [Fact] - public async Task ConnectionClosedWhenBothRequestAndResponseExperienceBackPressure() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ConnectionClosedWhenBothRequestAndResponseExperienceBackPressure(bool fin) { const int bufferSize = 65536; const int bufferCount = 100; @@ -659,18 +717,27 @@ public async Task ConnectionClosedWhenBothRequestAndResponseExperienceBackPressu var responseRateTimeoutMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var connectionStopMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var connectionWriteFinMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var connectionWriteRstMessageLogged = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var requestAborted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var copyToAsyncCts = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TestSink.MessageLogged += context => { - if (context.EventId.Name == "ResponseMinimumDataRateNotSatisfied") - { - responseRateTimeoutMessageLogged.SetResult(); - } - if (context.EventId.Name == "ConnectionStop") + switch (context.EventId.Name) { - connectionStopMessageLogged.SetResult(); + case "ResponseMinimumDataRateNotSatisfied": + responseRateTimeoutMessageLogged.SetResult(); + break; + case "ConnectionStop": + connectionStopMessageLogged.SetResult(); + break; + case "ConnectionWriteFin": + connectionWriteFinMessageLogged.SetResult(); + break; + case "ConnectionWriteRst": + connectionWriteRstMessageLogged.SetResult(); + break; } }; @@ -678,6 +745,7 @@ public async Task ConnectionClosedWhenBothRequestAndResponseExperienceBackPressu { ServerOptions = { + FinOnError = fin, Limits = { MinResponseDataRate = new MinDataRate(bytesPerSecond: 1024 * 1024, gracePeriod: TimeSpan.FromSeconds(2)), @@ -688,8 +756,6 @@ public async Task ConnectionClosedWhenBothRequestAndResponseExperienceBackPressu testContext.InitializeHeartbeat(); - var listenOptions = new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)); - async Task App(HttpContext context) { context.RequestAborted.Register(() => @@ -714,7 +780,14 @@ async Task App(HttpContext context) copyToAsyncCts.SetException(new Exception("This shouldn't be reached.")); } - await using (var server = new TestServer(App, testContext, listenOptions)) + await using (var server = new TestServer(App, testContext, configureListenOptions: _ => { }, + services => + { + services.Configure(o => + { + o.FinOnError = fin; + }); + })) { using (var connection = server.CreateConnection()) { @@ -739,6 +812,14 @@ await connection.Send( await requestAborted.Task.DefaultTimeout(TimeSpan.FromSeconds(30)); await responseRateTimeoutMessageLogged.Task.DefaultTimeout(); await connectionStopMessageLogged.Task.DefaultTimeout(); + if (fin) + { + await connectionWriteFinMessageLogged.Task.DefaultTimeout(); + } + else + { + await connectionWriteRstMessageLogged.Task.DefaultTimeout(); + } // Expect OperationCanceledException instead of IOException because the server initiated the abort due to a response rate timeout. await Assert.ThrowsAnyAsync(() => copyToAsyncCts.Task).DefaultTimeout(); From 2069f59a23dd4bd2c7c89a09e8f82578ac535ca4 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Wed, 2 Aug 2023 12:35:21 +0000 Subject: [PATCH 16/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 10 ++++++++-- eng/Version.Details.xml | 28 ++++++++++++++-------------- eng/Versions.props | 14 +++++++------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/NuGet.config b/NuGet.config index 45259ade15af..6cdecfbd4f9d 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,9 +5,12 @@ + + + - + @@ -26,10 +29,13 @@ + + + - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a2a3057d6787..fd5e6abbafc0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 https://github.com/dotnet/source-build-externals @@ -262,33 +262,33 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index fbb276d59d1d..0b926796701a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -63,12 +63,12 @@ 7.0.0 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10-servicing.23363.12 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11-servicing.23401.19 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.10-servicing.23363.12 + 7.0.11-servicing.23401.19 7.0.0 7.0.2 7.0.0 From 968b887be965e28454754e21e477ada76e04e47c Mon Sep 17 00:00:00 2001 From: vseanreesermsft <78103370+vseanreesermsft@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:58:49 -0700 Subject: [PATCH 17/54] Update branding to 7.0.11 (#49779) --- eng/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 65db8ee764f1..dea01128fea8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,8 +8,8 @@ 7 0 - 10 - true + 11 + false From 45889dbc64b18e21a2307c75091763c1fd4959f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:38:25 +0000 Subject: [PATCH 18/54] [release/7.0] (deps): Bump src/submodules/googletest (#49771) Bumps [src/submodules/googletest](https://github.com/google/googletest) from `be03d00` to `6f6ab42`. - [Release notes](https://github.com/google/googletest/releases) - [Commits](https://github.com/google/googletest/compare/be03d00f5f0cc3a997d1a368bee8a1fe93651f48...6f6ab4212aa02cfe02e480711246da4fc17b0761) --- updated-dependencies: - dependency-name: src/submodules/googletest dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/submodules/googletest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/submodules/googletest b/src/submodules/googletest index be03d00f5f0c..6f6ab4212aa0 160000 --- a/src/submodules/googletest +++ b/src/submodules/googletest @@ -1 +1 @@ -Subproject commit be03d00f5f0cc3a997d1a368bee8a1fe93651f48 +Subproject commit 6f6ab4212aa02cfe02e480711246da4fc17b0761 From 7137c04792688866f9dc707ea5caa77ba32e5db8 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Wed, 2 Aug 2023 20:06:13 +0000 Subject: [PATCH 19/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore --- NuGet.config | 10 ++-------- eng/Version.Details.xml | 32 ++++++++++++++++---------------- eng/Versions.props | 16 ++++++++-------- 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/NuGet.config b/NuGet.config index 6cdecfbd4f9d..e07ce51ff1c2 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,10 +4,7 @@ - - - - + @@ -29,10 +26,7 @@ - - - - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fd5e6abbafc0..010e80d827e3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,37 +9,37 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + 0afdda5ce04425a8d4ab89137458752ed6e60494 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime diff --git a/eng/Versions.props b/eng/Versions.props index cf81f9cc1e70..372cf8a2dc89 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -125,14 +125,14 @@ 7.0.4 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 + 7.0.11 7.0.0-beta.23361.2 7.0.0-beta.23361.2 From 09c4b505c9d6bf972d51da2a5fb9061c9cb46a2c Mon Sep 17 00:00:00 2001 From: wtgodbe Date: Tue, 8 Aug 2023 12:00:09 -0700 Subject: [PATCH 20/54] Update baseline, SDK --- eng/Baseline.Designer.props | 420 ++++++++++++++++++------------------ eng/Baseline.xml | 208 +++++++++--------- eng/Versions.props | 2 +- global.json | 4 +- 4 files changed, 317 insertions(+), 317 deletions(-) diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index b1d5699a770c..8c7fa19269fc 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -2,28 +2,28 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - - - + + + @@ -35,105 +35,105 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 @@ -141,121 +141,121 @@ - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - - - + + + - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - - + + @@ -263,7 +263,7 @@ - 7.0.9 + 7.0.10 @@ -272,50 +272,50 @@ - 7.0.9 + 7.0.10 - + - + - + - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - - + + @@ -325,8 +325,8 @@ - - + + @@ -334,8 +334,8 @@ - - + + @@ -346,58 +346,58 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 @@ -414,7 +414,7 @@ - 7.0.9 + 7.0.10 @@ -422,71 +422,71 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 - - + + - 7.0.9 + 7.0.10 @@ -502,27 +502,27 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 @@ -531,151 +531,151 @@ - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - - + + - - + + - - + + - 7.0.9 + 7.0.10 - - + + - - + + - - + + - - + + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - - - - + + + + - 7.0.9 + 7.0.10 @@ -684,60 +684,60 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 @@ -756,7 +756,7 @@ - 7.0.9 + 7.0.10 @@ -778,7 +778,7 @@ - 7.0.9 + 7.0.10 @@ -794,46 +794,46 @@ - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - - - + + + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 @@ -843,7 +843,7 @@ - 7.0.9 + 7.0.10 @@ -852,73 +852,73 @@ - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - + - + - + - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 @@ -947,11 +947,11 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 @@ -969,13 +969,13 @@ - 7.0.9 + 7.0.10 - 7.0.9 + 7.0.10 - + \ No newline at end of file diff --git a/eng/Baseline.xml b/eng/Baseline.xml index 643cca8262ee..7f521c84aeeb 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -4,109 +4,109 @@ This file contains a list of all the packages and their versions which were rele Update this list when preparing for a new patch. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index a49a1944cfb3..55d235c2a412 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 7 0 11 - false + true diff --git a/global.json b/global.json index 7bf29f3341d9..e72eef56ee09 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "7.0.109" + "version": "7.0.110" }, "tools": { - "dotnet": "7.0.109", + "dotnet": "7.0.110", "runtimes": { "dotnet/x86": [ "$(MicrosoftNETCoreBrowserDebugHostTransportVersion)" From 11d3ae0996ef0eaa8b96983458699fee30b2d107 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:03:40 +0000 Subject: [PATCH 21/54] Update dependencies from https://github.com/dotnet/arcade build 20230808.3 (#49955) [release/7.0] Update dependencies from dotnet/arcade --- NuGet.config | 4 ---- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 4 ++-- global.json | 4 ++-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/NuGet.config b/NuGet.config index 45259ade15af..ecf11c3e4032 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,10 +4,8 @@ - - @@ -26,10 +24,8 @@ - - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a2a3057d6787..f6744d85a055 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -302,22 +302,22 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 8587d13a2764c025277d628471984bae8e16427c - + https://github.com/dotnet/arcade - cae11bc40b691f546d788f7ab37f7eaf0e24ded8 + 3b8f3de4606c338f99e8ce85cfb6f960f6a428c8 - + https://github.com/dotnet/arcade - cae11bc40b691f546d788f7ab37f7eaf0e24ded8 + 3b8f3de4606c338f99e8ce85cfb6f960f6a428c8 - + https://github.com/dotnet/arcade - cae11bc40b691f546d788f7ab37f7eaf0e24ded8 + 3b8f3de4606c338f99e8ce85cfb6f960f6a428c8 - + https://github.com/dotnet/arcade - cae11bc40b691f546d788f7ab37f7eaf0e24ded8 + 3b8f3de4606c338f99e8ce85cfb6f960f6a428c8 diff --git a/eng/Versions.props b/eng/Versions.props index 55d235c2a412..a35b4d04926e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -134,8 +134,8 @@ 7.0.10 7.0.10 - 7.0.0-beta.23361.2 - 7.0.0-beta.23361.2 + 7.0.0-beta.23408.3 + 7.0.0-beta.23408.3 7.0.0-alpha.1.22505.1 diff --git a/global.json b/global.json index e72eef56ee09..73543a53a4dd 100644 --- a/global.json +++ b/global.json @@ -27,7 +27,7 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.22.10", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23361.2", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23361.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23408.3", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23408.3" } } From 54a9c7ff22c8c56e83af8cbf7d7d3dd0ac6fd715 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Thu, 10 Aug 2023 04:32:26 +0000 Subject: [PATCH 22/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore --- NuGet.config | 4 ++-- eng/Version.Details.xml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NuGet.config b/NuGet.config index e07ce51ff1c2..aacf44110e50 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 976a5129b6bc..438f394b7396 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,35 +11,35 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 0afdda5ce04425a8d4ab89137458752ed6e60494 + 8133d0c827462d8d84e47b70f294fc060a5d7a84 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime From 4914e2efacde6f7f291b5277bbbc308fef9b9dc3 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Fri, 11 Aug 2023 00:48:26 +0000 Subject: [PATCH 23/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index aacf44110e50..8107b7fe1e6c 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 438f394b7396..b4b798e7d55c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 1240fb471790b1fdeaf6b30c3e1249e6c8c39684 + b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index d58057737ff3..e4d18d99a0f9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23401.19 + 7.0.11-servicing.23410.6 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23401.19 + 7.0.11-servicing.23410.6 7.0.0 7.0.2 7.0.0 From 76f241a15db5b25be1dc961d4cad47b53b20c287 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Sat, 12 Aug 2023 08:10:29 +0000 Subject: [PATCH 24/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index 8107b7fe1e6c..524c5fa66883 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b4b798e7d55c..09b0cb8412d1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - b5fd2d6937dc7ae05513a980a8ba8a66c49e84f7 + fbd46f34cbd2984c2b8103b13957d03c41f82b4f https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index e4d18d99a0f9..5cdc35fdd51f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23410.6 + 7.0.11-servicing.23411.15 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23410.6 + 7.0.11-servicing.23411.15 7.0.0 7.0.2 7.0.0 From 18b91215fc28924d0413102fbe5c03b9a83c07a2 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Tue, 15 Aug 2023 12:23:38 +0000 Subject: [PATCH 25/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index 524c5fa66883..c75eb27e25da 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 09b0cb8412d1..407af8b14d67 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fbd46f34cbd2984c2b8103b13957d03c41f82b4f + 550fcebfd1443fa888d64e97385b2eface2b14de https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 5cdc35fdd51f..4bfe93717419 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23411.15 + 7.0.11-servicing.23414.23 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23411.15 + 7.0.11-servicing.23414.23 7.0.0 7.0.2 7.0.0 From 63c4da1aae46c85c1bd3c2e8898b05615325982b Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Wed, 16 Aug 2023 02:52:03 +0000 Subject: [PATCH 26/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index c75eb27e25da..c399674aab73 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 407af8b14d67..148c9286fb17 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 550fcebfd1443fa888d64e97385b2eface2b14de + 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 4bfe93717419..5c818b803075 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23414.23 + 7.0.11-servicing.23415.9 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23414.23 + 7.0.11-servicing.23415.9 7.0.0 7.0.2 7.0.0 From 29b232880d00408f61601fd63a87d54784dde835 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Wed, 16 Aug 2023 07:03:57 +0000 Subject: [PATCH 27/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 18 +++++++++--------- eng/Versions.props | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NuGet.config b/NuGet.config index c399674aab73..faa9cbcdf5e0 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 148c9286fb17..9dd44d97893e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 https://github.com/dotnet/source-build-externals @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 0d1a6085ed5d9bec4ec021ed668fcd23bb9f3df0 + de7841221e4ad56750e452db8ac4eab459b2ab23 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 5c818b803075..1f1bb15af521 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23415.9 + 7.0.11-servicing.23415.17 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23415.9 + 7.0.11-servicing.23415.17 7.0.0 7.0.2 7.0.0 From ca391f2da06e3a73c3391e4274d142a7868c58b3 Mon Sep 17 00:00:00 2001 From: DotNet-Bot Date: Tue, 22 Aug 2023 16:33:09 +0000 Subject: [PATCH 28/54] Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-runtime build 20230818.12 Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , System.Threading.RateLimiting From Version 7.0.11-servicing.23415.17 -> To Version 7.0.11-servicing.23418.12 --- NuGet.config | 4 ++-- eng/Version.Details.xml | 22 +++++++++++----------- eng/Versions.props | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/NuGet.config b/NuGet.config index faa9cbcdf5e0..5be6140cdcac 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9dd44d97893e..a98bdea72e84 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 https://github.com/dotnet/source-build-externals @@ -254,9 +254,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - d099f075e45d2aa6007a22b71b45a08758559f80 + 41b7214ace077c230589720cf3460073d1bbd948 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - de7841221e4ad56750e452db8ac4eab459b2ab23 + 41b7214ace077c230589720cf3460073d1bbd948 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 1f1bb15af521..606d90e0ceb2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23415.17 + 7.0.11-servicing.23418.12 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23415.17 + 7.0.11-servicing.23418.12 7.0.0 7.0.2 7.0.0 @@ -121,7 +121,7 @@ 7.0.3 7.0.1 7.0.0 - 7.0.0 + 7.0.1 7.0.4 From 56bf8fd8b4883c518d60dd1caaf10ef8e82f33f4 Mon Sep 17 00:00:00 2001 From: DotNet-Bot Date: Fri, 25 Aug 2023 10:41:16 +0000 Subject: [PATCH 29/54] Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-runtime build 20230824.27 Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , System.Threading.RateLimiting From Version 7.0.11-servicing.23418.12 -> To Version 7.0.11-servicing.23424.27 --- NuGet.config | 4 ++-- eng/Version.Details.xml | 20 ++++++++++---------- eng/Versions.props | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/NuGet.config b/NuGet.config index 5be6140cdcac..8e21b29e5c5a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a98bdea72e84..e338eb9b5222 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://github.com/dotnet/source-build-externals @@ -256,7 +256,7 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 41b7214ace077c230589720cf3460073d1bbd948 + ecb34f85ec92e1b3c814edf7da83337e199e7f66 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 606d90e0ceb2..570db361b37c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.11 7.0.11 7.0.11 - 7.0.11-servicing.23418.12 + 7.0.11-servicing.23424.27 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23418.12 + 7.0.11-servicing.23424.27 7.0.0 7.0.2 7.0.0 From 23915d98ac750e5038c28d67d3539d9eb8caadc7 Mon Sep 17 00:00:00 2001 From: vseanreesermsft <78103370+vseanreesermsft@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:07:43 -0700 Subject: [PATCH 30/54] Update branding to 7.0.12 (#50462) --- eng/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index a35b4d04926e..77d7607b699a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,8 +8,8 @@ 7 0 - 11 - true + 12 + false From 7ae8e218d561965acad0fbc5b530942ecab4b8e5 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Thu, 31 Aug 2023 23:03:10 +0000 Subject: [PATCH 31/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore --- NuGet.config | 8 ++++++-- eng/Version.Details.xml | 32 ++++++++++++++++---------------- eng/Versions.props | 16 ++++++++-------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/NuGet.config b/NuGet.config index 8e21b29e5c5a..eb1650b9c8b4 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,10 +4,12 @@ - + + + @@ -26,9 +28,11 @@ - + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e338eb9b5222..9d37dc7456e1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,37 +9,37 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8133d0c827462d8d84e47b70f294fc060a5d7a84 + 8e673cea5dd610473fb242522dcc14dc897e27c3 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime diff --git a/eng/Versions.props b/eng/Versions.props index a5d253183670..9744937e0074 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -125,14 +125,14 @@ 7.0.4 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 7.0.0-beta.23408.3 7.0.0-beta.23408.3 From 3240a7c2c500536758b25b6b107f9ea1bc6fd7d8 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Fri, 1 Sep 2023 06:41:58 +0000 Subject: [PATCH 32/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 8 ++------ eng/Version.Details.xml | 30 +++++++++++++++--------------- eng/Versions.props | 14 +++++++------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/NuGet.config b/NuGet.config index eb1650b9c8b4..df2b1093c9eb 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,9 +7,7 @@ - - - + @@ -31,9 +29,7 @@ - - - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d37dc7456e1..f1acd8445bf6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef https://github.com/dotnet/source-build-externals @@ -256,39 +256,39 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - ecb34f85ec92e1b3c814edf7da83337e199e7f66 + 3f15c71ba0e53d91651b1b874dce162987c614ef https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 9744937e0074..a2f01f2b2f31 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -63,12 +63,12 @@ 7.0.0 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11 - 7.0.11-servicing.23424.27 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12-servicing.23431.22 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.11-servicing.23424.27 + 7.0.12-servicing.23431.22 7.0.0 7.0.2 7.0.0 From ce6a7d20b92c894786e786346bd87dc2288d9c55 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 09:13:12 -0700 Subject: [PATCH 33/54] [release/7.0] (deps): Bump src/submodules/googletest (#50477) Bumps [src/submodules/googletest](https://github.com/google/googletest) from `6f6ab42` to `8a6feab`. - [Release notes](https://github.com/google/googletest/releases) - [Commits](https://github.com/google/googletest/compare/6f6ab4212aa02cfe02e480711246da4fc17b0761...8a6feabf04bec8fb125e0df0ad1195c42350725f) --- updated-dependencies: - dependency-name: src/submodules/googletest dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/submodules/googletest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/submodules/googletest b/src/submodules/googletest index 6f6ab4212aa0..8a6feabf04be 160000 --- a/src/submodules/googletest +++ b/src/submodules/googletest @@ -1 +1 @@ -Subproject commit 6f6ab4212aa02cfe02e480711246da4fc17b0761 +Subproject commit 8a6feabf04bec8fb125e0df0ad1195c42350725f From 0a51ea18868d6fc9e5d2622c58a4a854f7ca7a06 Mon Sep 17 00:00:00 2001 From: Nolan Glore Date: Fri, 1 Sep 2023 09:27:17 -0700 Subject: [PATCH 34/54] Fixup pRequestInfo after GCs (#50448) --- src/Shared/HttpSys/RequestProcessing/NativeRequestContext.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Shared/HttpSys/RequestProcessing/NativeRequestContext.cs b/src/Shared/HttpSys/RequestProcessing/NativeRequestContext.cs index a9e5360c4f82..0ef93077038c 100644 --- a/src/Shared/HttpSys/RequestProcessing/NativeRequestContext.cs +++ b/src/Shared/HttpSys/RequestProcessing/NativeRequestContext.cs @@ -555,9 +555,12 @@ private IReadOnlyDictionary> GetRequestInfo(IntPtr bas var info = new Dictionary>(count); + long fixup = (byte*)nativeRequest - (byte*)baseAddress; + var pRequestInfo = (HttpApiTypes.HTTP_REQUEST_INFO*)((byte*)nativeRequest->pRequestInfo + fixup); + for (var i = 0; i < count; i++) { - var requestInfo = nativeRequest->pRequestInfo[i]; + var requestInfo = pRequestInfo[i]; var offset = (long)requestInfo.pInfo - (long)baseAddress; info.Add( (int)requestInfo.InfoType, From 9bb94f3ef5b825e1ac6d3736775a34c6c4977f11 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Sat, 2 Sep 2023 05:04:02 +0000 Subject: [PATCH 35/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 4 ++-- eng/Version.Details.xml | 20 ++++++++++---------- eng/Versions.props | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/NuGet.config b/NuGet.config index df2b1093c9eb..9801842bc65e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,7 +7,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f1acd8445bf6..5ee58223c61b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://github.com/dotnet/source-build-externals @@ -256,7 +256,7 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -264,15 +264,15 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3f15c71ba0e53d91651b1b874dce162987c614ef + 87c3030c1336643637eb14bdf6aeeb185063b027 https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index a2f01f2b2f31..777e6328433a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -68,7 +68,7 @@ 7.0.12 7.0.12 7.0.12 - 7.0.12-servicing.23431.22 + 7.0.12-servicing.23451.16 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.12-servicing.23431.22 + 7.0.12-servicing.23451.16 7.0.0 7.0.2 7.0.0 From 12f7067ac39cf7907c6a9023a7880ecf76eee0b2 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Tue, 5 Sep 2023 11:27:34 +0000 Subject: [PATCH 36/54] [internal/release/7.0] Update dependencies from dnceng/internal/dotnet-efcore --- NuGet.config | 4 ++-- eng/Version.Details.xml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NuGet.config b/NuGet.config index 9801842bc65e..d9ad639e2685 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5ee58223c61b..7d99b29b045f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,35 +11,35 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8e673cea5dd610473fb242522dcc14dc897e27c3 + a81057960c7bfa3decdc605296fc9c7aa7659779 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime From 6c6d3049d098011476d51dfaaf8c2fa2b7da7638 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 22 Sep 2023 18:50:04 -0700 Subject: [PATCH 37/54] Track indicators of excessive stream resets If the server has to send a lot of ENHANCE_YOUR_CALM messages or the output control flow queue is very large, there are probably a larger than expected number of client-initiated stream resets. --- .../src/Internal/Http2/Http2Connection.cs | 52 +++++++++++++++--- .../src/Internal/Http2/Http2FrameWriter.cs | 54 +++++++++++++++++-- .../Infrastructure/KestrelTrace.Http2.cs | 24 +++++++++ .../Http2SampleApp/Http2SampleApp.csproj | 2 +- 4 files changed, 121 insertions(+), 11 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index 10c2766507e0..22d55287c604 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -46,6 +46,18 @@ internal sealed partial class Http2Connection : IHttp2StreamLifetimeHandler, IHt private const int MaxStreamPoolSize = 100; private const long StreamPoolExpiryTicks = TimeSpan.TicksPerSecond * 5; + private const string EnhanceYourCalmMaximumCountProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.EnhanceYourCalmCount"; + + private static readonly int _enhanceYourCalmMaximumCount = AppContext.GetData(EnhanceYourCalmMaximumCountProperty) is int eycMaxCount + ? eycMaxCount + : 10; + + // Accumulate _enhanceYourCalmCount over the course of EnhanceYourCalmTickWindowCount ticks. + // This should make bursts less likely to trigger disconnects. + private const int EnhanceYourCalmTickWindowCount = 5; + + private static bool IsEnhanceYourCalmEnabled => _enhanceYourCalmMaximumCount > 0; + private readonly HttpConnectionContext _context; private readonly Http2FrameWriter _frameWriter; private readonly Pipe _input; @@ -74,6 +86,9 @@ internal sealed partial class Http2Connection : IHttp2StreamLifetimeHandler, IHt private int _clientActiveStreamCount; private int _serverActiveStreamCount; + private int _enhanceYourCalmCount; + private int _tickCount; + // The following are the only fields that can be modified outside of the ProcessRequestsAsync loop. private readonly ConcurrentQueue _completedStreams = new ConcurrentQueue(); private readonly StreamCloseAwaitable _streamCompletionAwaitable = new StreamCloseAwaitable(); @@ -361,13 +376,20 @@ public async Task ProcessRequestsAsync(IHttpApplication appl stream.Abort(new IOException(CoreStrings.Http2StreamAborted, connectionError)); } - // Use the server _serverActiveStreamCount to drain all requests on the server side. - // Can't use _clientActiveStreamCount now as we now decrement that count earlier/ - // Can't use _streams.Count as we wait for RST/END_STREAM before removing the stream from the dictionary - while (_serverActiveStreamCount > 0) + // For some reason, this loop doesn't terminate when we're trying to abort. + // Since we're making a narrow fix for a patch, we'll bypass it in such scenarios. + // TODO: This is probably a bug - something in here should probably detect aborted + // connections and short-circuit. + if (!IsEnhanceYourCalmEnabled || error is not Http2ConnectionErrorException) { - await _streamCompletionAwaitable; - UpdateCompletedStreams(); + // Use the server _serverActiveStreamCount to drain all requests on the server side. + // Can't use _clientActiveStreamCount now as we now decrement that count earlier/ + // Can't use _streams.Count as we wait for RST/END_STREAM before removing the stream from the dictionary + while (_serverActiveStreamCount > 0) + { + await _streamCompletionAwaitable; + UpdateCompletedStreams(); + } } while (StreamPool.TryPop(out var pooledStream)) @@ -1170,6 +1192,20 @@ private void StartStream() // Server is getting hit hard with connection resets. // Tell client to calm down. // TODO consider making when to send ENHANCE_YOUR_CALM configurable? + + if (IsEnhanceYourCalmEnabled && Interlocked.Increment(ref _enhanceYourCalmCount) > EnhanceYourCalmTickWindowCount * _enhanceYourCalmMaximumCount) + { + Log.Http2TooManyEnhanceYourCalms(_context.ConnectionId, _enhanceYourCalmMaximumCount); + + // Now that we've logged a useful message, we can put vague text in the exception + // messages in case they somehow make it back to the client (not expected) + + // This will close the socket - we want to do that right away + Abort(new ConnectionAbortedException(CoreStrings.Http2ConnectionFaulted)); + // Throwing an exception as well will help us clean up on our end more quickly by (e.g.) skipping processing of already-buffered input + throw new Http2ConnectionErrorException(CoreStrings.Http2ConnectionFaulted, Http2ErrorCode.ENHANCE_YOUR_CALM); + } + throw new Http2StreamErrorException(_currentHeadersStream.StreamId, CoreStrings.Http2TellClientToCalmDown, Http2ErrorCode.ENHANCE_YOUR_CALM); } } @@ -1241,6 +1277,10 @@ private void AbortStream(int streamId, IOException error) void IRequestProcessor.Tick(DateTimeOffset now) { Input.CancelPendingRead(); + if (IsEnhanceYourCalmEnabled && ++_tickCount % EnhanceYourCalmTickWindowCount == 0) + { + Interlocked.Exchange(ref _enhanceYourCalmCount, 0); + } } void IHttp2StreamLifetimeHandler.OnStreamCompleted(Http2Stream stream) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs index e8fca0c394b3..77ed32c8e0dd 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs @@ -20,6 +20,29 @@ internal sealed class Http2FrameWriter // This uses C# compiler's ability to refer to static data directly. For more information see https://vcsjones.dev/2019/02/01/csharp-readonly-span-bytes-static private static ReadOnlySpan ContinueBytes => new byte[] { 0x08, 0x03, (byte)'1', (byte)'0', (byte)'0' }; + private const string MaximumFlowControlQueueSizeProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.MaxConnectionFlowControlQueueSize"; + + private static readonly int? ConfiguredMaximumFlowControlQueueSize = GetConfiguredMaximumFlowControlQueueSize(); + + private static int? GetConfiguredMaximumFlowControlQueueSize() + { + var data = AppContext.GetData(MaximumFlowControlQueueSizeProperty); + + if (data is int count) + { + return count; + } + + if (data is string countStr && int.TryParse(countStr, out var parsed)) + { + return parsed; + } + + return null; + } + + private readonly int _maximumFlowControlQueueSize; + private readonly object _writeLock = new object(); private readonly Http2Frame _outgoingFrame; private readonly Http2HeadersEnumerator _headersEnumerator = new Http2HeadersEnumerator(); @@ -79,6 +102,16 @@ public Http2FrameWriter( _hpackEncoder = new DynamicHPackEncoder(serviceContext.ServerOptions.AllowResponseHeaderCompression); + _maximumFlowControlQueueSize = ConfiguredMaximumFlowControlQueueSize is null + ? 4 * maxStreamsPerConnection + : (int)ConfiguredMaximumFlowControlQueueSize; + + if (_maximumFlowControlQueueSize < maxStreamsPerConnection) + { + _log.Http2FlowControlQueueMaximumTooLow(_connectionContext.ConnectionId, maxStreamsPerConnection, _maximumFlowControlQueueSize); + _maximumFlowControlQueueSize = maxStreamsPerConnection; + } + // This is bounded by the maximum number of concurrent Http2Streams per Http2Connection. // This isn't the same as SETTINGS_MAX_CONCURRENT_STREAMS, but typically double (with a floor of 100) // which is the max number of Http2Streams that can end up in the Http2Connection._streams dictionary. @@ -101,7 +134,8 @@ public void Schedule(Http2OutputProducer producer) { if (!_channel.Writer.TryWrite(producer)) { - // It should not be possible to exceed the bound of the channel. + // This can happen if a client resets streams faster than we can clear them out - we end up with a backlog + // exceeding the channel size. Disconnecting seems appropriate in this case. var ex = new ConnectionAbortedException("HTTP/2 connection exceeded the output operations maximum queue size."); _log.Http2QueueOperationsExceeded(_connectionId, ex); _http2Connection.Abort(ex); @@ -304,7 +338,7 @@ private bool TryQueueProducerForConnectionWindowUpdate(long actual, Http2OutputP } else { - _waitingForMoreConnectionWindow.Enqueue(producer); + EnqueueWaitingForMoreConnectionWindow(producer); } return true; @@ -898,7 +932,7 @@ private void AbortConnectionFlowControl() _lastWindowConsumer = null; // Put the consumer of the connection window last - _waitingForMoreConnectionWindow.Enqueue(producer); + EnqueueWaitingForMoreConnectionWindow(producer); } while (_waitingForMoreConnectionWindow.TryDequeue(out producer)) @@ -927,7 +961,7 @@ public bool TryUpdateConnectionWindow(int bytes) _lastWindowConsumer = null; // Put the consumer of the connection window last - _waitingForMoreConnectionWindow.Enqueue(producer); + EnqueueWaitingForMoreConnectionWindow(producer); } while (_waitingForMoreConnectionWindow.TryDequeue(out producer)) @@ -937,4 +971,16 @@ public bool TryUpdateConnectionWindow(int bytes) } return true; } + + private void EnqueueWaitingForMoreConnectionWindow(Http2OutputProducer producer) + { + _waitingForMoreConnectionWindow.Enqueue(producer); + // This is re-entrant because abort will cause a final enqueue. + // Easier to check for that condition than to make each enqueuer reason about what to call. + if (!_aborted && _maximumFlowControlQueueSize > 0 && _waitingForMoreConnectionWindow.Count > _maximumFlowControlQueueSize) + { + _log.Http2FlowControlQueueOperationsExceeded(_connectionId, _maximumFlowControlQueueSize); + _http2Connection.Abort(new ConnectionAbortedException("HTTP/2 connection exceeded the outgoing flow control maximum queue size.")); + } + } } diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs index 84a7609f0710..7137f1668ce2 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs @@ -85,6 +85,21 @@ public void Http2UnexpectedConnectionQueueError(string connectionId, Exception e Http2Log.Http2UnexpectedConnectionQueueError(_http2Logger, connectionId, ex); } + public void Http2TooManyEnhanceYourCalms(string connectionId, int count) + { + Http2Log.Http2TooManyEnhanceYourCalms(_http2Logger, connectionId, count); + } + + public void Http2FlowControlQueueOperationsExceeded(string connectionId, int count) + { + Http2Log.Http2FlowControlQueueOperationsExceeded(_http2Logger, connectionId, count); + } + + public void Http2FlowControlQueueMaximumTooLow(string connectionId, int expected, int actual) + { + Http2Log.Http2FlowControlQueueMaximumTooLow(_http2Logger, connectionId, expected, actual); + } + private static partial class Http2Log { [LoggerMessage(29, LogLevel.Debug, @"Connection id ""{ConnectionId}"": HTTP/2 connection error.", EventName = "Http2ConnectionError")] @@ -130,5 +145,14 @@ private static partial class Http2Log public static partial void Http2UnexpectedConnectionQueueError(ILogger logger, string connectionId, Exception ex); // Highest shared ID is 63. New consecutive IDs start at 64 + + [LoggerMessage(64, LogLevel.Error, @"Connection id ""{ConnectionId}"" aborted since at least ""{Count}"" ENHANCE_YOUR_CALM responses were required per second.", EventName = "Http2TooManyEnhanceYourCalms")] + public static partial void Http2TooManyEnhanceYourCalms(ILogger logger, string connectionId, int count); + + [LoggerMessage(65, LogLevel.Error, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of ""{Count}"".", EventName = "Http2FlowControlQueueOperationsExceeded")] + public static partial void Http2FlowControlQueueOperationsExceeded(ILogger logger, string connectionId, int count); + + [LoggerMessage(66, LogLevel.Trace, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size ""{Actual}"" is less than the maximum streams per connection ""{Expected}"" - increasing to match.", EventName = "Http2FlowControlQueueMaximumTooLow")] + public static partial void Http2FlowControlQueueMaximumTooLow(ILogger logger, string connectionId, int expected, int actual); } } diff --git a/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj b/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj index cc404533ad8f..d0930e69fee0 100644 --- a/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj +++ b/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj @@ -1,4 +1,4 @@ - + $(DefaultNetCoreTargetFramework) From c1d9659b70945f1551728a7f70a9adc93047594f Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 26 Sep 2023 17:25:14 -0700 Subject: [PATCH 38/54] Address PR feedback --- .../src/Internal/Http2/Http2Connection.cs | 19 ++++++++++++++++--- .../src/Internal/Http2/Http2FrameWriter.cs | 6 ++++-- .../Infrastructure/KestrelTrace.Http2.cs | 6 +++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index 22d55287c604..917c20ef3b7a 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -48,9 +48,22 @@ internal sealed partial class Http2Connection : IHttp2StreamLifetimeHandler, IHt private const string EnhanceYourCalmMaximumCountProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.EnhanceYourCalmCount"; - private static readonly int _enhanceYourCalmMaximumCount = AppContext.GetData(EnhanceYourCalmMaximumCountProperty) is int eycMaxCount - ? eycMaxCount - : 10; + private static readonly int _enhanceYourCalmMaximumCount = GetEnhanceYourCalmMaximumCount(); + + private static int GetEnhanceYourCalmMaximumCount() + { + var data = AppContext.GetData(EnhanceYourCalmMaximumCountProperty); + if (data is int count) + { + return count; + } + if (data is string countStr && int.TryParse(countStr, out var parsed)) + { + return parsed; + } + + return 20; // Empirically derived + } // Accumulate _enhanceYourCalmCount over the course of EnhanceYourCalmTickWindowCount ticks. // This should make bursts less likely to trigger disconnects. diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs index 77ed32c8e0dd..4eec37cb124a 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs @@ -43,6 +43,8 @@ internal sealed class Http2FrameWriter private readonly int _maximumFlowControlQueueSize; + private bool IsMaximumFlowControlQueueSizeEnabled => _maximumFlowControlQueueSize > 0; + private readonly object _writeLock = new object(); private readonly Http2Frame _outgoingFrame; private readonly Http2HeadersEnumerator _headersEnumerator = new Http2HeadersEnumerator(); @@ -106,7 +108,7 @@ public Http2FrameWriter( ? 4 * maxStreamsPerConnection : (int)ConfiguredMaximumFlowControlQueueSize; - if (_maximumFlowControlQueueSize < maxStreamsPerConnection) + if (IsMaximumFlowControlQueueSizeEnabled && _maximumFlowControlQueueSize < maxStreamsPerConnection) { _log.Http2FlowControlQueueMaximumTooLow(_connectionContext.ConnectionId, maxStreamsPerConnection, _maximumFlowControlQueueSize); _maximumFlowControlQueueSize = maxStreamsPerConnection; @@ -977,7 +979,7 @@ private void EnqueueWaitingForMoreConnectionWindow(Http2OutputProducer producer) _waitingForMoreConnectionWindow.Enqueue(producer); // This is re-entrant because abort will cause a final enqueue. // Easier to check for that condition than to make each enqueuer reason about what to call. - if (!_aborted && _maximumFlowControlQueueSize > 0 && _waitingForMoreConnectionWindow.Count > _maximumFlowControlQueueSize) + if (!_aborted && IsMaximumFlowControlQueueSizeEnabled && _waitingForMoreConnectionWindow.Count > _maximumFlowControlQueueSize) { _log.Http2FlowControlQueueOperationsExceeded(_connectionId, _maximumFlowControlQueueSize); _http2Connection.Abort(new ConnectionAbortedException("HTTP/2 connection exceeded the outgoing flow control maximum queue size.")); diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs index 7137f1668ce2..9a7f7dbdfdd5 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs @@ -146,13 +146,13 @@ private static partial class Http2Log // Highest shared ID is 63. New consecutive IDs start at 64 - [LoggerMessage(64, LogLevel.Error, @"Connection id ""{ConnectionId}"" aborted since at least ""{Count}"" ENHANCE_YOUR_CALM responses were required per second.", EventName = "Http2TooManyEnhanceYourCalms")] + [LoggerMessage(64, LogLevel.Debug, @"Connection id ""{ConnectionId}"" aborted since at least ""{Count}"" ENHANCE_YOUR_CALM responses were required per second.", EventName = "Http2TooManyEnhanceYourCalms")] public static partial void Http2TooManyEnhanceYourCalms(ILogger logger, string connectionId, int count); - [LoggerMessage(65, LogLevel.Error, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of ""{Count}"".", EventName = "Http2FlowControlQueueOperationsExceeded")] + [LoggerMessage(65, LogLevel.Debug, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of ""{Count}"".", EventName = "Http2FlowControlQueueOperationsExceeded")] public static partial void Http2FlowControlQueueOperationsExceeded(ILogger logger, string connectionId, int count); - [LoggerMessage(66, LogLevel.Trace, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size ""{Actual}"" is less than the maximum streams per connection ""{Expected}"" - increasing to match.", EventName = "Http2FlowControlQueueMaximumTooLow")] + [LoggerMessage(66, LogLevel.Debug, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size ""{Actual}"" is less than the maximum streams per connection ""{Expected}"" - increasing to match.", EventName = "Http2FlowControlQueueMaximumTooLow")] public static partial void Http2FlowControlQueueMaximumTooLow(ILogger logger, string connectionId, int expected, int actual); } } From 90be960f15984d745679155356a10388b8a2b984 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 26 Sep 2023 19:40:48 -0700 Subject: [PATCH 39/54] Clarify some log messages and comments --- .../Kestrel/Core/src/Internal/Http2/Http2Connection.cs | 10 ++++++---- .../Core/src/Internal/Http2/Http2FrameWriter.cs | 2 +- .../src/Internal/Infrastructure/KestrelTrace.Http2.cs | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index 917c20ef3b7a..2a12db907c7b 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -46,13 +46,13 @@ internal sealed partial class Http2Connection : IHttp2StreamLifetimeHandler, IHt private const int MaxStreamPoolSize = 100; private const long StreamPoolExpiryTicks = TimeSpan.TicksPerSecond * 5; - private const string EnhanceYourCalmMaximumCountProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.EnhanceYourCalmCount"; + private const string MaximumEnhanceYourCalmCountProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.MaxEnhanceYourCalmCount"; - private static readonly int _enhanceYourCalmMaximumCount = GetEnhanceYourCalmMaximumCount(); + private static readonly int _enhanceYourCalmMaximumCount = GetMaximumEnhanceYourCalmCount(); - private static int GetEnhanceYourCalmMaximumCount() + private static int GetMaximumEnhanceYourCalmCount() { - var data = AppContext.GetData(EnhanceYourCalmMaximumCountProperty); + var data = AppContext.GetData(MaximumEnhanceYourCalmCountProperty); if (data is int count) { return count; @@ -1290,6 +1290,8 @@ private void AbortStream(int streamId, IOException error) void IRequestProcessor.Tick(DateTimeOffset now) { Input.CancelPendingRead(); + // We count EYCs over a window of a given length to avoid flagging short-lived bursts. + // At the end of each window, reset the count. if (IsEnhanceYourCalmEnabled && ++_tickCount % EnhanceYourCalmTickWindowCount == 0) { Interlocked.Exchange(ref _enhanceYourCalmCount, 0); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs index 4eec37cb124a..f90f728a34fe 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs @@ -105,7 +105,7 @@ public Http2FrameWriter( _hpackEncoder = new DynamicHPackEncoder(serviceContext.ServerOptions.AllowResponseHeaderCompression); _maximumFlowControlQueueSize = ConfiguredMaximumFlowControlQueueSize is null - ? 4 * maxStreamsPerConnection + ? 4 * maxStreamsPerConnection // 4 is a magic number to give us some padding above the expected maximum size : (int)ConfiguredMaximumFlowControlQueueSize; if (IsMaximumFlowControlQueueSizeEnabled && _maximumFlowControlQueueSize < maxStreamsPerConnection) diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs index 9a7f7dbdfdd5..c9c3c9f55b83 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs @@ -146,13 +146,13 @@ private static partial class Http2Log // Highest shared ID is 63. New consecutive IDs start at 64 - [LoggerMessage(64, LogLevel.Debug, @"Connection id ""{ConnectionId}"" aborted since at least ""{Count}"" ENHANCE_YOUR_CALM responses were required per second.", EventName = "Http2TooManyEnhanceYourCalms")] + [LoggerMessage(64, LogLevel.Debug, @"Connection id ""{ConnectionId}"" aborted since at least {Count} ENHANCE_YOUR_CALM responses were recorded per second.", EventName = "Http2TooManyEnhanceYourCalms")] public static partial void Http2TooManyEnhanceYourCalms(ILogger logger, string connectionId, int count); - [LoggerMessage(65, LogLevel.Debug, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of ""{Count}"".", EventName = "Http2FlowControlQueueOperationsExceeded")] + [LoggerMessage(65, LogLevel.Debug, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of {Count}.", EventName = "Http2FlowControlQueueOperationsExceeded")] public static partial void Http2FlowControlQueueOperationsExceeded(ILogger logger, string connectionId, int count); - [LoggerMessage(66, LogLevel.Debug, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size ""{Actual}"" is less than the maximum streams per connection ""{Expected}"" - increasing to match.", EventName = "Http2FlowControlQueueMaximumTooLow")] + [LoggerMessage(66, LogLevel.Debug, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size {Actual} is less than the maximum streams per connection {Expected}. Increasing configured value to {Expected}.", EventName = "Http2FlowControlQueueMaximumTooLow")] public static partial void Http2FlowControlQueueMaximumTooLow(ILogger logger, string connectionId, int expected, int actual); } } From 1b8fbf7f0a75bc2c513b6181c2629bc8d6aa0983 Mon Sep 17 00:00:00 2001 From: DotNet Bot Date: Thu, 28 Sep 2023 09:21:33 +0000 Subject: [PATCH 40/54] [internal/release/frameshift/7.0] Update dependencies from dnceng/internal/dotnet-runtime --- NuGet.config | 2 ++ eng/Version.Details.xml | 32 ++++++++++++++++---------------- eng/Versions.props | 16 ++++++++-------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/NuGet.config b/NuGet.config index ecf11c3e4032..745b199a982a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,6 +6,7 @@ + @@ -26,6 +27,7 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f6744d85a055..f13146287c3e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -177,9 +177,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca https://github.com/dotnet/source-build-externals @@ -254,41 +254,41 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - d099f075e45d2aa6007a22b71b45a08758559f80 + 4a824ef37caa51072221584c64cbf15455f406ca https://dev.azure.com/dnceng/internal/_git/dotnet-runtime d099f075e45d2aa6007a22b71b45a08758559f80 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - a6dbb800a47735bde43187350fd3aff4071c7f9c + 4a824ef37caa51072221584c64cbf15455f406ca https://github.com/dotnet/xdt diff --git a/eng/Versions.props b/eng/Versions.props index 77d7607b699a..55b235d5c297 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -63,12 +63,12 @@ 7.0.0 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10-servicing.23363.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12-servicing.23477.20 7.0.0 7.0.0 7.0.0 @@ -103,7 +103,7 @@ 7.0.0 7.0.1 7.0.0 - 7.0.10-servicing.23363.12 + 7.0.12-servicing.23477.20 7.0.0 7.0.2 7.0.0 @@ -121,7 +121,7 @@ 7.0.3 7.0.1 7.0.0 - 7.0.0 + 7.0.1 7.0.4 From c8ea76f30dc6f244a0c2d82581b516fc5f842ce4 Mon Sep 17 00:00:00 2001 From: DotNet-Bot Date: Fri, 29 Sep 2023 03:20:05 +0000 Subject: [PATCH 41/54] Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-efcore build 20230928.11 dotnet-ef , Microsoft.EntityFrameworkCore , Microsoft.EntityFrameworkCore.Design , Microsoft.EntityFrameworkCore.InMemory , Microsoft.EntityFrameworkCore.Relational , Microsoft.EntityFrameworkCore.Sqlite , Microsoft.EntityFrameworkCore.SqlServer , Microsoft.EntityFrameworkCore.Tools From Version 7.0.10 -> To Version 7.0.12 --- NuGet.config | 2 ++ eng/Version.Details.xml | 32 ++++++++++++++++---------------- eng/Versions.props | 16 ++++++++-------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/NuGet.config b/NuGet.config index 745b199a982a..0b2629f92cfb 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,6 +4,7 @@ + @@ -25,6 +26,7 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f13146287c3e..5f8c001cb17d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,37 +9,37 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 8907538f3d4da2fffdb0516f05542802585757e6 + c20ecc79b7df3657e186ac52e7fc050beea36c92 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime diff --git a/eng/Versions.props b/eng/Versions.props index 55b235d5c297..9b2483a1d9f0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -125,14 +125,14 @@ 7.0.4 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 - 7.0.10 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 + 7.0.12 7.0.0-beta.23408.3 7.0.0-beta.23408.3 From 4ce46bcc9e4e5c46e80a7ab398843070281c74bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:40:44 -0600 Subject: [PATCH 42/54] Update jquery-validation to v1.19.5 (#50483) Co-authored-by: Mackinnon Buck --- .../Pages/V4/_ValidationScriptsPartial.cshtml | 4 +- .../Pages/V5/_ValidationScriptsPartial.cshtml | 4 +- src/Identity/UI/src/THIRD-PARTY-NOTICES.txt | 2 +- .../dist/additional-methods.js | 424 +++++- .../dist/additional-methods.min.js | 6 +- .../jquery-validation/dist/jquery.validate.js | 118 +- .../dist/jquery.validate.min.js | 6 +- .../dist/additional-methods.js | 424 +++++- .../dist/additional-methods.min.js | 6 +- .../jquery-validation/dist/jquery.validate.js | 118 +- .../dist/jquery.validate.min.js | 6 +- .../Shared/_ValidationScriptsPartial.cshtml | 2 +- .../Shared/_ValidationScriptsPartial.cshtml | 2 +- .../dist/additional-methods.js | 424 +++++- .../dist/additional-methods.min.js | 6 +- .../jquery-validation/dist/jquery.validate.js | 118 +- .../dist/jquery.validate.min.js | 6 +- src/ProjectTemplates/THIRD-PARTY-NOTICES | 2 +- .../dist/additional-methods.js | 424 +++++- .../dist/additional-methods.min.js | 6 +- .../jquery-validation/dist/jquery.validate.js | 118 +- .../dist/jquery.validate.min.js | 6 +- .../dist/additional-methods.js | 424 +++++- .../dist/additional-methods.min.js | 6 +- .../jquery-validation/dist/jquery.validate.js | 118 +- .../dist/jquery.validate.min.js | 6 +- .../dist/additional-methods.js | 424 +++++- .../dist/additional-methods.min.js | 6 +- .../jquery-validation/dist/jquery.validate.js | 118 +- .../dist/jquery.validate.min.js | 6 +- .../samples/ClaimsTransformation/bower.json | 2 +- .../wwwroot/lib/jquery-validation/.bower.json | 16 +- .../dist/additional-methods.js | 1264 ++++++++++++----- .../dist/additional-methods.min.js | 8 +- .../jquery-validation/dist/jquery.validate.js | 855 +++++++---- .../dist/jquery.validate.min.js | 8 +- .../wwwroot/lib/jquery/.bower.json | 5 +- .../wwwroot/lib/jquery/LICENSE.txt | 3 +- .../wwwroot/lib/jquery/dist/jquery.min.map | 2 +- src/Security/samples/Cookies/bower.json | 2 +- .../wwwroot/lib/jquery-validation/.bower.json | 16 +- .../dist/additional-methods.js | 1264 ++++++++++++----- .../dist/additional-methods.min.js | 8 +- .../jquery-validation/dist/jquery.validate.js | 855 +++++++---- .../dist/jquery.validate.min.js | 8 +- .../Cookies/wwwroot/lib/jquery/.bower.json | 5 +- .../Cookies/wwwroot/lib/jquery/LICENSE.txt | 3 +- .../wwwroot/lib/jquery/dist/jquery.min.map | 2 +- .../wwwroot/lib/jquery-validation/.bower.json | 19 +- .../dist/additional-methods.js | 1264 ++++++++++++----- .../jquery-validation/dist/jquery.validate.js | 855 +++++++---- .../wwwroot/lib/jquery-validation/.bower.json | 19 +- .../dist/additional-methods.js | 1264 ++++++++++++----- .../jquery-validation/dist/jquery.validate.js | 855 +++++++---- .../samples/PathSchemeSelection/bower.json | 2 +- .../wwwroot/lib/jquery-validation/.bower.json | 16 +- .../dist/additional-methods.js | 1264 ++++++++++++----- .../dist/additional-methods.min.js | 8 +- .../jquery-validation/dist/jquery.validate.js | 855 +++++++---- .../dist/jquery.validate.min.js | 8 +- .../wwwroot/lib/jquery/.bower.json | 5 +- .../wwwroot/lib/jquery/LICENSE.txt | 3 +- .../wwwroot/lib/jquery/dist/jquery.min.map | 2 +- .../wwwroot/lib/jquery-validation/.bower.json | 19 +- .../dist/additional-methods.js | 1264 ++++++++++++----- .../dist/additional-methods.min.js | 8 +- .../jquery-validation/dist/jquery.validate.js | 855 +++++++---- .../dist/jquery.validate.min.js | 8 +- 68 files changed, 11701 insertions(+), 4558 deletions(-) diff --git a/src/Identity/UI/src/Areas/Identity/Pages/V4/_ValidationScriptsPartial.cshtml b/src/Identity/UI/src/Areas/Identity/Pages/V4/_ValidationScriptsPartial.cshtml index a49314c56ef7..b242171a9adb 100644 --- a/src/Identity/UI/src/Areas/Identity/Pages/V4/_ValidationScriptsPartial.cshtml +++ b/src/Identity/UI/src/Areas/Identity/Pages/V4/_ValidationScriptsPartial.cshtml @@ -3,11 +3,11 @@ - - + diff --git a/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml b/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml index 454a065353d9..3220b07142e1 100644 --- a/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml +++ b/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml @@ -1,2 +1,2 @@ - + diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js index e129bc0f74b9..c6a7229185ab 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js @@ -1,9 +1,9 @@ /*! - * jQuery Validation Plugin v1.17.0 + * jQuery Validation Plugin v1.19.5 * * https://jqueryvalidation.org/ * - * Copyright (c) 2017 Jörn Zaefferer + * Copyright (c) 2022 Jörn Zaefferer * Released under the MIT license */ (function( factory ) { @@ -43,6 +43,38 @@ }() ); +/** + * This is used in the United States to process payments, deposits, + * or transfers using the Automated Clearing House (ACH) or Fedwire + * systems. A very common use case would be to validate a form for + * an ACH bill payment. + */ +$.validator.addMethod( "abaRoutingNumber", function( value ) { + var checksum = 0; + var tokens = value.split( "" ); + var length = tokens.length; + + // Length Check + if ( length !== 9 ) { + return false; + } + + // Calc the checksum + // https://en.wikipedia.org/wiki/ABA_routing_transit_number + for ( var i = 0; i < length; i += 3 ) { + checksum += parseInt( tokens[ i ], 10 ) * 3 + + parseInt( tokens[ i + 1 ], 10 ) * 7 + + parseInt( tokens[ i + 2 ], 10 ); + } + + // If not zero and divisible by 10 then valid + if ( checksum !== 0 && checksum % 10 === 0 ) { + return true; + } + + return false; +}, "Please enter a valid routing number." ); + // Accept a value from a file input based on a required mimetype $.validator.addMethod( "accept", function( value, element, param ) { @@ -87,7 +119,7 @@ $.validator.addMethod( "accept", function( value, element, param ) { $.validator.addMethod( "alphanumeric", function( value, element ) { return this.optional( element ) || /^\w+$/i.test( value ); -}, "Letters, numbers, and underscores only please" ); +}, "Letters, numbers, and underscores only please." ); /* * Dutch bank account numbers (not 'giro' numbers) have 9 digits @@ -114,13 +146,13 @@ $.validator.addMethod( "bankaccountNL", function( value, element ) { sum = sum + factor * digit; } return sum % 11 === 0; -}, "Please specify a valid bank account number" ); +}, "Please specify a valid bank account number." ); $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { return this.optional( element ) || ( $.validator.methods.bankaccountNL.call( this, value, element ) ) || ( $.validator.methods.giroaccountNL.call( this, value, element ) ); -}, "Please specify a valid bank or giro account number" ); +}, "Please specify a valid bank or giro account number." ); /** * BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity. @@ -139,7 +171,7 @@ $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { */ $.validator.addMethod( "bic", function( value, element ) { return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() ); -}, "Please specify a valid BIC code" ); +}, "Please specify a valid BIC code." ); /* * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities @@ -256,11 +288,141 @@ $.validator.addMethod( "cifES", function( value, element ) { }, "Please specify a valid CIF number." ); +/* + * Brazillian CNH number (Carteira Nacional de Habilitacao) is the License Driver number. + * CNH numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. + */ +$.validator.addMethod( "cnhBR", function( value ) { + + // Removing special characters from value + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); + + // Checking value to have 11 digits only + if ( value.length !== 11 ) { + return false; + } + + var sum = 0, dsc = 0, firstChar, + firstCN, secondCN, i, j, v; + + firstChar = value.charAt( 0 ); + + if ( new Array( 12 ).join( firstChar ) === value ) { + return false; + } + + // Step 1 - using first Check Number: + for ( i = 0, j = 9, v = 0; i < 9; ++i, --j ) { + sum += +( value.charAt( i ) * j ); + } + + firstCN = sum % 11; + if ( firstCN >= 10 ) { + firstCN = 0; + dsc = 2; + } + + sum = 0; + for ( i = 0, j = 1, v = 0; i < 9; ++i, ++j ) { + sum += +( value.charAt( i ) * j ); + } + + secondCN = sum % 11; + if ( secondCN >= 10 ) { + secondCN = 0; + } else { + secondCN = secondCN - dsc; + } + + return ( String( firstCN ).concat( secondCN ) === value.substr( -2 ) ); + +}, "Please specify a valid CNH number." ); + +/* + * Brazillian value number (Cadastrado de Pessoas Juridica). + * value numbers have 14 digits in total: 12 numbers followed by 2 check numbers that are being used for validation. + */ +$.validator.addMethod( "cnpjBR", function( value, element ) { + "use strict"; + + if ( this.optional( element ) ) { + return true; + } + + // Removing no number + value = value.replace( /[^\d]+/g, "" ); + + // Checking value to have 14 digits only + if ( value.length !== 14 ) { + return false; + } + + // Elimina values invalidos conhecidos + if ( value === "00000000000000" || + value === "11111111111111" || + value === "22222222222222" || + value === "33333333333333" || + value === "44444444444444" || + value === "55555555555555" || + value === "66666666666666" || + value === "77777777777777" || + value === "88888888888888" || + value === "99999999999999" ) { + return false; + } + + // Valida DVs + var tamanho = ( value.length - 2 ); + var numeros = value.substring( 0, tamanho ); + var digitos = value.substring( tamanho ); + var soma = 0; + var pos = tamanho - 7; + + for ( var i = tamanho; i >= 1; i-- ) { + soma += numeros.charAt( tamanho - i ) * pos--; + if ( pos < 2 ) { + pos = 9; + } + } + + var resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; + + if ( resultado !== parseInt( digitos.charAt( 0 ), 10 ) ) { + return false; + } + + tamanho = tamanho + 1; + numeros = value.substring( 0, tamanho ); + soma = 0; + pos = tamanho - 7; + + for ( var il = tamanho; il >= 1; il-- ) { + soma += numeros.charAt( tamanho - il ) * pos--; + if ( pos < 2 ) { + pos = 9; + } + } + + resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; + + if ( resultado !== parseInt( digitos.charAt( 1 ), 10 ) ) { + return false; + } + + return true; + +}, "Please specify a CNPJ value number." ); + /* * Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number. * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. */ -$.validator.addMethod( "cpfBR", function( value ) { +$.validator.addMethod( "cpfBR", function( value, element ) { + "use strict"; + + if ( this.optional( element ) ) { + return true; + } // Removing special characters from value value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); @@ -315,7 +477,7 @@ $.validator.addMethod( "cpfBR", function( value ) { } return false; -}, "Please specify a valid CPF number" ); +}, "Please specify a valid CPF number." ); // https://jqueryvalidation.org/creditcard-method/ // based on https://en.wikipedia.org/wiki/Luhn_algorithm @@ -337,7 +499,7 @@ $.validator.addMethod( "creditcard", function( value, element ) { value = value.replace( /\D/g, "" ); // Basing min and max length on - // https://developer.ean.com/general_info/Valid_Credit_Card_Types + // https://dev.ean.com/general-info/valid-card-types/ if ( value.length < 13 || value.length > 19 ) { return false; } @@ -359,7 +521,7 @@ $.validator.addMethod( "creditcard", function( value, element ) { }, "Please enter a valid credit card number." ); /* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator - * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 + * Redistributed under the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) */ $.validator.addMethod( "creditcardtypes", function( value, element, param ) { @@ -398,7 +560,7 @@ $.validator.addMethod( "creditcardtypes", function( value, element, param ) { if ( param.all ) { validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; } - if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard + if ( validTypes & 0x0001 && ( /^(5[12345])/.test( value ) || /^(2[234567])/.test( value ) ) ) { // Mastercard return value.length === 16; } if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa @@ -468,7 +630,7 @@ $.validator.addMethod( "currency", function( value, element, param ) { regex = new RegExp( regex ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid currency" ); +}, "Please specify a valid currency." ); $.validator.addMethod( "dateFA", function( value, element ) { return this.optional( element ) || /^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test( value ); @@ -529,7 +691,31 @@ $.validator.addMethod( "extension", function( value, element, param ) { */ $.validator.addMethod( "giroaccountNL", function( value, element ) { return this.optional( element ) || /^[0-9]{1,7}$/.test( value ); -}, "Please specify a valid giro account number" ); +}, "Please specify a valid giro account number." ); + +$.validator.addMethod( "greaterThan", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-greaterThan-blur" ).length ) { + target.addClass( "validate-greaterThan-blur" ).on( "blur.validate-greaterThan", function() { + $( element ).valid(); + } ); + } + + return value > target.val(); +}, "Please enter a greater value." ); + +$.validator.addMethod( "greaterThanEqual", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-greaterThanEqual-blur" ).length ) { + target.addClass( "validate-greaterThanEqual-blur" ).on( "blur.validate-greaterThanEqual", function() { + $( element ).valid(); + } ); + } + + return value >= target.val(); +}, "Please enter a greater value." ); /** * IBAN is the international bank account number. @@ -666,11 +852,11 @@ $.validator.addMethod( "iban", function( value, element ) { cRest = cOperator % 97; } return cRest === 1; -}, "Please specify a valid IBAN" ); +}, "Please specify a valid IBAN." ); $.validator.addMethod( "integer", function( value, element ) { return this.optional( element ) || /^-?\d+$/.test( value ); -}, "A positive or negative non-decimal number please" ); +}, "A positive or negative non-decimal number please." ); $.validator.addMethod( "ipv4", function( value, element ) { return this.optional( element ) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test( value ); @@ -680,17 +866,103 @@ $.validator.addMethod( "ipv6", function( value, element ) { return this.optional( element ) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test( value ); }, "Please enter a valid IP v6 address." ); +$.validator.addMethod( "lessThan", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-lessThan-blur" ).length ) { + target.addClass( "validate-lessThan-blur" ).on( "blur.validate-lessThan", function() { + $( element ).valid(); + } ); + } + + return value < target.val(); +}, "Please enter a lesser value." ); + +$.validator.addMethod( "lessThanEqual", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-lessThanEqual-blur" ).length ) { + target.addClass( "validate-lessThanEqual-blur" ).on( "blur.validate-lessThanEqual", function() { + $( element ).valid(); + } ); + } + + return value <= target.val(); +}, "Please enter a lesser value." ); + $.validator.addMethod( "lettersonly", function( value, element ) { return this.optional( element ) || /^[a-z]+$/i.test( value ); -}, "Letters only please" ); +}, "Letters only please." ); $.validator.addMethod( "letterswithbasicpunc", function( value, element ) { return this.optional( element ) || /^[a-z\-.,()'"\s]+$/i.test( value ); -}, "Letters or punctuation only please" ); +}, "Letters or punctuation only please." ); + +// Limit the number of files in a FileList. +$.validator.addMethod( "maxfiles", function( value, element, param ) { + if ( this.optional( element ) ) { + return true; + } + + if ( $( element ).attr( "type" ) === "file" ) { + if ( element.files && element.files.length > param ) { + return false; + } + } + + return true; +}, $.validator.format( "Please select no more than {0} files." ) ); + +// Limit the size of each individual file in a FileList. +$.validator.addMethod( "maxsize", function( value, element, param ) { + if ( this.optional( element ) ) { + return true; + } + + if ( $( element ).attr( "type" ) === "file" ) { + if ( element.files && element.files.length ) { + for ( var i = 0; i < element.files.length; i++ ) { + if ( element.files[ i ].size > param ) { + return false; + } + } + } + } + + return true; +}, $.validator.format( "File size must not exceed {0} bytes each." ) ); + +// Limit the size of all files in a FileList. +$.validator.addMethod( "maxsizetotal", function( value, element, param ) { + if ( this.optional( element ) ) { + return true; + } + + if ( $( element ).attr( "type" ) === "file" ) { + if ( element.files && element.files.length ) { + var totalSize = 0; + + for ( var i = 0; i < element.files.length; i++ ) { + totalSize += element.files[ i ].size; + if ( totalSize > param ) { + return false; + } + } + } + } + + return true; +}, $.validator.format( "Total size of all files must not exceed {0} bytes." ) ); + $.validator.addMethod( "mobileNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); + +$.validator.addMethod( "mobileRU", function( phone_number, element ) { + var ruPhone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); + return this.optional( element ) || ruPhone_number.length > 9 && /^((\+7|7|8)+([0-9]){10})$/.test( ruPhone_number ); +}, "Please specify a valid mobile number." ); /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: @@ -704,7 +976,7 @@ $.validator.addMethod( "mobileUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); $.validator.addMethod( "netmask", function( value, element ) { return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value ); @@ -804,13 +1076,71 @@ $.validator.addMethod( "nipPL", function( value ) { return ( intControlNr === parseInt( value[ 9 ], 10 ) ); }, "Please specify a valid NIP number." ); +/** + * Created for project jquery-validation. + * @Description Brazillian PIS or NIS number (Número de Identificação Social Pis ou Pasep) is the equivalent of a + * Brazilian tax registration number NIS of PIS numbers have 11 digits in total: 10 numbers followed by 1 check numbers + * that are being used for validation. + * @copyright (c) 21/08/2018 13:14, Cleiton da Silva Mendonça + * @author Cleiton da Silva Mendonça + * @link http://gitlab.com/csmendonca Gitlab of Cleiton da Silva Mendonça + * @link http://github.com/csmendonca Github of Cleiton da Silva Mendonça + */ +$.validator.addMethod( "nisBR", function( value ) { + var number; + var cn; + var sum = 0; + var dv; + var count; + var multiplier; + + // Removing special characters from value + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); + + // Checking value to have 11 digits only + if ( value.length !== 11 ) { + return false; + } + + //Get check number of value + cn = parseInt( value.substring( 10, 11 ), 10 ); + + //Get number with 10 digits of the value + number = parseInt( value.substring( 0, 10 ), 10 ); + + for ( count = 2; count < 12; count++ ) { + multiplier = count; + if ( count === 10 ) { + multiplier = 2; + } + if ( count === 11 ) { + multiplier = 3; + } + sum += ( ( number % 10 ) * multiplier ); + number = parseInt( number / 10, 10 ); + } + dv = ( sum % 11 ); + + if ( dv > 1 ) { + dv = ( 11 - dv ); + } else { + dv = 0; + } + + if ( cn === dv ) { + return true; + } else { + return false; + } +}, "Please specify a valid NIS/PIS number." ); + $.validator.addMethod( "notEqualTo", function( value, element, param ) { return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); }, "Please enter a different value, values must not be the same." ); $.validator.addMethod( "nowhitespace", function( value, element ) { return this.optional( element ) || /^\S+$/i.test( value ); -}, "No white space please" ); +}, "No white space please." ); /** * Return true if the field value matches the given format RegExp @@ -842,6 +1172,30 @@ $.validator.addMethod( "phoneNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); }, "Please specify a valid phone number." ); +/** + * Polish telephone numbers have 9 digits. + * + * Mobile phone numbers starts with following digits: + * 45, 50, 51, 53, 57, 60, 66, 69, 72, 73, 78, 79, 88. + * + * Fixed-line numbers starts with area codes: + * 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 29, 32, 33, + * 34, 41, 42, 43, 44, 46, 48, 52, 54, 55, 56, 58, 59, 61, + * 62, 63, 65, 67, 68, 71, 74, 75, 76, 77, 81, 82, 83, 84, + * 85, 86, 87, 89, 91, 94, 95. + * + * Ministry of National Defence numbers and VoIP numbers starts with 26 and 39. + * + * Excludes intelligent networks (premium rate, shared cost, free phone numbers). + * + * Poland National Numbering Plan http://www.itu.int/oth/T02020000A8/en + */ +$.validator.addMethod( "phonePL", function( phone_number, element ) { + phone_number = phone_number.replace( /\s+/g, "" ); + var regexp = /^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/; + return this.optional( element ) || regexp.test( phone_number ); +}, "Please specify a valid phone number." ); + /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ @@ -856,7 +1210,7 @@ $.validator.addMethod( "phonesUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ ); -}, "Please specify a valid uk phone number" ); +}, "Please specify a valid uk phone number." ); /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: @@ -870,7 +1224,7 @@ $.validator.addMethod( "phoneUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ ); -}, "Please specify a valid phone number" ); +}, "Please specify a valid phone number." ); /** * Matches US phone number format @@ -891,8 +1245,8 @@ $.validator.addMethod( "phoneUK", function( phone_number, element ) { $.validator.addMethod( "phoneUS", function( phone_number, element ) { phone_number = phone_number.replace( /\s+/g, "" ); return this.optional( element ) || phone_number.length > 9 && - phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); -}, "Please specify a valid phone number" ); + phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/ ); +}, "Please specify a valid phone number." ); /* * Valida CEPs do brasileiros: @@ -921,21 +1275,21 @@ $.validator.addMethod( "postalcodeBR", function( cep_value, element ) { */ $.validator.addMethod( "postalCodeCA", function( value, element ) { return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); /* Matches Italian postcode (CAP) */ $.validator.addMethod( "postalcodeIT", function( value, element ) { return this.optional( element ) || /^\d{5}$/.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); $.validator.addMethod( "postalcodeNL", function( value, element ) { return this.optional( element ) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); // Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK) $.validator.addMethod( "postcodeUK", function( value, element ) { return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value ); -}, "Please specify a valid UK postcode" ); +}, "Please specify a valid UK postcode." ); /* * Lets you say "at least X inputs that match selector Y must be filled." @@ -1072,24 +1426,24 @@ $.validator.addMethod( "stateUS", function( value, element, options ) { regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid state" ); +}, "Please specify a valid state." ); // TODO check if value starts with <, otherwise don't try stripping anything $.validator.addMethod( "strippedminlength", function( value, element, param ) { return $( value ).text().length >= param; -}, $.validator.format( "Please enter at least {0} characters" ) ); +}, $.validator.format( "Please enter at least {0} characters." ) ); $.validator.addMethod( "time", function( value, element ) { return this.optional( element ) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test( value ); -}, "Please enter a valid time, between 00:00 and 23:59" ); +}, "Please enter a valid time, between 00:00 and 23:59." ); $.validator.addMethod( "time12h", function( value, element ) { return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); -}, "Please enter a valid time in 12-hour am/pm format" ); +}, "Please enter a valid time in 12-hour am/pm format." ); // Same as url, but TLD is optional $.validator.addMethod( "url2", function( value, element ) { - return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); }, $.validator.messages.url ); /** @@ -1149,10 +1503,10 @@ $.validator.addMethod( "vinUS", function( v ) { $.validator.addMethod( "zipcodeUS", function( value, element ) { return this.optional( element ) || /^\d{5}(-\d{4})?$/.test( value ); -}, "The specified US ZIP Code is invalid" ); +}, "The specified US ZIP Code is invalid." ); $.validator.addMethod( "ziprange", function( value, element ) { return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); -}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); +}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx." ); return $; })); \ No newline at end of file diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js index 6767f24f6b12..80f14b58c2e1 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js @@ -1,4 +1,4 @@ -/*! jQuery Validation Plugin - v1.17.0 - 7/29/2017 +/*! jQuery Validation Plugin - v1.19.5 - 7/1/2022 * https://jqueryvalidation.org/ - * Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */ -!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f=0;if(b=parseInt(a.substring(9,10),10),c=parseInt(a.substring(10,11),10),d=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(e=1;e<=9;e++)f+=parseInt(a.substring(e-1,e),10)*(11-e);if(d(f,b)){for(f=0,e=1;e<=10;e++)f+=parseInt(a.substring(e-1,e),10)*(12-e);return d(f,c)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("abaRoutingNumber",function(a){var b=0,c=a.split(""),d=c.length;if(9!==d)return!1;for(var e=0;e9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cnhBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f,g,h=0,i=0;if(b=a.charAt(0),new Array(12).join(b)===a)return!1;for(e=0,f=9,g=0;e<9;++e,--f)h+=+(a.charAt(e)*f);for(c=h%11,c>=10&&(c=0,i=2),h=0,e=0,f=1,g=0;e<9;++e,++f)h+=+(a.charAt(e)*f);return d=h%11,d>=10?d=0:d-=i,String(c).concat(d)===a.substr(-2)},"Please specify a valid CNH number."),a.validator.addMethod("cnpjBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/[^\d]+/g,""),14!==a.length)return!1;if("00000000000000"===a||"11111111111111"===a||"22222222222222"===a||"33333333333333"===a||"44444444444444"===a||"55555555555555"===a||"66666666666666"===a||"77777777777777"===a||"88888888888888"===a||"99999999999999"===a)return!1;for(var c=a.length-2,d=a.substring(0,c),e=a.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=d.charAt(c-h)*g--,g<2&&(g=9);var i=f%11<2?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;c+=1,d=a.substring(0,c),f=0,g=c-7;for(var j=c;j>=1;j--)f+=d.charAt(c-j)*g--,g<2&&(g=9);return i=f%11<2?0:11-f%11,i===parseInt(e.charAt(1),10)},"Please specify a CNPJ value number."),a.validator.addMethod("cpfBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var c,d,e,f,g=0;if(c=parseInt(a.substring(9,10),10),d=parseInt(a.substring(10,11),10),e=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(f=1;f<=9;f++)g+=parseInt(a.substring(f-1,f),10)*(11-f);if(e(g,c)){for(g=0,f=1;f<=10;f++)g+=parseInt(a.substring(f-1,f),10)*(12-f);return e(g,d)}return!1},"Please specify a valid CPF number."),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&(/^(5[12345])/.test(a)||/^(2[234567])/.test(a))?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency."),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number."),a.validator.addMethod("greaterThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThan-blur").length&&e.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",function(){a(c).valid()}),b>e.val()},"Please enter a greater value."),a.validator.addMethod("greaterThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThanEqual-blur").length&&e.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",function(){a(c).valid()}),b>=e.val()},"Please enter a greater value."),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.lengthd)},a.validator.format("Please select no more than {0} files.")),a.validator.addMethod("maxsize",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0;ed)return!1;return!0},a.validator.format("File size must not exceed {0} bytes each.")),a.validator.addMethod("maxsizetotal",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0,f=0;fd)return!1;return!0},a.validator.format("Total size of all files must not exceed {0} bytes.")),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number."),a.validator.addMethod("mobileRU",function(a,b){var c=a.replace(/\(|\)|\s+|-/g,"");return this.optional(b)||c.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(c)},"Please specify a valid mobile number."),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number."),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("nisBR",function(a){var b,c,d,e,f,g=0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;for(c=parseInt(a.substring(10,11),10),b=parseInt(a.substring(0,10),10),e=2;e<12;e++)f=e,10===e&&(f=2),11===e&&(f=3),g+=b%10*f,b=parseInt(b/10,10);return d=g%11,d=d>1?11-d:0,c===d},"Please specify a valid NIS/PIS number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please."),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonePL",function(a,b){a=a.replace(/\s+/g,"");var c=/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/;return this.optional(b)||c.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number."),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number."),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode."),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state."),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters.")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59."),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format."),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c - - + diff --git a/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml b/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml index 454a065353d9..3220b07142e1 100644 --- a/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml +++ b/src/Identity/samples/IdentitySample.Mvc/Views/Shared/_ValidationScriptsPartial.cshtml @@ -1,2 +1,2 @@ - + diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js index e129bc0f74b9..c6a7229185ab 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.js @@ -1,9 +1,9 @@ /*! - * jQuery Validation Plugin v1.17.0 + * jQuery Validation Plugin v1.19.5 * * https://jqueryvalidation.org/ * - * Copyright (c) 2017 Jörn Zaefferer + * Copyright (c) 2022 Jörn Zaefferer * Released under the MIT license */ (function( factory ) { @@ -43,6 +43,38 @@ }() ); +/** + * This is used in the United States to process payments, deposits, + * or transfers using the Automated Clearing House (ACH) or Fedwire + * systems. A very common use case would be to validate a form for + * an ACH bill payment. + */ +$.validator.addMethod( "abaRoutingNumber", function( value ) { + var checksum = 0; + var tokens = value.split( "" ); + var length = tokens.length; + + // Length Check + if ( length !== 9 ) { + return false; + } + + // Calc the checksum + // https://en.wikipedia.org/wiki/ABA_routing_transit_number + for ( var i = 0; i < length; i += 3 ) { + checksum += parseInt( tokens[ i ], 10 ) * 3 + + parseInt( tokens[ i + 1 ], 10 ) * 7 + + parseInt( tokens[ i + 2 ], 10 ); + } + + // If not zero and divisible by 10 then valid + if ( checksum !== 0 && checksum % 10 === 0 ) { + return true; + } + + return false; +}, "Please enter a valid routing number." ); + // Accept a value from a file input based on a required mimetype $.validator.addMethod( "accept", function( value, element, param ) { @@ -87,7 +119,7 @@ $.validator.addMethod( "accept", function( value, element, param ) { $.validator.addMethod( "alphanumeric", function( value, element ) { return this.optional( element ) || /^\w+$/i.test( value ); -}, "Letters, numbers, and underscores only please" ); +}, "Letters, numbers, and underscores only please." ); /* * Dutch bank account numbers (not 'giro' numbers) have 9 digits @@ -114,13 +146,13 @@ $.validator.addMethod( "bankaccountNL", function( value, element ) { sum = sum + factor * digit; } return sum % 11 === 0; -}, "Please specify a valid bank account number" ); +}, "Please specify a valid bank account number." ); $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { return this.optional( element ) || ( $.validator.methods.bankaccountNL.call( this, value, element ) ) || ( $.validator.methods.giroaccountNL.call( this, value, element ) ); -}, "Please specify a valid bank or giro account number" ); +}, "Please specify a valid bank or giro account number." ); /** * BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity. @@ -139,7 +171,7 @@ $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { */ $.validator.addMethod( "bic", function( value, element ) { return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() ); -}, "Please specify a valid BIC code" ); +}, "Please specify a valid BIC code." ); /* * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities @@ -256,11 +288,141 @@ $.validator.addMethod( "cifES", function( value, element ) { }, "Please specify a valid CIF number." ); +/* + * Brazillian CNH number (Carteira Nacional de Habilitacao) is the License Driver number. + * CNH numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. + */ +$.validator.addMethod( "cnhBR", function( value ) { + + // Removing special characters from value + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); + + // Checking value to have 11 digits only + if ( value.length !== 11 ) { + return false; + } + + var sum = 0, dsc = 0, firstChar, + firstCN, secondCN, i, j, v; + + firstChar = value.charAt( 0 ); + + if ( new Array( 12 ).join( firstChar ) === value ) { + return false; + } + + // Step 1 - using first Check Number: + for ( i = 0, j = 9, v = 0; i < 9; ++i, --j ) { + sum += +( value.charAt( i ) * j ); + } + + firstCN = sum % 11; + if ( firstCN >= 10 ) { + firstCN = 0; + dsc = 2; + } + + sum = 0; + for ( i = 0, j = 1, v = 0; i < 9; ++i, ++j ) { + sum += +( value.charAt( i ) * j ); + } + + secondCN = sum % 11; + if ( secondCN >= 10 ) { + secondCN = 0; + } else { + secondCN = secondCN - dsc; + } + + return ( String( firstCN ).concat( secondCN ) === value.substr( -2 ) ); + +}, "Please specify a valid CNH number." ); + +/* + * Brazillian value number (Cadastrado de Pessoas Juridica). + * value numbers have 14 digits in total: 12 numbers followed by 2 check numbers that are being used for validation. + */ +$.validator.addMethod( "cnpjBR", function( value, element ) { + "use strict"; + + if ( this.optional( element ) ) { + return true; + } + + // Removing no number + value = value.replace( /[^\d]+/g, "" ); + + // Checking value to have 14 digits only + if ( value.length !== 14 ) { + return false; + } + + // Elimina values invalidos conhecidos + if ( value === "00000000000000" || + value === "11111111111111" || + value === "22222222222222" || + value === "33333333333333" || + value === "44444444444444" || + value === "55555555555555" || + value === "66666666666666" || + value === "77777777777777" || + value === "88888888888888" || + value === "99999999999999" ) { + return false; + } + + // Valida DVs + var tamanho = ( value.length - 2 ); + var numeros = value.substring( 0, tamanho ); + var digitos = value.substring( tamanho ); + var soma = 0; + var pos = tamanho - 7; + + for ( var i = tamanho; i >= 1; i-- ) { + soma += numeros.charAt( tamanho - i ) * pos--; + if ( pos < 2 ) { + pos = 9; + } + } + + var resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; + + if ( resultado !== parseInt( digitos.charAt( 0 ), 10 ) ) { + return false; + } + + tamanho = tamanho + 1; + numeros = value.substring( 0, tamanho ); + soma = 0; + pos = tamanho - 7; + + for ( var il = tamanho; il >= 1; il-- ) { + soma += numeros.charAt( tamanho - il ) * pos--; + if ( pos < 2 ) { + pos = 9; + } + } + + resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; + + if ( resultado !== parseInt( digitos.charAt( 1 ), 10 ) ) { + return false; + } + + return true; + +}, "Please specify a CNPJ value number." ); + /* * Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number. * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. */ -$.validator.addMethod( "cpfBR", function( value ) { +$.validator.addMethod( "cpfBR", function( value, element ) { + "use strict"; + + if ( this.optional( element ) ) { + return true; + } // Removing special characters from value value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); @@ -315,7 +477,7 @@ $.validator.addMethod( "cpfBR", function( value ) { } return false; -}, "Please specify a valid CPF number" ); +}, "Please specify a valid CPF number." ); // https://jqueryvalidation.org/creditcard-method/ // based on https://en.wikipedia.org/wiki/Luhn_algorithm @@ -337,7 +499,7 @@ $.validator.addMethod( "creditcard", function( value, element ) { value = value.replace( /\D/g, "" ); // Basing min and max length on - // https://developer.ean.com/general_info/Valid_Credit_Card_Types + // https://dev.ean.com/general-info/valid-card-types/ if ( value.length < 13 || value.length > 19 ) { return false; } @@ -359,7 +521,7 @@ $.validator.addMethod( "creditcard", function( value, element ) { }, "Please enter a valid credit card number." ); /* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator - * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 + * Redistributed under the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) */ $.validator.addMethod( "creditcardtypes", function( value, element, param ) { @@ -398,7 +560,7 @@ $.validator.addMethod( "creditcardtypes", function( value, element, param ) { if ( param.all ) { validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; } - if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard + if ( validTypes & 0x0001 && ( /^(5[12345])/.test( value ) || /^(2[234567])/.test( value ) ) ) { // Mastercard return value.length === 16; } if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa @@ -468,7 +630,7 @@ $.validator.addMethod( "currency", function( value, element, param ) { regex = new RegExp( regex ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid currency" ); +}, "Please specify a valid currency." ); $.validator.addMethod( "dateFA", function( value, element ) { return this.optional( element ) || /^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test( value ); @@ -529,7 +691,31 @@ $.validator.addMethod( "extension", function( value, element, param ) { */ $.validator.addMethod( "giroaccountNL", function( value, element ) { return this.optional( element ) || /^[0-9]{1,7}$/.test( value ); -}, "Please specify a valid giro account number" ); +}, "Please specify a valid giro account number." ); + +$.validator.addMethod( "greaterThan", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-greaterThan-blur" ).length ) { + target.addClass( "validate-greaterThan-blur" ).on( "blur.validate-greaterThan", function() { + $( element ).valid(); + } ); + } + + return value > target.val(); +}, "Please enter a greater value." ); + +$.validator.addMethod( "greaterThanEqual", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-greaterThanEqual-blur" ).length ) { + target.addClass( "validate-greaterThanEqual-blur" ).on( "blur.validate-greaterThanEqual", function() { + $( element ).valid(); + } ); + } + + return value >= target.val(); +}, "Please enter a greater value." ); /** * IBAN is the international bank account number. @@ -666,11 +852,11 @@ $.validator.addMethod( "iban", function( value, element ) { cRest = cOperator % 97; } return cRest === 1; -}, "Please specify a valid IBAN" ); +}, "Please specify a valid IBAN." ); $.validator.addMethod( "integer", function( value, element ) { return this.optional( element ) || /^-?\d+$/.test( value ); -}, "A positive or negative non-decimal number please" ); +}, "A positive or negative non-decimal number please." ); $.validator.addMethod( "ipv4", function( value, element ) { return this.optional( element ) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test( value ); @@ -680,17 +866,103 @@ $.validator.addMethod( "ipv6", function( value, element ) { return this.optional( element ) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test( value ); }, "Please enter a valid IP v6 address." ); +$.validator.addMethod( "lessThan", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-lessThan-blur" ).length ) { + target.addClass( "validate-lessThan-blur" ).on( "blur.validate-lessThan", function() { + $( element ).valid(); + } ); + } + + return value < target.val(); +}, "Please enter a lesser value." ); + +$.validator.addMethod( "lessThanEqual", function( value, element, param ) { + var target = $( param ); + + if ( this.settings.onfocusout && target.not( ".validate-lessThanEqual-blur" ).length ) { + target.addClass( "validate-lessThanEqual-blur" ).on( "blur.validate-lessThanEqual", function() { + $( element ).valid(); + } ); + } + + return value <= target.val(); +}, "Please enter a lesser value." ); + $.validator.addMethod( "lettersonly", function( value, element ) { return this.optional( element ) || /^[a-z]+$/i.test( value ); -}, "Letters only please" ); +}, "Letters only please." ); $.validator.addMethod( "letterswithbasicpunc", function( value, element ) { return this.optional( element ) || /^[a-z\-.,()'"\s]+$/i.test( value ); -}, "Letters or punctuation only please" ); +}, "Letters or punctuation only please." ); + +// Limit the number of files in a FileList. +$.validator.addMethod( "maxfiles", function( value, element, param ) { + if ( this.optional( element ) ) { + return true; + } + + if ( $( element ).attr( "type" ) === "file" ) { + if ( element.files && element.files.length > param ) { + return false; + } + } + + return true; +}, $.validator.format( "Please select no more than {0} files." ) ); + +// Limit the size of each individual file in a FileList. +$.validator.addMethod( "maxsize", function( value, element, param ) { + if ( this.optional( element ) ) { + return true; + } + + if ( $( element ).attr( "type" ) === "file" ) { + if ( element.files && element.files.length ) { + for ( var i = 0; i < element.files.length; i++ ) { + if ( element.files[ i ].size > param ) { + return false; + } + } + } + } + + return true; +}, $.validator.format( "File size must not exceed {0} bytes each." ) ); + +// Limit the size of all files in a FileList. +$.validator.addMethod( "maxsizetotal", function( value, element, param ) { + if ( this.optional( element ) ) { + return true; + } + + if ( $( element ).attr( "type" ) === "file" ) { + if ( element.files && element.files.length ) { + var totalSize = 0; + + for ( var i = 0; i < element.files.length; i++ ) { + totalSize += element.files[ i ].size; + if ( totalSize > param ) { + return false; + } + } + } + } + + return true; +}, $.validator.format( "Total size of all files must not exceed {0} bytes." ) ); + $.validator.addMethod( "mobileNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); + +$.validator.addMethod( "mobileRU", function( phone_number, element ) { + var ruPhone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); + return this.optional( element ) || ruPhone_number.length > 9 && /^((\+7|7|8)+([0-9]){10})$/.test( ruPhone_number ); +}, "Please specify a valid mobile number." ); /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: @@ -704,7 +976,7 @@ $.validator.addMethod( "mobileUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); $.validator.addMethod( "netmask", function( value, element ) { return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value ); @@ -804,13 +1076,71 @@ $.validator.addMethod( "nipPL", function( value ) { return ( intControlNr === parseInt( value[ 9 ], 10 ) ); }, "Please specify a valid NIP number." ); +/** + * Created for project jquery-validation. + * @Description Brazillian PIS or NIS number (Número de Identificação Social Pis ou Pasep) is the equivalent of a + * Brazilian tax registration number NIS of PIS numbers have 11 digits in total: 10 numbers followed by 1 check numbers + * that are being used for validation. + * @copyright (c) 21/08/2018 13:14, Cleiton da Silva Mendonça + * @author Cleiton da Silva Mendonça + * @link http://gitlab.com/csmendonca Gitlab of Cleiton da Silva Mendonça + * @link http://github.com/csmendonca Github of Cleiton da Silva Mendonça + */ +$.validator.addMethod( "nisBR", function( value ) { + var number; + var cn; + var sum = 0; + var dv; + var count; + var multiplier; + + // Removing special characters from value + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); + + // Checking value to have 11 digits only + if ( value.length !== 11 ) { + return false; + } + + //Get check number of value + cn = parseInt( value.substring( 10, 11 ), 10 ); + + //Get number with 10 digits of the value + number = parseInt( value.substring( 0, 10 ), 10 ); + + for ( count = 2; count < 12; count++ ) { + multiplier = count; + if ( count === 10 ) { + multiplier = 2; + } + if ( count === 11 ) { + multiplier = 3; + } + sum += ( ( number % 10 ) * multiplier ); + number = parseInt( number / 10, 10 ); + } + dv = ( sum % 11 ); + + if ( dv > 1 ) { + dv = ( 11 - dv ); + } else { + dv = 0; + } + + if ( cn === dv ) { + return true; + } else { + return false; + } +}, "Please specify a valid NIS/PIS number." ); + $.validator.addMethod( "notEqualTo", function( value, element, param ) { return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); }, "Please enter a different value, values must not be the same." ); $.validator.addMethod( "nowhitespace", function( value, element ) { return this.optional( element ) || /^\S+$/i.test( value ); -}, "No white space please" ); +}, "No white space please." ); /** * Return true if the field value matches the given format RegExp @@ -842,6 +1172,30 @@ $.validator.addMethod( "phoneNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); }, "Please specify a valid phone number." ); +/** + * Polish telephone numbers have 9 digits. + * + * Mobile phone numbers starts with following digits: + * 45, 50, 51, 53, 57, 60, 66, 69, 72, 73, 78, 79, 88. + * + * Fixed-line numbers starts with area codes: + * 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 29, 32, 33, + * 34, 41, 42, 43, 44, 46, 48, 52, 54, 55, 56, 58, 59, 61, + * 62, 63, 65, 67, 68, 71, 74, 75, 76, 77, 81, 82, 83, 84, + * 85, 86, 87, 89, 91, 94, 95. + * + * Ministry of National Defence numbers and VoIP numbers starts with 26 and 39. + * + * Excludes intelligent networks (premium rate, shared cost, free phone numbers). + * + * Poland National Numbering Plan http://www.itu.int/oth/T02020000A8/en + */ +$.validator.addMethod( "phonePL", function( phone_number, element ) { + phone_number = phone_number.replace( /\s+/g, "" ); + var regexp = /^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/; + return this.optional( element ) || regexp.test( phone_number ); +}, "Please specify a valid phone number." ); + /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ @@ -856,7 +1210,7 @@ $.validator.addMethod( "phonesUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ ); -}, "Please specify a valid uk phone number" ); +}, "Please specify a valid uk phone number." ); /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: @@ -870,7 +1224,7 @@ $.validator.addMethod( "phoneUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ ); -}, "Please specify a valid phone number" ); +}, "Please specify a valid phone number." ); /** * Matches US phone number format @@ -891,8 +1245,8 @@ $.validator.addMethod( "phoneUK", function( phone_number, element ) { $.validator.addMethod( "phoneUS", function( phone_number, element ) { phone_number = phone_number.replace( /\s+/g, "" ); return this.optional( element ) || phone_number.length > 9 && - phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); -}, "Please specify a valid phone number" ); + phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/ ); +}, "Please specify a valid phone number." ); /* * Valida CEPs do brasileiros: @@ -921,21 +1275,21 @@ $.validator.addMethod( "postalcodeBR", function( cep_value, element ) { */ $.validator.addMethod( "postalCodeCA", function( value, element ) { return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); /* Matches Italian postcode (CAP) */ $.validator.addMethod( "postalcodeIT", function( value, element ) { return this.optional( element ) || /^\d{5}$/.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); $.validator.addMethod( "postalcodeNL", function( value, element ) { return this.optional( element ) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); // Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK) $.validator.addMethod( "postcodeUK", function( value, element ) { return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value ); -}, "Please specify a valid UK postcode" ); +}, "Please specify a valid UK postcode." ); /* * Lets you say "at least X inputs that match selector Y must be filled." @@ -1072,24 +1426,24 @@ $.validator.addMethod( "stateUS", function( value, element, options ) { regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid state" ); +}, "Please specify a valid state." ); // TODO check if value starts with <, otherwise don't try stripping anything $.validator.addMethod( "strippedminlength", function( value, element, param ) { return $( value ).text().length >= param; -}, $.validator.format( "Please enter at least {0} characters" ) ); +}, $.validator.format( "Please enter at least {0} characters." ) ); $.validator.addMethod( "time", function( value, element ) { return this.optional( element ) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test( value ); -}, "Please enter a valid time, between 00:00 and 23:59" ); +}, "Please enter a valid time, between 00:00 and 23:59." ); $.validator.addMethod( "time12h", function( value, element ) { return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); -}, "Please enter a valid time in 12-hour am/pm format" ); +}, "Please enter a valid time in 12-hour am/pm format." ); // Same as url, but TLD is optional $.validator.addMethod( "url2", function( value, element ) { - return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); }, $.validator.messages.url ); /** @@ -1149,10 +1503,10 @@ $.validator.addMethod( "vinUS", function( v ) { $.validator.addMethod( "zipcodeUS", function( value, element ) { return this.optional( element ) || /^\d{5}(-\d{4})?$/.test( value ); -}, "The specified US ZIP Code is invalid" ); +}, "The specified US ZIP Code is invalid." ); $.validator.addMethod( "ziprange", function( value, element ) { return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); -}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); +}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx." ); return $; })); \ No newline at end of file diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js index 6767f24f6b12..80f14b58c2e1 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/wwwroot/lib/jquery-validation/dist/additional-methods.min.js @@ -1,4 +1,4 @@ -/*! jQuery Validation Plugin - v1.17.0 - 7/29/2017 +/*! jQuery Validation Plugin - v1.19.5 - 7/1/2022 * https://jqueryvalidation.org/ - * Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */ -!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f=0;if(b=parseInt(a.substring(9,10),10),c=parseInt(a.substring(10,11),10),d=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(e=1;e<=9;e++)f+=parseInt(a.substring(e-1,e),10)*(11-e);if(d(f,b)){for(f=0,e=1;e<=10;e++)f+=parseInt(a.substring(e-1,e),10)*(12-e);return d(f,c)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("abaRoutingNumber",function(a){var b=0,c=a.split(""),d=c.length;if(9!==d)return!1;for(var e=0;e9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cnhBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f,g,h=0,i=0;if(b=a.charAt(0),new Array(12).join(b)===a)return!1;for(e=0,f=9,g=0;e<9;++e,--f)h+=+(a.charAt(e)*f);for(c=h%11,c>=10&&(c=0,i=2),h=0,e=0,f=1,g=0;e<9;++e,++f)h+=+(a.charAt(e)*f);return d=h%11,d>=10?d=0:d-=i,String(c).concat(d)===a.substr(-2)},"Please specify a valid CNH number."),a.validator.addMethod("cnpjBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/[^\d]+/g,""),14!==a.length)return!1;if("00000000000000"===a||"11111111111111"===a||"22222222222222"===a||"33333333333333"===a||"44444444444444"===a||"55555555555555"===a||"66666666666666"===a||"77777777777777"===a||"88888888888888"===a||"99999999999999"===a)return!1;for(var c=a.length-2,d=a.substring(0,c),e=a.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=d.charAt(c-h)*g--,g<2&&(g=9);var i=f%11<2?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;c+=1,d=a.substring(0,c),f=0,g=c-7;for(var j=c;j>=1;j--)f+=d.charAt(c-j)*g--,g<2&&(g=9);return i=f%11<2?0:11-f%11,i===parseInt(e.charAt(1),10)},"Please specify a CNPJ value number."),a.validator.addMethod("cpfBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var c,d,e,f,g=0;if(c=parseInt(a.substring(9,10),10),d=parseInt(a.substring(10,11),10),e=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(f=1;f<=9;f++)g+=parseInt(a.substring(f-1,f),10)*(11-f);if(e(g,c)){for(g=0,f=1;f<=10;f++)g+=parseInt(a.substring(f-1,f),10)*(12-f);return e(g,d)}return!1},"Please specify a valid CPF number."),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&(/^(5[12345])/.test(a)||/^(2[234567])/.test(a))?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency."),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number."),a.validator.addMethod("greaterThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThan-blur").length&&e.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",function(){a(c).valid()}),b>e.val()},"Please enter a greater value."),a.validator.addMethod("greaterThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThanEqual-blur").length&&e.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",function(){a(c).valid()}),b>=e.val()},"Please enter a greater value."),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.lengthd)},a.validator.format("Please select no more than {0} files.")),a.validator.addMethod("maxsize",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0;ed)return!1;return!0},a.validator.format("File size must not exceed {0} bytes each.")),a.validator.addMethod("maxsizetotal",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0,f=0;fd)return!1;return!0},a.validator.format("Total size of all files must not exceed {0} bytes.")),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number."),a.validator.addMethod("mobileRU",function(a,b){var c=a.replace(/\(|\)|\s+|-/g,"");return this.optional(b)||c.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(c)},"Please specify a valid mobile number."),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number."),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("nisBR",function(a){var b,c,d,e,f,g=0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;for(c=parseInt(a.substring(10,11),10),b=parseInt(a.substring(0,10),10),e=2;e<12;e++)f=e,10===e&&(f=2),11===e&&(f=3),g+=b%10*f,b=parseInt(b/10,10);return d=g%11,d=d>1?11-d:0,c===d},"Please specify a valid NIS/PIS number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please."),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonePL",function(a,b){a=a.replace(/\s+/g,"");var c=/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/;return this.optional(b)||c.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number."),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number."),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode."),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state."),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters.")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59."),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format."),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c