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

Allow using Rustls instead of OpenSSL #46

Merged
merged 2 commits into from
Sep 22, 2024
Merged

Conversation

drakon64
Copy link
Contributor

@drakon64 drakon64 commented Sep 20, 2024

Allow using Rustls instead of OpenSSL. The default is to continue to use reqwest's default-tls feature so this should not affect existing consumers.

Rustls can be opted-into with the rustls-tls feature flag. Other reqwest Rustls options can be enabled with the same feature flags that reqwest accepts.

Fixes #45.

@FlixCoder
Copy link
Owner

FlixCoder commented Sep 20, 2024

The actual solution would be to:

  • disable default features on reqwest
  • add feature flags like "default-tls", "native-tls", "rustls", "rustls-native-roots", "http2", etc. and forward them to reqwest via native-tls = ["reqwest?/native-tls"].
  • add "default-tls" to the default features

As explanation/reasoning: cargo feature flags should be additive, i.e. enabling two features may not conflict.

@drakon64 drakon64 changed the title Replace OpenSSL dependency with Rustls Allow using Rustls instead of OpenSSL Sep 20, 2024
@drakon64
Copy link
Contributor Author

@FlixCoder Is e02ca52 what you were expecting? I left the other reqwest defaults in-place to avoid this being a breaking change.

@FlixCoder
Copy link
Owner

Yes, thanks.

I would personally add even more feature flags (for http2, charset, http3, compressions, various more tls/tokio settings, ...) and the default needs some macos feature flag apparently. or maybe default-tls becomes reqwest-default and enables reqwest default features to avoid future breaking changes.
Then everything is covered :D

But if you don't want to do that it is fine, I would merge it and adjust ir afterwards :)

Feel free to disable draft mode ^^

@drakon64
Copy link
Contributor Author

HTTP/3 support requires an additional compiler flag, so I'd rather leave that one out.

Cookies require an opt-in on the ClientBuilder so more work would be needed than just enabling the feature.

I've added all of the reqwest flags that seemed relevant.

@drakon64 drakon64 marked this pull request as ready for review September 20, 2024 20:28
@FlixCoder FlixCoder merged commit d7ed075 into FlixCoder:main Sep 22, 2024
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.

Allow building without OpenSSL
2 participants