No_std Support for HTTP


#1

I need an HTTP client (not a server, just the client) in a no_std crate I’m writing. Are there any good options available?

Are there any plans to provide no_std support in Hyper? The Connector trait does seem like an extension point which would allow one to swap in a custom network stack like that of a no_std environment. Is there anything else Hyper needs std for (such as allocations)?


#2

httparse, the parser underneath hyper is compatible with no_std. Going further than that doesn’t really make sense as you’re missing the Read and Write traits.


#3

Thanks @jethrogb. I was indeed considering httparse, but wondered if I could get even more from some pre-existing libs.

Going further than that doesn’t really make sense as you’re missing the Read and Write traits.

What do you mean? Does hyper have hard dependency on std::io::Read/Write?


#4

Yes, I imagine any networking code will? How are you going to do I/O without something like those traits?

Edit: actually, hyper 0.11 depends on AsyncRead/AsyncWrite, but that’s basically the same issue.


#5

You don’t need strictly those traits in my opinion. hyper could’ve just as easily taken dependency on some traits of its own. These traits would’ve allowed the possibility of being implemented in no_std scenarios as well. Additionally there could’ve been blanket impls for these traits for anything that implements std::io::Read/Write. This way you’d have gotten both the possibility of no_std support as well as easy interoperabiility with std::io::Read/Write

Edit: Same thing could be said for std::io::Async* traits.