fix(http2): fix internals of HTTP/2 CONNECT upgrades #3967
Merged
+382
−288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This refactors the way hyper handles HTTP/2 CONNECT / Extended CONNECT. Before, an uninhabited enum was used to try to prevent sending of the
Buftype once the STREAM had been upgraded. However, the way it was originally written was incorrect, and will eventually have compilation issues.The change here is to spawn an extra task and use a channel to bridge the IO operations of the
Upgradedobject to beCursorbuffers in the new task.ref: rust-lang/rust#147588
Closes #3966
BREAKING CHANGE: The HTTP/2 client connection no longer allows an executor that can not spawn itself.
This was an oversight originally. The client connection will now include spawning a future that keeps a copy of the executor to spawn other futures. Thus, if it is
!Send, it needs to spawn!Sendfutures. The likelihood of executors that match the previously allowed behavior should be very remote.There is also technically a semver break in here, which is that the
Http2ClientConnExectrait no longer dyn-compatible, because it now expects to beClone. This should not break usage of theconnbuilder, because it already separately hadE: Clonebounds. If someone were usingdyn Http2ClientConnExec, that will break. However, there is no purpose for doing so, and it is not usable otherwise, since the trait only exists to propagate bounds into hyper. Thus, the breakage should not affect anyone.