Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(body): update Body trait to use Frames #3020

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Conversation

seanmonstar
Copy link
Member

The Body trait was adjusted to be forwards compatible with adding new frame types. That resulted in changing from poll_data and poll_trailers to a single poll_frame function. More can be learned from the proposal in #2840.

Closes #3010

BREAKING CHANGE: The polling functions of the Body trait have been
redesigned.

The free functions hyper::body::to_bytes and aggregate have been
removed. Similar functionality is on
http_body_util::BodyExt::collect.

@seanmonstar seanmonstar force-pushed the http-body-up branch 2 times, most recently from 41c67c9 to 2c98a58 Compare October 24, 2022 18:17
Comment on lines +65 to +66
while let Some(next) = res.frame().await {
let frame = next?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while let Some(next) = res.frame().await {
let frame = next?;
while let Some(frame) = res.frame().await.transpose()? {

I think we can write it like this?

src/lib.rs Outdated Show resolved Hide resolved
@seanmonstar seanmonstar force-pushed the http-body-up branch 7 times, most recently from 8c09ade to e49e26d Compare October 24, 2022 19:40
The `Body` trait was adjusted to be forwards compatible with adding new
frame types. That resulted in changing from `poll_data` and `poll_trailers`
to a single `poll_frame` function. More can be learned from the proposal
in #2840.

BREAKING CHANGE: The polling functions of the `Body` trait have been
  redesigned.

  The free functions `hyper::body::to_bytes` and `aggregate` have been
  removed. Similar functionality is on
  `http_body_util::BodyExt::collect`.
@seanmonstar seanmonstar merged commit 0888623 into master Oct 24, 2022
@seanmonstar seanmonstar deleted the http-body-up branch October 24, 2022 22:07
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this pull request Dec 4, 2024
hyper 0.14.x provided a collection of interfaces related to collecting
and aggregating request and response bodies, which were deprecated and
removed in the 1.x major release.

this commit updates calls to `hyper::body::to_bytes(..)` and
`hyper::body::aggregate(..)`. for now, `http_body::Body` is used, but we
can use `http_body_util::BodyExt` once we've bumped our hyper dependency
to the 1.x major release.

for more information, see:

* linkerd/linkerd2#8733
* hyperium/hyper#2840
* hyperium/hyper#3020

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this pull request Dec 4, 2024
* chore(app/admin): add `http-body` dependency

before we address deprecated hyper interfaces related to `http_bodies`,
we'll want to add this dependency so that we can call `Body::collect()`.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(app): update deprecated hyper body calls

hyper 0.14.x provided a collection of interfaces related to collecting
and aggregating request and response bodies, which were deprecated and
removed in the 1.x major release.

this commit updates calls to `hyper::body::to_bytes(..)` and
`hyper::body::aggregate(..)`. for now, `http_body::Body` is used, but we
can use `http_body_util::BodyExt` once we've bumped our hyper dependency
to the 1.x major release.

for more information, see:

* linkerd/linkerd2#8733
* hyperium/hyper#2840
* hyperium/hyper#3020

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to use new http-body trait
2 participants