Skip to content

fix: select ring crypto provider explicitly for server TLS - #242

Merged
FalkWoldmann merged 1 commit into
httpmock:masterfrom
danieleades:fix/server-tls-crypto-provider
Aug 7, 2026
Merged

FalkWoldmann merged 1 commit into
httpmock:masterfrom
danieleades:fix/server-tls-crypto-provider

Conversation

@danieleades

Copy link
Copy Markdown
Contributor

Problem

The nightly / master-push Feature Matrix (failing run) failed on the --no-default-features --features https and --features https,remote power-set cells with:

Could not automatically determine the process-level CryptoProvider from Rustls crate features.

serve_tls_connection builds its ServerConfig via ServerConfig::builder(), which uses rustls' get_default_or_install_from_crate_features(). That auto-detection panics unless exactly one of the ring / aws-lc-rs rustls features is enabled. In test builds, the reqwest dev-dependency enables rustls/aws-lc-rs while our https feature enables rustls/ring, so both providers are compiled in and auto-detection is ambiguous.

Fix

Build the ServerConfig with an explicit ring provider (builder_with_provider), so the server-side TLS path no longer depends on ambiguous crate-feature unification — mirroring how the client path in common/http.rs already installs ring explicitly.

Why the fast lane missed it

cargo test --all-features passes on the pre-fix code: when remote/remote-https is active, httpmock's own client installs the ring provider as the process-wide default early, so the server builder finds it and never hits the ambiguous path. The bug only surfaces when server TLS runs without a remote client path — i.e. the isolated https cells that only the deep matrix runs.

To close that gap pre-merge, this PR also adds an isolated https row to the fast CI lane's test matrix. It would have caught this specific regression on the dependency-bump PR rather than post-merge on master.

Verification

  • cargo test --no-default-features --features https — all example tests pass (were panicking before)
  • cargo test --no-default-features --features https,remote — pass
  • cargo test --all-features — pass (unchanged)

ServerConfig::builder() relies on rustls' crate-feature auto-detection to
pick a crypto provider, which panics when neither or both of the ring and
aws-lc-rs features are enabled. In test builds the reqwest dev-dependency
enables rustls' aws-lc-rs feature alongside our ring feature, so the
server-side TLS path (serve_tls_connection) panicked with 'Could not
automatically determine the process-level CryptoProvider'.

Build the ServerConfig with an explicit ring provider so it no longer
depends on ambiguous crate-feature unification or on a client code path
having installed a process-wide default first.

Also add an isolated 'https' feature row to the fast CI lane: --all-features
masks this failure because a remote client path installs the default
provider before the server builds its config, so only an isolated https
build reproduces it.
@danieleades

Copy link
Copy Markdown
Contributor Author

@FalkWoldmann this fixes the nightly CI failure.

Note this was a pre-existing failure (not related to my changes), so a good validation of the improved CI!

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@danieleades

Copy link
Copy Markdown
Contributor Author

@FalkWoldmann this one is fairly important- fixes the nightly CI job

@FalkWoldmann

Copy link
Copy Markdown
Member

Sorry for the late notice! Still ensure if we should commit to ring tbh. Most of the ecosystem moved to aws-lc and the build problems associated with have gotten presumably better. However, for httpmock the actual crypto impl shouldn't really matter. What do you think about this @danieleades?

@danieleades

Copy link
Copy Markdown
Contributor Author

Sorry for the late notice! Still ensure if we should commit to ring tbh. Most of the ecosystem moved to aws-lc and the build problems associated with have gotten presumably better. However, for httpmock the actual crypto impl shouldn't really matter. What do you think about this @danieleades?

honestly, this change is just about resolving an existing dependency resolution bug surfaced by the more detailed testing, rather than suggesting any changes to the libraries used

@FalkWoldmann

Copy link
Copy Markdown
Member

yeah, true since we already default to ring. So this is a different topic

@FalkWoldmann
FalkWoldmann merged commit b7d5d11 into httpmock:master Aug 7, 2026
10 checks passed
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.

2 participants