Skip to content

Alt-Svc tests enabled and fixed for H/3 - #53786

Merged
ManickaP merged 2 commits into
dotnet:mainfrom
ManickaP:mapichov/h3_altsvc_tests
Jun 7, 2021
Merged

ManickaP merged 2 commits into
dotnet:mainfrom
ManickaP:mapichov/h3_altsvc_tests

Conversation

@ManickaP

@ManickaP ManickaP commented Jun 6, 2021

Copy link
Copy Markdown
Member

Contributes to #53093
Also _http3Enabled is not a platform guard, IsHttp3Supported is.

@ghost ghost added the area-System.Net.Http label Jun 6, 2021
@ghost

ghost commented Jun 6, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to #53093
Also _http3Enabled is not a platform guard, IsHttp3Supported is.

Author: ManickaP
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@ghost

ghost commented Jun 6, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to #53093
Also _http3Enabled is not a platform guard, IsHttp3Supported is.

Author: ManickaP
Assignees: -
Labels:

area-System.Net.Quic

Milestone: -

private SemaphoreSlim? _http2ConnectionCreateLock;
private byte[]? _http2AltSvcOriginUri;
internal readonly byte[]? _http2EncodedAuthorityHostHeader;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is here for analyzers, not for direct functional impact. Unless needed for the Alt-Svc I would probably not twist the changes together.

@ManickaP ManickaP Jun 7, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For analyzers we have this one:

[SupportedOSPlatformGuard("linux")]
[SupportedOSPlatformGuard("macOS")]
[SupportedOSPlatformGuard("Windows")]
internal static bool IsHttp3Supported() => (OperatingSystem.IsLinux() && !OperatingSystem.IsAndroid()) || OperatingSystem.IsWindows() || OperatingSystem.IsMacOS();

BTW, it's also used for linker (it has a static value thus linker can trim the guarded code out). So that's why I preferred to keep this separate from _http3Enabled.

HttpClientHandler handler = CreateHttpClientHandler(HttpVersion.Version30);

return CreateHttpClient(handler);
var client = base.CreateHttpClient();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok that version used in base.CreateHttpClientHandler() inside base.CreateHttpClient() will not be the same that is later set here to client.DefaultRequestVersion? Maybe it will be better to follow previous pattern to create handler and supply it to new client?

@ManickaP ManickaP Jun 7, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I not 100% sure I understand what you mean. Could you share a snippet? BTW, I'm getting rid of the base., it's not needed since it's not virtual anymore.

@CarnaViire CarnaViire Jun 7, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you call CreateHttpClient() it will call CreateHttpClientHandler() without parameters

protected virtual HttpClient CreateHttpClient() => CreateHttpClient(CreateHttpClientHandler());

Which in its turn will pass UseVersion (which will be 1.1 by default if I understand it correctly)
protected HttpClientHandler CreateHttpClientHandler() => CreateHttpClientHandler(UseVersion, UseQuicImplementationProvider);

So the version set to HttpClient and the version used for handler creating will be different.
What happens with UseVersion in CreateHttpClientHandler might not be that important at the moment, but I have a feeling it might lead to bugs in the future in case CreateHttpClientHandler would be rewritten some day.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UseVersion is overidden to H/2 and H/3 in the concrete class, e.g.:
https://github.com/ManickaP/runtime/blob/a07bc51c03add6e56bb5e36610f776584f52f8e6/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs#L3161-L3161

So the version set to HttpClient and the version used for handler creating will be different.

That's what I'm aiming for here though 😄 I need the client handler to be created with appropriate QuicImplementationProvider but also to have the request with different version than what the handler was created so that VersionHttpClientHandler does not overrides the VersionPolicy to exact and we can actually test the AltSvc.

It doesn't matter here if I use CreateHttpClient or CreateHttpClientHandler, I'd still need to set up DefaultVersionPolicy and DefaultRequestVersion on the client.

@wfurt wfurt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CarnaViire CarnaViire left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ManickaP
ManickaP merged commit a82c357 into dotnet:main Jun 7, 2021
@ManickaP
ManickaP deleted the mapichov/h3_altsvc_tests branch June 7, 2021 16:40
@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2021
@karelz karelz added this to the 6.0.0 milestone Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants