Skip to content

Design portable fetch transport API - #693

Draft
martin-kolinek wants to merge 5 commits into
mainfrom
u/makolnek/fetch-builder-redesign
Draft

Design portable fetch transport API#693
martin-kolinek wants to merge 5 commits into
mainfrom
u/makolnek/fetch-builder-redesign

Conversation

@martin-kolinek

@martin-kolinek martin-kolinek commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

🤖 Defines the proposed stable API boundary for fetch before implementation work begins.

Summary

  • designs one concrete, transport-erased HttpClientBuilder around portable library requirements
  • stabilizes only the portable requirement surface and a generic typed transport-config registry
  • defines fetch_hyper_common as a reusable TLS-neutral HTTP engine
  • composes Rustls and native TLS through dependency-isolated fetch_hyper_rustls and fetch_hyper_native_tls crates
  • keeps backend-typed verifier, signer, provider, and connector APIs with their composition crates
  • introduces dependency-light config companions only after a demonstrated library need
  • unifies mTLS selection through application-provisioned logical credential identifiers
  • models independent network destination, exact TLS server name, and HTTP authority
  • removes inherited socket and HTTP/2 tuning knobs from the library-facing surface
  • gives portable HTTP/1.1/2 constraints precedence over WinHTTP''s optional HTTP/3 preference
  • defines fallible request/response trailer semantics and fetch-owned response decompression
  • requires full-duplex HTTP/2 and includes a native WinHTTP proof for known and unknown-length uploads

Backend evidence

  • adds a WinHTTP HTTP/2 probe demonstrating independent DNS routing, SNI/certificate validation, and :authority
  • adds a calibrated delayed-ACK experiment showing tested WinHTTP HTTP/1.1 small writes behave like the TCP_NODELAY control
  • records where WinHTTP behavior is measured rather than covered by a documented compatibility guarantee

Tuning policy

  • Nagle is not configurable; socket-owning transports enable TCP_NODELAY
  • HTTP/2 receive-window sizing remains transport-owned
  • kernel send/receive buffers remain under OS autotuning
  • initial congestion behavior remains OS/network policy

Design a transport-erased HttpClientBuilder around portable library requirements, move backend mechanisms out of the public surface, and document named client credentials and TLS endpoint identity mapping.

Add executable WinHTTP probes for independent routing/TLS/authority control and Nagle behavior to ground the design in measured backend capabilities.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c1d47b6-8039-4748-972d-20b238499d82
Comment thread crates/fetch/docs/design/README.md Outdated
Comment thread crates/fetch/docs/design/README.md Outdated
Comment thread crates/fetch/docs/design/README.md Outdated
Comment thread crates/fetch/docs/design/README.md Outdated
Comment thread crates/fetch/docs/design/README.md
Comment thread crates/fetch/docs/design/capability-matrix.md Outdated
Comment thread crates/fetch/docs/design/capability-matrix.md Outdated
Comment thread crates/fetch/docs/design/capability-matrix.md Outdated
Comment thread crates/fetch/docs/design/capability-matrix.md Outdated
Comment thread crates/fetch/docs/design/README.md
Require every supported transport to implement the complete portable baseline, add typed pre-build extensions for deliberate backend coupling, and make unsupported certificate policies explicit portable non-goals.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c1d47b6-8039-4748-972d-20b238499d82
```rust,ignore
pub trait Transport: Send + Sync + 'static {
fn build(
self: Box<Self>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
self: Box<Self>,
&self,

why not like this? The transport should still stay boxeable

pub fn configure(builder: HttpClientBuilder) -> Result<HttpClient> {
builder
.connection_lifetime(LIFETIME)
.client_certificate(ClientCredentialId::new("service-client"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

imho, all tls specific configuration should have tls_ prefix to keep clean (reqwest did the same)

Define fetch_hyper as a reusable TLS-neutral HTTP engine and move rustls/native-tls connector construction into dependency-isolated composition crates. Limit fetch stabilization to portable requirements and the typed config registry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c1d47b6-8039-4748-972d-20b238499d82
Rename the proposed TLS-neutral engine to fetch_hyper_common and retain fetch_hyper only when referring to the current crate being split into common and TLS composition crates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c1d47b6-8039-4748-972d-20b238499d82
Give portable HTTP/1.1 and HTTP/2 requirements precedence over WinHTTP's HTTP/3 preference, place response decompression in fetch, and define fallible trailer semantics.

Add a direct WinHTTP probe demonstrating known- and unknown-length full-duplex HTTP/2 streaming and revise the implementation design around independent send and receive lanes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c1d47b6-8039-4748-972d-20b238499d82
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