Skip to content

Commit e118a9f

Browse files
Revert changes made for Http2 (#5462)
1 parent da849d0 commit e118a9f

File tree

3 files changed

+0
-54
lines changed

3 files changed

+0
-54
lines changed

src/client/Microsoft.Identity.Client/Http/HttpManager.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,6 @@ private static HttpRequestMessage CreateRequestMessage(Uri endpoint, IDictionary
223223

224224
requestMessage.Headers.Accept.Clear();
225225

226-
#if NET5_0_OR_GREATER
227-
// On .NET 5.0 and later, HTTP2 is supported through the SDK and Entra is HTTP2 compatible
228-
// Note that HttpClient.DefaultRequestVersion does not work when using HttpRequestMessage objects
229-
requestMessage.Version = HttpVersion.Version20; // Default to HTTP/2
230-
requestMessage.VersionPolicy = HttpVersionPolicy.RequestVersionOrLower; // Allow fallback to HTTP/1.1
231-
#endif
232226
if (headers != null)
233227
{
234228
foreach (KeyValuePair<string, string> kvp in headers)

tests/Microsoft.Identity.Test.Common/Core/Helpers/HttpSnifferClientFactory.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,6 @@ public HttpSnifferClientFactory()
3232
LastHttpContentData = req.Content.ReadAsStringAsync().GetAwaiter().GetResult();
3333
}
3434

35-
// check the .net runtime
36-
var framework = RuntimeInformation.FrameworkDescription;
37-
38-
// This will match ".NET 5.0", ".NET 6.0", ".NET 7.0", ".NET 8.0", etc.
39-
if (framework.StartsWith(".NET ", StringComparison.OrdinalIgnoreCase))
40-
{
41-
// Extract the version number
42-
var versionString = framework.Substring(5).Trim(); // e.g., "6.0.0"
43-
if (Version.TryParse(versionString, out var version) && version.Major >= 5)
44-
{
45-
Assert.AreEqual(new Version(2, 0), req.Version, $"Request version mismatch: {req.Version}. MSAL on NET 5+ expects HTTP/2.0 for all requests.");
46-
// ESTS-R endpoint does not support HTTP/2.0, so we don't assert this
47-
}
48-
}
49-
5035
RequestsAndResponses.Add((req, res));
5136

5237
Trace.WriteLine($"[MSAL][HTTP Request]: {req}");

tests/Microsoft.Identity.Test.Unit/CoreTests/HttpTests/HttpManagerTests.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -634,38 +634,5 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
634634
return Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.OK));
635635
}
636636
}
637-
638-
#if NET
639-
[TestMethod]
640-
public async Task SendRequestAsync_SetsHttp2VersionAndPolicy()
641-
{
642-
// Arrange
643-
var handler = new CapturingHandler();
644-
var httpClient = new HttpClient(handler);
645-
var httpClientFactory = Substitute.For<IMsalHttpClientFactory>();
646-
httpClientFactory.GetHttpClient().Returns(httpClient);
647-
648-
var httpManager = new Client.Http.HttpManager(httpClientFactory, disableInternalRetries: true);
649-
650-
// Act
651-
await httpManager.SendRequestAsync(
652-
new Uri("https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize"),
653-
null,
654-
null,
655-
HttpMethod.Get,
656-
Substitute.For<ILoggerAdapter>(),
657-
doNotThrow: true,
658-
bindingCertificate: null,
659-
validateServerCert: null,
660-
cancellationToken: CancellationToken.None,
661-
retryPolicy: Substitute.For<IRetryPolicy>()
662-
).ConfigureAwait(false);
663-
664-
// Assert
665-
Assert.IsNotNull(handler.CapturedRequest);
666-
Assert.AreEqual(HttpVersion.Version20, handler.CapturedRequest.Version);
667-
Assert.AreEqual(HttpVersionPolicy.RequestVersionOrLower, handler.CapturedRequest.VersionPolicy);
668-
}
669-
#endif
670637
}
671638
}

0 commit comments

Comments
 (0)