Skip to content

feat: add http-backend feature for slimmer http builds - #1078

Open
seuros wants to merge 3 commits into
plabayo:mainfrom
seuros:feat/http-client-feature
Open

feat: add http-backend feature for slimmer http builds#1078
seuros wants to merge 3 commits into
plabayo:mainfrom
seuros:feat/http-client-feature

Conversation

@seuros

@seuros seuros commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The EasyHttpWebClient stack was only reachable via http-full, which drags in ws, idna (icu), compression, embedded ua profiles, multipart, html and rss — none of which are required by the http backend itself.

The new http-backend feature enables just dep:rama-http-backend, dep:rama-http-core and dep:tokio on top of http. http::client is gated on http-backend + dns + tcp, and http::tls (CertIssuerHttpClient) now shares those gates, fixing a pre-existing http,tls build break. http-full stays a strict superset (its redundant dep:ahash, already enabled via std, is dropped), so existing users are unaffected.

A client-only build (http-backend,dns,tcp) drops ~50 crates from the dependency tree (229 → 176 without default features). Optional features such as compression, rustls, ring, socks5, opentelemetry and unix compose with it as before.

@seuros
seuros requested a review from GlenDC as a code owner July 24, 2026 09:14

@GlenDC GlenDC left a comment

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.

You are correct and you are going in the right direction. However I would not focus so much on client here. Your problem can be made more generic.

What about if we introduce a feature named http-backend which enables dep:rama-http-core and dep:rama-http-backend. And drop the http-client feature introduced by you. http-backend would also enable http and http-full would enable http-backend. http-backend would also enable dep:tokio.

For the EasyHttpClient I would feature-gate than on http-backend, dns and tcp.

I think that makes more sense than specifically focussing on client. As in general I want to keep the amount of features as little as possible. And by doing it like I propose we can also use the same gating for proxy and server stuff without having to also add features for those. Should we have the need for it in future.

@seuros
seuros marked this pull request as draft July 24, 2026 21:22
@seuros

seuros commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

What i did here is introduce http-client which is a minimal version of http-full .

This was a quick hack and i was not sure if that align with your vision of the project.

Your solution is better, and i will think more tomorrow about the edge cases before updating this PR.

seuros added 2 commits July 30, 2026 11:22
The EasyHttpWebClient and its connector builder were only reachable
via http-full, which drags in ws, idna (icu), compression, embedded
ua profiles, multipart, html and rss. None of those are required by
the client stack itself.

Introduce http-client with the minimal closure the client needs:
http, tcp, dns, rama-http-backend, rama-http-core and tokio. Gate
the http::client module and the rama_http_core re-export on it.
http-full is now a strict superset (http-client plus the extras),
so existing users are unaffected.

A client-only build drops 47 crates from the dependency tree
(254 to 207). Optional features such as compression, rustls, ring,
socks5, opentelemetry and unix compose with http-client as before.
Per review: rather than a client-specific feature, introduce the
generic http-backend closure (dep:rama-http-backend, dep:rama-http-core,
dep:tokio) so proxy/server code can reuse the same gating later without
adding more features for those.

EasyHttpWebClient (http::client) still additionally needs dns + tcp,
so it is gated on http-backend + dns + tcp. http-full now enables
http-backend directly and re-adds tcp + dns itself, keeping it a
strict superset so existing http-full consumers of EasyHttpWebClient
are unaffected.
@seuros
seuros force-pushed the feat/http-client-feature branch from 3d2429f to ad4b64d Compare July 30, 2026 11:07
@seuros
seuros marked this pull request as ready for review July 30, 2026 11:08
@seuros
seuros requested a review from GlenDC July 30, 2026 11:09
@GlenDC GlenDC changed the title feat: add slim http-client feature for client-only usage feat: add http-backend feature for slimmer http builds Jul 30, 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

Development

Successfully merging this pull request may close these issues.

2 participants