Skip to content

Remove tokio/net feature from client feature#268

Open
erickt wants to merge 1 commit intohyperium:masterfrom
erickt:tokio
Open

Remove tokio/net feature from client feature#268
erickt wants to merge 1 commit intohyperium:masterfrom
erickt:tokio

Conversation

@erickt
Copy link
Contributor

@erickt erickt commented Feb 15, 2026

Before this patch, hyper-util's feature client depended on tokio's feature net, which in turn depends on mio. That causes hyper-util to fail to compile on platforms like Fuchsia, which don't support mio. So this patch instead moves the tokio/net dependency into the tokio feature to avoid this issue.

Unfortunately though I think this is a breaking change, since now users might need to add the tokio feature. So either we could:

  1. Bump the major version.
  2. We could add some new features that we could use that parallel client and client-legacy. For example, client-without-tokio and client-legacy-without-tokio, and replace all the instances of feature = "clienty" feature checks with any(feature = "client", feature = "client-legacy-without-tokio").

What would you like us to do?

Before this patch, `hyper-util`'s feature `client` depended on tokio's
feature `net`, which in turn depends on `mio`. That causes `hyper-util`
to fail to compile on platforms like Fuchsia, which don't support `mio`.
So this patch instead moves the `tokio/net` dependency into the `tokio`
feature to avoid this issue.

Unfortunately though I think this is a breaking change, since now users
might need to add the `tokio` feature. So either we could:

1. Bump the major version.
2. We could add some new features that we could use that parallel
   `client` and `client-legacy`. For example, `client-without-tokio` and
   `client-legacy-without-tokio`, and replace all the instances of
   `feature = "clienty"` feature checks with `any(feature = "client",
   feature = "client-legacy-without-tokio")`.
@seanmonstar
Copy link
Member

Hm, I think tokio/net was required for the legacy client, specifically the HttpConnector. Everything else probably didn't quite need it, right? Or are you hoping to enable the whole legacy client without mio?

@erickt
Copy link
Contributor Author

erickt commented Feb 17, 2026

Yeah, I'm trying to get us back to the point where we can use hyper-rustls on Fuchsia, and it's taking a bit to untangle our dependencies. The crux of our problem is we don't support mio on Fuchsia, and instead use our own Fuchsia-specific executor. We're currently stuck on hyper 0.14.x, and rustls-hyper 0.24.x, since those versions allow us to disable the tokio runtime, which depends on mio.

As far as I can tell, hyper-rustls doesn't really need to be aware of the tokio runtime, but happens to depend on it because of hyper-util's HttpConnector isn't generic enough. Maybe we could restructure that library to allow the dns resolver and socket creator to be generic, and have a wrapper that passes in the tokio specific items?

@seanmonstar
Copy link
Member

Hm, the HttpConnector uses tokio::net::TcpStream to create connections, so it needs tokio/net. It hasn't been able to work without it, even in 0.14.x.

@erickt
Copy link
Contributor Author

erickt commented Feb 19, 2026

It looks like hyper-rustls 0.24 only required hyper 0.14's client feature, and had an optional tokio-runtime feature that depended on hyper-runtime, which depended on tokio/net. That changed when they updated to hyper 1.x in rustls/hyper-rustls#232.

Looking at hyper-rustls use of hyper-util, it looks like they really are only using:

  1. hyper_util::rt::TokioIo - They use this trait to adapt the network traffic to tokio-rustls. As far as I can tell, tokio-rustls is only using tokio's IO traits so it wouldn't be an issue for Fuchsia.
  2. hyper_util::client::legacy::Connection - by itself this trait is pretty trivial, but it needs the legacy-client feature, which needs client feature, which depends on tokio/net.
  3. hyper_util::client::legacy::HttpConnectorBuilder - this uses HttpConnector, which ends up pulling in the tokio network types, and thus mio.

So this patch was an attempt to fix (2). For (3), maybe we could put all HttpConnectorBuilder functionality behind a feature flag in hyper-rustls?

This all is a bit ugly though. Do you have any suggestions on what might work better?

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

Comments