Conversation
Introduce the etch_tls crate providing a unified TLS configuration API with pluggable backends for rustls and native-tls. Includes client identity handling, connection options, and test utilities. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (99.9%) is below the target coverage (100.0%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #450 +/- ##
========================================
- Coverage 100.0% 99.9% -0.1%
========================================
Files 305 309 +4
Lines 23707 23965 +258
========================================
+ Hits 23707 23947 +240
- Misses 0 18 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extracts the TLS backend abstraction from fetch_hyper into a new workspace crate, fetch_tls, that provides a backend-agnostic TlsOptions/TlsOptionsBuilder API plus a fully-materialized TlsBackend enum (rustls or native-tls). fetch_hyper now depends on fetch_tls and forwards its TLS features, while internally adapting to the new Arc<rustls::ClientConfig>-based TlsBackend. The new crate adds support for backend-agnostic mTLS via ClientIdentity, a rustls ResolvesClientCert integration, a ServerCertVerifierFactory, and per-backend ALPN derivation from supported HTTP versions.
Changes:
- New
fetch_tlscrate withTlsOptions/TlsOptionsBuilder, rustls/native-tls option builders,TlsBackend,TlsBackendDefaults, andClientIdentity(PEM/DER, mTLS). fetch_hypermigrated to consumefetch_tls::TlsBackend; rustls variant now storesArc<ClientConfig>, and the TLS feature flags forward tofetch_tls.- Workspace updates: new
fetch_tlsworkspace entry, newbase64/rustls-pki-types/rustls-symcryptworkspace deps,hyper/hyper-utilminor version bumps, spelling list and root CHANGELOG additions.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/fetch_tls/Cargo.toml | New crate manifest with feature-gated rustls/native-tls deps and allowed external types. |
| crates/fetch_tls/src/lib.rs | Crate root docs and module/export wiring with feature/test gates. |
| crates/fetch_tls/src/backend.rs | Defines TlsBackend, TlsBackendDefaults, RustlsDefaults, and backend selection enum. |
| crates/fetch_tls/src/options.rs | TlsOptions/TlsOptionsBuilder and build_backend dispatch including auto-selection logic. |
| crates/fetch_tls/src/rustls.rs | Rustls backend builder, verifier factory, client identity resolver path. |
| crates/fetch_tls/src/native_tls.rs | Native TLS backend builder and ALPN mapping from HTTP versions. |
| crates/fetch_tls/src/client_identity.rs | Backend-agnostic mTLS identity (PEM/DER) plus native-tls PEM re-encoding. |
| crates/fetch_tls/src/testing.rs | Test-only AcceptAllServerCertVerifier and NoClientCertResolver. |
| crates/fetch_tls/src/snapshots/*.snap | Insta snapshot for verifier factory debug output. |
| crates/fetch_tls/README.md / CHANGELOG.md / logo.png / favicon.ico | Generated README, empty changelog, and LFS-tracked assets. |
| crates/fetch_hyper/Cargo.toml | Adds fetch_tls dependency and forwards rustls/native-tls features. |
| crates/fetch_hyper/src/lib.rs | Drops TlsBackend re-export now that the type lives in fetch_tls. |
| crates/fetch_hyper/src/tls/mod.rs | Removes the old TlsBackend enum, conversions, and tests. |
| crates/fetch_hyper/src/tls/connector.rs | Switches to fetch_tls::TlsBackend and adapts Arc<ClientConfig> via as_ref().clone(). |
| crates/fetch_hyper/src/builder.rs | Uses fetch_tls::TlsBackend; updates doctest import. |
| crates/fetch_hyper/src/connection/hyper_handler.rs | Test imports updated to fetch_tls::TlsBackend. |
| crates/fetch_hyper/src/testing.rs | Test imports updated to fetch_tls::TlsBackend. |
| crates/fetch_hyper/tests/smoke.rs | Smoke test imports updated. |
| Cargo.toml | Adds fetch_tls, base64, rustls-pki-types, rustls-symcrypt workspace deps; bumps hyper/hyper-util. |
| Cargo.lock | Lockfile updates for new crate and hyper bump. |
| CHANGELOG.md | Adds fetch_tls to crate list. |
| .spelling | Allows crypto, rustls, TLS, verifier, Verifier. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| mod connector; | ||
| pub(crate) use connector::TlsConnector; |
No description provided.