Skip to content

Downgrade to HTTP/1.1 on older Windows versions #22859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 17, 2020
Merged

Conversation

JunTaoLuo
Copy link
Contributor

Addresses #16811

@ghost ghost added the area-servers label Jun 12, 2020
@JunTaoLuo
Copy link
Contributor Author

@Tratcher I'm guessing the only testing we are going to need to do here is test it out on a Windows 8 machine?

Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

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

For testing, there's automated tests for Win7, you should be able to mimic those for Win8.

@JunTaoLuo
Copy link
Contributor Author

We don't run any tests on Windows 7/Windows 8 anywhere in our CI, public or private. @HaoK I remember we removed all the different OSes from our Helix runs, is there a plan to ever bring those back?

@HaoK
Copy link
Member

HaoK commented Jun 12, 2020

You should still these on the helix-matrix runs that run in master: https://dev.azure.com/dnceng/public/_build?definitionId=837

You can also turn them on in your PR if you want if you flip /p:IsHelixDaily=true on in the ci.yaml temporarily

https://github.com/dotnet/aspnetcore/blob/master/.azure/pipelines/helix-matrix.yml#L34

@JunTaoLuo
Copy link
Contributor Author

Ah that's the missing piece, I couldn't find where the win7/win81 queues were being run so I thought we weren't running them at all. As long as we're running them somewhere I'll add tests.

@JunTaoLuo
Copy link
Contributor Author

Hard to track down test status but according to https://helix.dot.net/api/2019-06-17/jobs/4e6d3e82-7d9a-4b49-928c-edea02bacab0/workitems/InMemory.FunctionalTests--net5.0/console the tests are passing. I'm going to also use this PR to fix/skip a bunch of tests on Windows 7/8

@JunTaoLuo JunTaoLuo force-pushed the johluo/http2-downgrade branch 2 times, most recently from 687d225 to c637623 Compare June 13, 2020 18:37
@JunTaoLuo JunTaoLuo marked this pull request as ready for review June 13, 2020 18:37
@JunTaoLuo
Copy link
Contributor Author

JunTaoLuo commented Jun 13, 2020

Given the tests were verified in https://dev.azure.com/dnceng/public/_build/results?buildId=686284&view=results with remaining test failures on helix caused by unrelated issues: #22917. I'm marking this PR as ready.

@JunTaoLuo JunTaoLuo requested a review from Tratcher June 15, 2020 17:52
// This configuration will always fail per-request, preemptively fail it here. See HttpConnection.SelectProtocol().
if (options.HttpProtocols == HttpProtocols.Http2)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
throw new NotSupportedException(CoreStrings.HTTP2NoTlsOsx);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Environment.OSVersion.Version < new Version(6, 2))
Copy link
Member

Choose a reason for hiding this comment

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

Is there any risk that someone got ALPN working on Windows 8 somehow and this change breaks them despite the AppContext switch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This probably warrants a breaking changes announcement.

Copy link
Member

Choose a reason for hiding this comment

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

This definitely warrants a breaking change announcement.

If someone does have ALPN working on Windows 8, changing < new Version(6, 2) to < new Version(6, 3) would completely break them and not even the AppContext switch would work around the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ALPN support was added in Windows 8.1 so I don't think that was ever a scenario that worked. I made the change since I noticed that Windows 8.1 which was where ALPN support was first added is version 6.3 instead of 6.2. Unless there was an actual reason for allowing Http2 on Windows 8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ping @Tratcher

Copy link
Member

Choose a reason for hiding this comment

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

No reason to allow it on Win8 without ALPN, it's the same as Win7.

@@ -605,6 +602,12 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l
<data name="HttpsConnectionEstablished" xml:space="preserve">
<value>Connection "{connectionId}" established using the following protocol: {protocol}</value>
</data>
<data name="HTTP2DefaultCiphersInsufficient" xml:space="preserve">
<value>HTTP/2 over TLS is not supported on Windows versions older than Windows 10 and Windows Server 2016 due to incompatible ciphers or missing ALPN support. Falling back to HTTP/1.1 instead.</value>
Copy link
Member

@halter73 halter73 Jun 16, 2020

Choose a reason for hiding this comment

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

Should we mention how to change the enabled ciphers and re-enable HTTP/2 on older Windows versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the best we can do is get a aka.ms link to something like https://docs.microsoft.com/en-us/windows/win32/secauthn/tls-cipher-suites-in-windows-8-1, would that be sufficient?

Copy link
Member

Choose a reason for hiding this comment

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

A breaking change announcement should be sufficient. We can follow up with anyone that's actually trying to make it work.

@@ -605,6 +602,12 @@ For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?l
<data name="HttpsConnectionEstablished" xml:space="preserve">
<value>Connection "{connectionId}" established using the following protocol: {protocol}</value>
</data>
<data name="HTTP2DefaultCiphersInsufficient" xml:space="preserve">
<value>HTTP/2 over TLS is not supported on Windows versions older than Windows 10 and Windows Server 2016 due to incompatible ciphers or missing ALPN support. Falling back to HTTP/1.1 instead.</value>
Copy link
Member

Choose a reason for hiding this comment

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

A breaking change announcement should be sufficient. We can follow up with anyone that's actually trying to make it work.

// This configuration will always fail per-request, preemptively fail it here. See HttpConnection.SelectProtocol().
if (options.HttpProtocols == HttpProtocols.Http2)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
throw new NotSupportedException(CoreStrings.HTTP2NoTlsOsx);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Environment.OSVersion.Version < new Version(6, 2))
Copy link
Member

Choose a reason for hiding this comment

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

No reason to allow it on Win8 without ALPN, it's the same as Win7.

John Luo added 2 commits June 16, 2020 15:56
This applies to any versions strictly older than Windows 10 or Windows Server 2016
@JunTaoLuo JunTaoLuo force-pushed the johluo/http2-downgrade branch from 2385f27 to 6f56163 Compare June 16, 2020 22:58
@JunTaoLuo JunTaoLuo merged commit 45e6571 into master Jun 17, 2020
@JunTaoLuo JunTaoLuo deleted the johluo/http2-downgrade branch June 17, 2020 23:50
@ulrichb
Copy link

ulrichb commented Sep 26, 2020

Could you downport this to the 3.1 LTS?

@Tratcher
Copy link
Member

@ulrichb the workaround is to disable HTTP/2. Issues with a simple workaround don't usually qualify for downports.
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#listenoptionsprotocols

@Tratcher Tratcher added this to the 5.0.0-preview7 milestone Sep 26, 2020
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants