diff --git a/src/client/Microsoft.Identity.Client/Http/HttpManager.cs b/src/client/Microsoft.Identity.Client/Http/HttpManager.cs index 0a2922c2c4..8cf5939468 100644 --- a/src/client/Microsoft.Identity.Client/Http/HttpManager.cs +++ b/src/client/Microsoft.Identity.Client/Http/HttpManager.cs @@ -223,12 +223,6 @@ private static HttpRequestMessage CreateRequestMessage(Uri endpoint, IDictionary requestMessage.Headers.Accept.Clear(); -#if NET5_0_OR_GREATER - // On .NET 5.0 and later, HTTP2 is supported through the SDK and Entra is HTTP2 compatible - // Note that HttpClient.DefaultRequestVersion does not work when using HttpRequestMessage objects - requestMessage.Version = HttpVersion.Version20; // Default to HTTP/2 - requestMessage.VersionPolicy = HttpVersionPolicy.RequestVersionOrLower; // Allow fallback to HTTP/1.1 -#endif if (headers != null) { foreach (KeyValuePair kvp in headers) diff --git a/tests/Microsoft.Identity.Test.Common/Core/Helpers/HttpSnifferClientFactory.cs b/tests/Microsoft.Identity.Test.Common/Core/Helpers/HttpSnifferClientFactory.cs index 1390cfe1d3..638509e719 100644 --- a/tests/Microsoft.Identity.Test.Common/Core/Helpers/HttpSnifferClientFactory.cs +++ b/tests/Microsoft.Identity.Test.Common/Core/Helpers/HttpSnifferClientFactory.cs @@ -32,21 +32,6 @@ public HttpSnifferClientFactory() LastHttpContentData = req.Content.ReadAsStringAsync().GetAwaiter().GetResult(); } - // check the .net runtime - var framework = RuntimeInformation.FrameworkDescription; - - // This will match ".NET 5.0", ".NET 6.0", ".NET 7.0", ".NET 8.0", etc. - if (framework.StartsWith(".NET ", StringComparison.OrdinalIgnoreCase)) - { - // Extract the version number - var versionString = framework.Substring(5).Trim(); // e.g., "6.0.0" - if (Version.TryParse(versionString, out var version) && version.Major >= 5) - { - Assert.AreEqual(new Version(2, 0), req.Version, $"Request version mismatch: {req.Version}. MSAL on NET 5+ expects HTTP/2.0 for all requests."); - // ESTS-R endpoint does not support HTTP/2.0, so we don't assert this - } - } - RequestsAndResponses.Add((req, res)); Trace.WriteLine($"[MSAL][HTTP Request]: {req}"); diff --git a/tests/Microsoft.Identity.Test.Unit/CoreTests/HttpTests/HttpManagerTests.cs b/tests/Microsoft.Identity.Test.Unit/CoreTests/HttpTests/HttpManagerTests.cs index f124f34d31..561e9dcb23 100644 --- a/tests/Microsoft.Identity.Test.Unit/CoreTests/HttpTests/HttpManagerTests.cs +++ b/tests/Microsoft.Identity.Test.Unit/CoreTests/HttpTests/HttpManagerTests.cs @@ -634,38 +634,5 @@ protected override Task SendAsync(HttpRequestMessage reques return Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.OK)); } } - -#if NET - [TestMethod] - public async Task SendRequestAsync_SetsHttp2VersionAndPolicy() - { - // Arrange - var handler = new CapturingHandler(); - var httpClient = new HttpClient(handler); - var httpClientFactory = Substitute.For(); - httpClientFactory.GetHttpClient().Returns(httpClient); - - var httpManager = new Client.Http.HttpManager(httpClientFactory, disableInternalRetries: true); - - // Act - await httpManager.SendRequestAsync( - new Uri("https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize"), - null, - null, - HttpMethod.Get, - Substitute.For(), - doNotThrow: true, - bindingCertificate: null, - validateServerCert: null, - cancellationToken: CancellationToken.None, - retryPolicy: Substitute.For() - ).ConfigureAwait(false); - - // Assert - Assert.IsNotNull(handler.CapturedRequest); - Assert.AreEqual(HttpVersion.Version20, handler.CapturedRequest.Version); - Assert.AreEqual(HttpVersionPolicy.RequestVersionOrLower, handler.CapturedRequest.VersionPolicy); - } -#endif } }