Looking for a sans-io HTTP client and server implementation

Hi there!

I am looking for an implementation of HTTP that doesn't open any socket under the hood. I want to be the one opening sockets and writing/reading data, while the library only does the requests and responses parsing and serialization.

Searching crates.io and GitHub I couldn't really find anything like that in the ecosystem, despite the superiority of this approach and the fact that higher-level libraries could be implemented on top of such a crate. However, crates.io is literally swimming in HTTP-related crates, and it's possible that I've simply missed it.

Would someone be aware of the existence of such a crate?

Thank you in advance

AFAICT, the http crate does what you want:

It’s intended that this crate is the “standard library” for HTTP clients and servers without dictating any particular implementation.

Thanks for the answer but that's not what I'm looking for. It doesn't seem to provide a way to parse or serialize, or to parse in a steaming way, doesn't handle HTTP2, etc.

hyper doesn't open any socket under the hood. Instead, it requires you to pass generic AsyncRead+AsyncWrite type to be used for the underlying connection.

1 Like

Unfortunately these traits are imported from tokio.
The reason why I'm looking for a sans-io crate is to make it work in a no_std environment. tokio doesn't compile in a no_std environment (and hyper neither).

If you need no_std support, HTTP/1.x parsing can be done with httparse, also from the hyperium project. Taken from this answer:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.