Closed JanBerktold closed 2 months ago
The changes you've suggest are breaking changes, and with v1.0 out, we won't do that for at least 3 years.
But!
I don't think you need this for what you want. The "upgrades" things you're looking at don't imply HTTP2-Upgrade
support. That doesn't actually exist in hyper. You either use "prior knowledge", ALPN, or the hyper-util auto connection which will try to detect the version based on the first few bytes received by the server.
The "upgrades" are more things like WebSockets. And even then, upgrades can be done manually using poll_without_shutdown
on the connection types. The "upgrades" extensions make things easier, but required picking either Send
or !Send
, since it needs to put the IO type in a boxed trait object. But it's not required.
Wow, I went down the wrong rabbit hole. Thank you for your thorough explanation!
I've added an example here if helpful for others: https://github.com/hyperium/hyper-util/pull/115
Is your feature request related to a problem? Please describe. I'm looking to utilize hyper with gloomio. It already works with either HTTP1 or HTTP2 but does not support upgrades between them.
I've hacked up a dirty example that works (but breaks Send executors) which can be fetched here: https://github.com/JanBerktold/hyper-util/commit/136a2fe10b2ca614c45db24679d6aba0b5b3bd54
It depends on changes in hyper & HTTP:
Extensions
struct requires Send on values (throughAnyMap
). It stores them as anAny
/AnyClone
internally and hence can't benefit from automatic Send marking.hyper
is straightforward & really just removing Send constraints: https://github.com/JanBerktold/hyper/commit/e2651503d09840495fb9d48113a8e0836924e898Now, the main problem AFAICT is that we have to decide for
AnyMap
to supportSend
or not with each choice breaking one type of executor. To work around this, I am considering suggesting to add a cargo feature forhttp
to conditionally add the Send constraints.I am opening this issue for discussion about this option and to brainstorm other potential ones as well as issues that I've missed.