Open RyanAD opened 4 months ago
Yea good point. Before, we were able to work around this explicitly since both types were in the same library. Now that they are separate, it will be trickier to do so. 🤔
bikeshedding/stopgap: hyper_util::server::conn::auto::upgrade::downcast::<T>(upgraded)
(that's a horrible path but whatever).
Version hyper = 1.2.0 hyper-util = 0.1.3
Description
When using:
hyper_util::server::conn::auto::Builder::new(..).serve_connection_with_upgrades
the io stream is wrapped withRewind
which is private and therefore cannot be used to call Upgraded::downcast.To reproduce the issue I'v modified the upgrades example here: https://github.com/RyanAD/hyper-broken-upgrade
The shortened version is that handing a connection with:
Will fail, because the stream is actually wrapped in
Rewind
which is not visible externally and can't be used to call downcast.Without using
hyper_util::server::conn::auto::Builder::new
it works as expected. This also prevents downcasting Upgraded when using axum::serve, but that can be worked around by setting up the handling manually without usingauto::Builder