hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 269 forks source link

Consider moving hyper's h2 support types to h2 #656

Open cloneable opened 1 year ago

cloneable commented 1 year ago

My current project uses h2 directly without hyper negotiated by TLS with ALPN. To support an AsyncRead+AsyncWrite transport on top of an HTTP2 stream I had to write an adapter like hyper's H2Upgraded, which was non-trivial due to buffering and flow-control capacity management.

Now I wonder if you would consider moving the h2 support types from hyper to h2 and expose them, so users of h2 can build binary protocols on top of h2 and even can take advantage of BDP support. I don't believe this would bloat h2 with code unrelated to HTTP2 since it does support upgrading to stream-based protocols.

I know the chance of this is slim, but I had to ask. :)

vi commented 3 months ago

There is a similar wrapper at https://docs.rs/mtunnel/latest/mtunnel/struct.Stream.html.

For some strange reason, it issues end_of_stream=true on flush instead of on shutdown though.