diff --git a/NuGet.config b/NuGet.config index f88be834fcc1..05d6d50db75d 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,10 +6,10 @@ - + - + @@ -30,10 +30,10 @@ - + - + diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index 5095e569515d..af8b9b06b329 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -2,117 +2,117 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 @@ -120,138 +120,138 @@ - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - - - + + + - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - - + + @@ -259,7 +259,7 @@ - 8.0.18 + 8.0.19 @@ -268,51 +268,51 @@ - 8.0.18 + 8.0.19 - + - + - + - + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - - + + @@ -322,8 +322,8 @@ - - + + @@ -331,8 +331,8 @@ - - + + @@ -343,58 +343,58 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 @@ -403,7 +403,7 @@ - 8.0.18 + 8.0.19 @@ -411,71 +411,71 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 - - + + - 8.0.18 + 8.0.19 @@ -491,27 +491,27 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 @@ -520,23 +520,23 @@ - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 @@ -545,54 +545,54 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - - + + - - + + - - + + - 8.0.18 + 8.0.19 - - + + - - + + - - + + - - + + @@ -600,83 +600,83 @@ - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - - - - + + + + - 8.0.18 + 8.0.19 @@ -685,64 +685,64 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 @@ -764,7 +764,7 @@ - 8.0.18 + 8.0.19 @@ -786,7 +786,7 @@ - 8.0.18 + 8.0.19 @@ -802,23 +802,23 @@ - 8.0.18 + 8.0.19 - + - + - + @@ -826,24 +826,24 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - - - + + + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 @@ -853,7 +853,7 @@ - 8.0.18 + 8.0.19 @@ -862,73 +862,73 @@ - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - + - + - + - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 @@ -957,11 +957,11 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 @@ -979,18 +979,18 @@ - 8.0.18 + 8.0.19 - 8.0.18 + 8.0.19 - + - 8.0.18 + 8.0.19 diff --git a/eng/Baseline.xml b/eng/Baseline.xml index 779ed1f014e8..5e40f13f2eca 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -4,110 +4,110 @@ This file contains a list of all the packages and their versions which were rele Update this list when preparing for a new patch. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2ddbab98bdbd..346a9afd7c06 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,37 +9,37 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 24e93fcb4900536922554fc215429cf954016ed1 + a947fe22902f3f0b921f5dafed9f059eaa4d18c6 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -121,9 +121,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -185,9 +185,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 https://github.com/dotnet/source-build-externals @@ -275,17 +275,17 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 81cabf2857a01351e5ab578947c7403a5b128ad1 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -316,22 +316,22 @@ Win-x64 is used here because we have picked an arbitrary runtime identifier to flow the version of the latest NETCore.App runtime. All Runtime.$rid packages should have the same version. --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 https://github.com/dotnet/xdt @@ -368,42 +368,42 @@ - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - fce8ed90dc43047eabec2b32c04ee46b789ad5d1 + 574100b692e71fa3426931adf4c1ba42e4ee5213 https://github.com/dotnet/winforms abda8e3bfa78319363526b5a5f86863ec979940e - + https://github.com/dotnet/arcade - 2ce3f8c7b2614c2b19985b669ffcd934bc39ffd1 + a5ec3fab69ac440afe6764b2e046af6e8fcafa74 - + https://github.com/dotnet/arcade - 2ce3f8c7b2614c2b19985b669ffcd934bc39ffd1 + a5ec3fab69ac440afe6764b2e046af6e8fcafa74 - + https://github.com/dotnet/arcade - 2ce3f8c7b2614c2b19985b669ffcd934bc39ffd1 + a5ec3fab69ac440afe6764b2e046af6e8fcafa74 - + https://github.com/dotnet/arcade - 2ce3f8c7b2614c2b19985b669ffcd934bc39ffd1 + a5ec3fab69ac440afe6764b2e046af6e8fcafa74 - + https://github.com/dotnet/arcade - 2ce3f8c7b2614c2b19985b669ffcd934bc39ffd1 + a5ec3fab69ac440afe6764b2e046af6e8fcafa74 - + https://github.com/dotnet/extensions - ca03b0c72858567f9b668d90fee32ef2d5d8dd74 + eafdf6e9c40bcd561f38979617405fd2801a46e3 - + https://github.com/dotnet/extensions - ca03b0c72858567f9b668d90fee32ef2d5d8dd74 + eafdf6e9c40bcd561f38979617405fd2801a46e3 https://github.com/nuget/nuget.client diff --git a/eng/Versions.props b/eng/Versions.props index 61efb3018ad8..dfc636c88f04 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ 8 0 - 19 + 20 true @@ -67,12 +67,12 @@ 8.0.2 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19-servicing.25365.14 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20-servicing.25419.14 8.0.0 8.0.1 8.0.0 @@ -93,7 +93,7 @@ 8.0.0 8.0.0 8.0.0 - 8.0.19-servicing.25365.14 + 8.0.20-servicing.25419.14 8.0.1 8.0.1 8.0.1 @@ -109,7 +109,7 @@ 8.0.0 8.0.2 8.0.0 - 8.0.19-servicing.25365.14 + 8.0.20-servicing.25419.14 8.0.1 8.0.1 8.0.2 @@ -129,9 +129,9 @@ 8.0.0 8.0.0 8.0.0 - 8.0.19-servicing.25365.14 + 8.0.20-servicing.25419.14 - 8.0.19-servicing.25365.14 + 8.0.20-servicing.25419.14 8.0.0 8.0.1 @@ -140,17 +140,17 @@ 8.0.0 8.0.1 - 8.1.0-preview.23604.1 - 8.1.0-preview.23604.1 + 9.0.0-preview.9.24518.1 + 9.0.0-preview.9.24518.1 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 - 8.0.19 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 + 8.0.20 4.8.0-7.24574.2 4.8.0-7.24574.2 @@ -162,9 +162,9 @@ 6.2.4 6.2.4 - 8.0.0-beta.25310.3 - 8.0.0-beta.25310.3 - 8.0.0-beta.25310.3 + 8.0.0-beta.25407.1 + 8.0.0-beta.25407.1 + 8.0.0-beta.25407.1 8.0.0-alpha.1.25202.2 diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 98ccbd7a9c16..b98f6a6505d3 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -21,6 +21,7 @@ parameters: # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md artifacts: '' enableMicrobuild: false + microbuildUseESRP: true enablePublishBuildArtifacts: false enablePublishBuildAssets: false enablePublishTestResults: false @@ -135,6 +136,11 @@ jobs: signType: $(_SignType) zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + ${{ if eq(parameters.microbuildUseESRP, true) }}: + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea + ${{ else }}: + ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca env: TeamName: $(_TeamName) MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index e295031c0985..2856f7de1061 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -134,6 +134,10 @@ jobs: signType: $(_SignType) zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea + ${{ else }}: + ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca env: TeamName: $(_TeamName) continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 82b2798ba307..bb048ad125a8 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -417,7 +417,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # Locate Visual Studio installation or download x-copy msbuild. $vsInfo = LocateVisualStudio $vsRequirements - if ($vsInfo -ne $null) { + if ($vsInfo -ne $null -and $env:ForceUseXCopyMSBuild -eq $null) { # Ensure vsInstallDir has a trailing slash $vsInstallDir = Join-Path $vsInfo.installationPath "\" $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] diff --git a/global.json b/global.json index 33fc1c7a343c..eb59ddf5a90c 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "8.0.118" + "version": "8.0.119" }, "tools": { - "dotnet": "8.0.118", + "dotnet": "8.0.119", "runtimes": { "dotnet/x86": [ "$(MicrosoftNETCoreBrowserDebugHostTransportVersion)" @@ -25,8 +25,8 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.22.19", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25310.3", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.25310.3" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25407.1", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.25407.1" }, "native-tools": { "jdk": "latest" diff --git a/src/Security/Authentication/Certificate/src/CertificateAuthenticationHandler.cs b/src/Security/Authentication/Certificate/src/CertificateAuthenticationHandler.cs index 8f8873057027..de74d6e5bf7c 100644 --- a/src/Security/Authentication/Certificate/src/CertificateAuthenticationHandler.cs +++ b/src/Security/Authentication/Certificate/src/CertificateAuthenticationHandler.cs @@ -135,21 +135,35 @@ private async Task ValidateCertificateAsync(X509Certificate2 } var chainPolicy = BuildChainPolicy(clientCertificate, isCertificateSelfSigned); - using var chain = new X509Chain + var chain = new X509Chain { ChainPolicy = chainPolicy }; - var certificateIsValid = chain.Build(clientCertificate); - if (!certificateIsValid) + try + { + var certificateIsValid = chain.Build(clientCertificate); + if (!certificateIsValid) + { + var chainErrors = new List(chain.ChainStatus.Length); + foreach (var validationFailure in chain.ChainStatus) + { + chainErrors.Add($"{validationFailure.Status} {validationFailure.StatusInformation}"); + } + Logger.CertificateFailedValidation(clientCertificate.Subject, chainErrors); + return AuthenticateResults.InvalidClientCertificate; + } + } + finally { - var chainErrors = new List(chain.ChainStatus.Length); - foreach (var validationFailure in chain.ChainStatus) + // Disposing the chain does not dispose the elements we potentially built. + // Do the full walk manually to dispose. + for (var i = 0; i < chain.ChainElements.Count; i++) { - chainErrors.Add($"{validationFailure.Status} {validationFailure.StatusInformation}"); + chain.ChainElements[i].Certificate.Dispose(); } - Logger.CertificateFailedValidation(clientCertificate.Subject, chainErrors); - return AuthenticateResults.InvalidClientCertificate; + + chain.Dispose(); } var certificateValidatedContext = new CertificateValidatedContext(Context, Scheme, Options) diff --git a/src/Shared/CertificateGeneration/UnixCertificateManager.cs b/src/Shared/CertificateGeneration/UnixCertificateManager.cs index 1febba391529..6549acb14fda 100644 --- a/src/Shared/CertificateGeneration/UnixCertificateManager.cs +++ b/src/Shared/CertificateGeneration/UnixCertificateManager.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Certificates.Generation; /// internal sealed partial class UnixCertificateManager : CertificateManager { - private const UnixFileMode DirectoryPermissions = UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute; + private const UnixFileMode DirectoryPermissions = UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute; /// The name of an environment variable consumed by OpenSSL to locate certificates. private const string OpenSslCertificateDirectoryVariableName = "SSL_CERT_DIR"; @@ -62,18 +62,32 @@ public override TrustLevel GetTrustLevel(X509Certificate2 certificate) // Building the chain will check whether dotnet trusts the cert. We could, instead, // enumerate the Root store and/or look for the file in the OpenSSL directory, but // this tests the real-world behavior. - using var chain = new X509Chain(); - // This is just a heuristic for whether or not we should prompt the user to re-run with `--trust` - // so we don't need to check revocation (which doesn't really make sense for dev certs anyway) - chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; - if (chain.Build(certificate)) + var chain = new X509Chain(); + try { - sawTrustSuccess = true; + // This is just a heuristic for whether or not we should prompt the user to re-run with `--trust` + // so we don't need to check revocation (which doesn't really make sense for dev certs anyway) + chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; + if (chain.Build(certificate)) + { + sawTrustSuccess = true; + } + else + { + sawTrustFailure = true; + Log.UnixNotTrustedByDotnet(); + } } - else + finally { - sawTrustFailure = true; - Log.UnixNotTrustedByDotnet(); + // Disposing the chain does not dispose the elements we potentially built. + // Do the full walk manually to dispose. + for (var i = 0; i < chain.ChainElements.Count; i++) + { + chain.ChainElements[i].Certificate.Dispose(); + } + + chain.Dispose(); } // Will become the name of the file on disk and the nickname in the NSS DBs @@ -94,7 +108,7 @@ public override TrustLevel GetTrustLevel(X509Certificate2 certificate) var certPath = Path.Combine(sslCertDir, certificateNickname + ".pem"); if (File.Exists(certPath)) { - var candidate = new X509Certificate2(certPath); + using var candidate = new X509Certificate2(certPath); if (AreCertificatesEqual(certificate, candidate)) { foundCert = true; @@ -161,7 +175,7 @@ protected override X509Certificate2 SaveCertificateCore(X509Certificate2 certifi store.Open(OpenFlags.ReadWrite); store.Add(certificate); store.Close(); - }; + } return certificate; } diff --git a/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/GsonHubProtocol.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/GsonHubProtocol.java index 042ca484806f..4b0c8848e816 100644 --- a/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/GsonHubProtocol.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/GsonHubProtocol.java @@ -126,7 +126,14 @@ public List parseMessages(ByteBuffer payload, InvocationBinder binde } break; case "headers": - throw new RuntimeException("Headers not implemented yet."); + // Parse headers as Map but don't store for now as it's unused + reader.beginObject(); + while (reader.hasNext()) { + reader.nextName(); // Read the key + reader.nextString(); // Read the value + } + reader.endObject(); + break; default: // Skip unknown property, allows new clients to still work with old protocols reader.skipValue(); diff --git a/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/GsonHubProtocolTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/GsonHubProtocolTest.java index d696a74850eb..2ecfd483c7f5 100644 --- a/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/GsonHubProtocolTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/GsonHubProtocolTest.java @@ -527,4 +527,98 @@ public void canRegisterTypeAdaptorWithoutAffectingJsonProtocol() { assertEquals(3, (int) invocationMessage.getArguments()[0]); assertEquals("four", invocationMessage.getArguments()[1]); } + + @Test + public void canParseInvocationMessageWithHeaders() { + String stringifiedMessage = "{\"type\":1,\"target\":\"test\",\"arguments\":[42],\"headers\":{\"a\":\"b\",\"c\":\"d\"}}\u001E"; + ByteBuffer message = TestUtils.stringToByteBuffer(stringifiedMessage); + TestBinder binder = new TestBinder(new Type[] { int.class }, null); + + List messages = hubProtocol.parseMessages(message, binder); + + assertNotNull(messages); + assertEquals(1, messages.size()); + + assertEquals(HubMessageType.INVOCATION, messages.get(0).getMessageType()); + InvocationMessage invocationMessage = (InvocationMessage) messages.get(0); + + assertEquals("test", invocationMessage.getTarget()); + assertEquals(null, invocationMessage.getInvocationId()); + int messageResult = (int)invocationMessage.getArguments()[0]; + assertEquals(42, messageResult); + // Headers are parsed but not stored, so we just verify the message was processed successfully + } + + @Test + public void canParseInvocationMessageWithEmptyHeaders() { + String stringifiedMessage = "{\"type\":1,\"target\":\"test\",\"arguments\":[42],\"headers\":{}}\u001E"; + ByteBuffer message = TestUtils.stringToByteBuffer(stringifiedMessage); + TestBinder binder = new TestBinder(new Type[] { int.class }, null); + + List messages = hubProtocol.parseMessages(message, binder); + + assertNotNull(messages); + assertEquals(1, messages.size()); + + assertEquals(HubMessageType.INVOCATION, messages.get(0).getMessageType()); + InvocationMessage invocationMessage = (InvocationMessage) messages.get(0); + + assertEquals("test", invocationMessage.getTarget()); + int messageResult = (int)invocationMessage.getArguments()[0]; + assertEquals(42, messageResult); + } + + @Test + public void canParseCompletionMessageWithHeaders() { + String stringifiedMessage = "{\"type\":3,\"invocationId\":\"1\",\"result\":42,\"headers\":{\"a\":\"b\",\"c\":\"d\"}}\u001E"; + ByteBuffer message = TestUtils.stringToByteBuffer(stringifiedMessage); + TestBinder binder = new TestBinder(null, int.class); + + List messages = hubProtocol.parseMessages(message, binder); + + assertNotNull(messages); + assertEquals(1, messages.size()); + + assertEquals(HubMessageType.COMPLETION, messages.get(0).getMessageType()); + CompletionMessage completionMessage = (CompletionMessage) messages.get(0); + assertEquals("1", completionMessage.getInvocationId()); + assertEquals(42, completionMessage.getResult()); + assertEquals(null, completionMessage.getError()); + } + + @Test + public void canParseStreamItemMessageWithHeaders() { + String stringifiedMessage = "{\"type\":2,\"invocationId\":\"1\",\"item\":\"test-item\",\"headers\":{\"a\":\"b\"}}\u001E"; + ByteBuffer message = TestUtils.stringToByteBuffer(stringifiedMessage); + TestBinder binder = new TestBinder(null, String.class); + + List messages = hubProtocol.parseMessages(message, binder); + + assertNotNull(messages); + assertEquals(1, messages.size()); + + assertEquals(HubMessageType.STREAM_ITEM, messages.get(0).getMessageType()); + StreamItem streamItem = (StreamItem) messages.get(0); + assertEquals("1", streamItem.getInvocationId()); + assertEquals("test-item", streamItem.getItem()); + } + + @Test + public void canParseMessageWithHeadersInDifferentOrder() { + String stringifiedMessage = "{\"headers\":{\"First\":\"value1\",\"Second\":\"value2\"},\"type\":1,\"target\":\"test\",\"arguments\":[42]}\u001E"; + ByteBuffer message = TestUtils.stringToByteBuffer(stringifiedMessage); + TestBinder binder = new TestBinder(new Type[] { int.class }, null); + + List messages = hubProtocol.parseMessages(message, binder); + + assertNotNull(messages); + assertEquals(1, messages.size()); + + assertEquals(HubMessageType.INVOCATION, messages.get(0).getMessageType()); + InvocationMessage invocationMessage = (InvocationMessage) messages.get(0); + + assertEquals("test", invocationMessage.getTarget()); + int messageResult = (int)invocationMessage.getArguments()[0]; + assertEquals(42, messageResult); + } } diff --git a/src/SignalR/server/StackExchangeRedis/test/Docker.cs b/src/SignalR/server/StackExchangeRedis/test/Docker.cs index 76fa6440e672..41315734daea 100644 --- a/src/SignalR/server/StackExchangeRedis/test/Docker.cs +++ b/src/SignalR/server/StackExchangeRedis/test/Docker.cs @@ -16,7 +16,8 @@ public class Docker { private static readonly string _exeSuffix = OperatingSystem.IsWindows() ? ".exe" : string.Empty; - private static readonly string _dockerContainerName = "redisTestContainer"; + private static readonly string _redisImageName = "dotnetdhmirror-f8bzbjakh8cga6ab.azurecr.io/library/redis:7.4"; + private static readonly string _dockerContainerName = "redisTestContainer74"; private static readonly string _dockerMonitorContainerName = _dockerContainerName + "Monitor"; private static readonly Lazy _instance = new Lazy(Create); @@ -112,7 +113,7 @@ void Run() // use static name 'redisTestContainer' so if the container doesn't get removed we don't keep adding more // use redis base docker image // 30 second timeout to allow redis image to be downloaded, should be a rare occurrence, only happening when a new version is released - RunProcessAndThrowIfFailed(_path, $"run --rm -p 6379:6379 --name {_dockerContainerName} -d redis", "redis", logger, TimeSpan.FromMinutes(1)); + RunProcessAndThrowIfFailed(_path, $"run --rm -p 6379:6379 --name {_dockerContainerName} -d {_redisImageName}", "redis", logger, TimeSpan.FromMinutes(1)); } } diff --git a/src/submodules/googletest b/src/submodules/googletest index c67de117379f..373af2e3df71 160000 --- a/src/submodules/googletest +++ b/src/submodules/googletest @@ -1 +1 @@ -Subproject commit c67de117379f4d1c889c7581a0a76aa0979c2083 +Subproject commit 373af2e3df71599b87a40ce0e37164523849166b