Skip to content
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

Wikipedia requires TLS1.2; Fx4.5 does not use it by default #66

Closed
DavidWBrooks opened this issue Apr 29, 2020 · 4 comments
Closed

Wikipedia requires TLS1.2; Fx4.5 does not use it by default #66

DavidWBrooks opened this issue Apr 29, 2020 · 4 comments
Assignees
Milestone

Comments

@DavidWBrooks
Copy link

Since late January 2020, English Wikipedia/Wikisource (and probably everything else) required TLS 1.2 for connections. Framework 4.5 by default only goes up to 1.1. (Framework 4.8 uses the OS default, which is 1.2 on Windows 10). This makes the demo apps fail on startup.

If using 4.5, it's necessary to execute the following somewhere before the first HTTP transaction:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
(using System.Net)

Verified by adding the line to the console and WPF apps, but it should probably be in the API in a path that's always executed during initialization.

@CXuesong CXuesong self-assigned this Apr 30, 2020
@DavidWBrooks
Copy link
Author

Addendum: the problem with the 4.5 workaround is that it isn't future-proof (one day WP may require 1.3 for example). Fx 4.7 is slightly better; currently TLS1.2 is the Win10 default:
ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault;
Fx 4.8 lets you apply it per-client:
HttpClientHandler.SslProtocols = SslProtocols.None;
which again lets the OS decide. Or you can specify a collection of protocols, currently only up to TLS1.3.

@CXuesong
Copy link
Owner

CXuesong commented Apr 30, 2020

Thanks for your detailed report! I feel that choosing the correct TLS version is the responsibility of WCL users. After all, not all users are using this library against WP, and I don't think it a good idea to do global configuration change in our library "for sake of" consumer.

However, I think we may offer some clearer error message, providing a link to FAQ for this purpose...

@DavidWBrooks
Copy link
Author

OK, but at least let's add the fix to the demo apps (which would also be a good model). I can volunteer to do that; I need to learn how to handle pull requests anyway... You can provide the error message; it will require unpicking the big AggregateException, I think.

CXuesong added a commit that referenced this issue May 1, 2020
@CXuesong
Copy link
Owner

CXuesong commented May 1, 2020

OK, but at least let's add the fix to the demo apps (which would also be a good model).

Oops. Just forgot that 🌚

But if you see any further issue, don't hesitate to open a PR!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants