Skip to content

Conversation

@spouliot
Copy link
Contributor

@spouliot spouliot commented May 22, 2019

Basic application (size) for doing an HttpClient.GetAsync, release/llvm, 64bits only

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 #5733
Fix #4170

…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
Copy link
Contributor

@mandel-macaque mandel-macaque left a 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! 👍

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

4 tests failed, 0 tests' device not found, 95 tests passed.

Failed tests

  • introspection/iOS Unified 32-bits - simulator/Debug: Failed
  • introspection/iOS Unified 64-bits - simulator/Debug: Failed
  • introspection/tvOS - simulator/Debug: Failed
  • introspection/watchOS 32-bits - simulator/Debug: Failed

@monojenkins
Copy link
Collaborator

Build failure
Build failed or was aborted

Build timed out

@spouliot
Copy link
Contributor Author

build

@monojenkins
Copy link
Collaborator

Build success
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
Test run succeeded

@spouliot
Copy link
Contributor Author

@monojenkins backport to d16-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Certificate pinning using NSUrlSessionHandler

6 participants