-
Notifications
You must be signed in to change notification settings - Fork 554
[foundation] Add custom trust/certificate validation to NSUrlSessionHandler. Fix #4170 #6103
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
[foundation] Add custom trust/certificate validation to NSUrlSessionHandler. Fix #4170 #6103
Conversation
…andler. Fix dotnet#4170 Basic application (size) for doing an `HttpClient.GetAsync`, release/llvm, 64bits only - NSUrlSessionHandler (master): 6.4 MB - NSUrlSessionHandler (PR#5936): 7.7 MB - NSUrlSessionHandler (this PR): 6.4 MB The size increase occurs because of the reference to .net `X509*` types. This brings a lot of additional code, including managed cryptographic code, inside the application - even when the feature is **not** used. The solution is to expose an API that only use native (OS) types, which are mostly already part of the application. This has a very low impact on existing applications. It's still possible to hook back to .NET validation if needed (it should not in most cases) but, in this case, the extra price will only be _paid_ if used (and can be lower if the code is needed by something else from the application). In comparison using other `HttpClient` handler produce app sizes of - HttpClientHandler (managed): 10.4 MB - CFNetworkHandler: 6.8 MB Based on/supersede dotnet#5733 Fix dotnet#4170
mandel-macaque
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! We might want to show people how to go from the SecTrust to the .Net ones if needed in the docs! 👍
|
Build failure Test results4 tests failed, 0 tests' device not found, 95 tests passed.Failed tests
|
|
Build failure |
|
build |
|
Build success |
|
@monojenkins backport to d16-2 |
Basic application (size) for doing an
HttpClient.GetAsync, release/llvm, 64bits onlyThe size increase occurs because of the reference to .net
X509*types.This brings a lot of additional code, including managed cryptographic
code, inside the application - even when the feature is not used.
The solution is to expose an API that only use native (OS) types, which
are mostly already part of the application. This has a very low impact
on existing applications.
It's still possible to hook back to .NET validation if needed (it should
not in most cases) but, in this case, the extra price will only be
paid if used (and can be lower if the code is needed by something else
from the application).
In comparison using other
HttpClienthandler produce app sizes ofBased on/supersede #5733
Fix #4170