Skip to content

Replace OpenSSL with rustls #1928

Merged
thomas-zahner merged 9 commits intolycheeverse:masterfrom
thomas-zahner:rustls
Feb 5, 2026
Merged

Replace OpenSSL with rustls #1928
thomas-zahner merged 9 commits intolycheeverse:masterfrom
thomas-zahner:rustls

Conversation

@thomas-zahner
Copy link
Member

@thomas-zahner thomas-zahner commented Nov 19, 2025

Closes #1721

Closes #1970

Closes #1920

Hopefully closes #2024

Background

Using Rustls instead of openSSL should simplify many things. Depending on platform specific external openSSL libraries seems to be more brittle than using Rustls for all targets. Very recently I've updated lychee to use reqwest 0.13.1 which coincidentally also uses Rustls by default now. This shows how Rustls should now be fully production ready and well tested. So now seems like a good moment to make the full switch.

As it is a breaking change anyhow I'd like to seize the opportunity to fully remove openSSL. If it works out well it should make maintenance easier. If it turns out that some people really need openSSL (which I think is unlikely) or run into issues we could still add a new feature flag before the next release.

@thomas-zahner
Copy link
Member Author

@mre If we see that this PR works in CI and on different machines for users, do you agree that it makes sense to fully get rid of the OpenSSL approach? Or do you think we should keep it and only change the default?

@mre
Copy link
Member

mre commented Nov 24, 2025

TBH, for now I would keep it and change the default. At least for one version. Then we can tell people to switch back to OpenSSL if there are any problems. We could mention that in the release-notes. On the other side, I'm flexible here. That's just what I would do, but we can also go all-in on rustls. 😆 Worst case, we release a patch version with the OpenSSL option available again. So whatever you believe is the best tradeoff between simplicity and user experience.

@thomas-zahner
Copy link
Member Author

This unfortunately is blocked by reacherhq/check-if-email-exists#1625. The problem is that the latest version of check-if-email-exists on crates.io uses openSSL without an option to use ruslts.

@kemingy
Copy link
Contributor

kemingy commented Nov 27, 2025

I just found that the check-if-email-exists is dual licensed under AGPL-3 or Reacher Commercial license.

But it's enabled by default for lychee CLI:

default = ["native-tls", "email-check"]

As far as I know, it's not compatible with the Apache2 + MIT license.

Maybe we need to open another issue to discuss this. What do you think? @mre

@thomas-zahner
Copy link
Member Author

@kemingy Thanks for pointing it out. This is known since 2022 see #594. Unfortunately, we never really prioritised the issue. But you are right that this is quite problematic and now as it even blocks the transition to rustls I will try to resolve it as soon as possible.

@thomas-zahner thomas-zahner force-pushed the rustls branch 2 times, most recently from 06ac330 to 4455678 Compare February 4, 2026 10:29
@thomas-zahner thomas-zahner marked this pull request as ready for review February 4, 2026 10:29
Copy link
Member

@katrinafyi katrinafyi left a comment

Choose a reason for hiding this comment

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

makes sense and diff looks reasonable. would it be worthwhile to mention somewhere, maybe near the readme feature flags, that we use rustls and to report any issues or shortcomings?

also, idk much about TLS, but does this make it harder to use system-installed root certificates? this could affect people using lychee for intranet websites. but maybe the current vendored-openssl already makes that difficult - I'm not sure.

@thomas-zahner
Copy link
Member Author

would it be worthwhile to mention somewhere, maybe near the readme feature flags, that we use rustls and to report any issues or shortcomings?

Sure, that makes sense.

also, idk much about TLS, but does this make it harder to use system-installed root certificates?

I'm also no expert on that. But it seems like self-signed certificates are currently broken, so this PR shouldn't worsen the situation. I've asked on the issue if this branch resolves the problems, which is not entirely unlikely.

.client()?;

let response = client.check("https://example.com").await?;
let response = client.check("https://rust-lang.org").await?;
Copy link
Member

Choose a reason for hiding this comment

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

Was this change intentional? It seems to be unrelated to rustls and as far as I remember, the goal was to show how includes overrides excludes. By changing the URL this is no longer clear.

Copy link
Member Author

@thomas-zahner thomas-zahner Feb 5, 2026

Choose a reason for hiding this comment

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

Oh thanks for pointing out. Yes it was intentional but I forgot to update the includes and excludes. Fixed now.
I've replaced example.com with rust-lang.org because it might be confusing to people. (at least it confused me) Running cargo run --example builder makes the example panic. The URL is still excluded because we explicitly exclude example.com from checking.

We need to include the feature flag to make the example not panic: cargo run --example builder -F check_example_domains. With f4d1a38 the example will now pass independently of the provided feature flags.

Copy link
Member

@mre mre left a comment

Choose a reason for hiding this comment

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

Feels good. 😃

thomas-zahner and others added 2 commits February 5, 2026 10:35
Co-authored-by: katrinafyi <39479354+katrinafyi@users.noreply.github.com>
@thomas-zahner
Copy link
Member Author

Feels good. 😃

Thanks, I agree :)
Less dependencies, shorter workflow files, and most probably less runtime issues and more coherent behaviour across different machines.

would it be worthwhile to mention somewhere, maybe near the readme feature flags, that we use rustls and to report any issues or shortcomings?

Done in e9d1e97

@thomas-zahner thomas-zahner merged commit 2d717a1 into lycheeverse:master Feb 5, 2026
7 checks passed
@mre mre mentioned this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants