[Feature] Allow specifying the HTTP protocol version and version policy#2809
[Feature] Allow specifying the HTTP protocol version and version policy#2809pmaytak merged 13 commits intoAzureAD:devfrom
Conversation
…trieving documents.
|
@microsoft-github-policy-service agree |
|
Also fixes #1980 |
jmprieur
left a comment
There was a problem hiding this comment.
Why is this feature needed?
What are the pain points? What are the scenarios?
pmaytak
left a comment
There was a problem hiding this comment.
Getting the configuration with HTTP 2 doesn't seem to work and returns this error:
System.Net.Http.HttpRequestException: 'Requesting HTTP version 2.0 with version policy RequestVersionExact while unable to establish HTTP/2 connection.'
I used this test case and set version to 2.0 and policy to RequestVersionExact.
I added #if NET6_0_OR_GREATER
documentRetriever.HttpVersionPolicy = HttpVersionPolicy.RequestVersionExact;
documentRetriever.HttpVersion = new Version(2,0);
#endifafter Line 90 and all tests are green for me. |
Hmm. |
|
I fixed About the HTTP/2 exception, are you behind a corporate firewall which disallows HTTP/2 connections? |
Any news @pmaytak ? |
|
@prochnowc Can you please provide details for jmprieur's quesitons: |
This feature allows using HTTP/2 for discovery endpoints. HTTP/2's multiplexing allows multiple metadata requests (e.g., for .well-known/openid-configuration or JSON Web Keys (JWKs)) to be handled concurrently without needing multiple connections. It also reduces the size of the HTTP headers (because of compression) used in OIDC requests and responses, leading to faster exchanges. These optimizations minimize redundant network traffic, reduce the number of required connections, and compress transmitted data. |
|
@pmaytak Any issues left? |
The tests worked on my local machine. On my VM the PowerShell command was successful but the tests still failed. Not sure why. |
| /// <summary> | ||
| /// If set specifies the protocol version to use when sending HTTP requests. | ||
| /// </summary> | ||
| public Version HttpVersion { get; set; } |
There was a problem hiding this comment.
do we need more documentation on this? ex in the wiki?
There was a problem hiding this comment.
I could create a separate PR for the Wiki and add a page explaining how to enable HTTP/2. What do you think?
There was a problem hiding this comment.
whichever works for you. We can also take the content in a comment here and copy it over for you
There was a problem hiding this comment.
I don't think we can create a PR for a wiki?
If you paste the content here (how to use this feature), I can create a wiki page for it.
Allow specifying the HTTP protocol version and version policy
Allow specifying the HTTP protocol version and version policy when retrieving documents from eg. discovery endpoints.
Description
The PR allows users of
HttpDocumentRetriever(for example theConfigurationManager) to specify the HTTP version and version policy used when sending HTTP requests.The version and policy can bei either specified explicitly via properties on
HttpDocumentRetrieveor implicitly viaHttpClient.When using .NET 6 and no explicit values have been set, the default version and policy from the
HttpClientis used.This allows users of OpenID connect authentication to easily setup the HTTP version and policy by configuring the
HttpClientof theBackchannel.Fixes #2808