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(ext): add ext::on_informational() callback extension #3818

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seanmonstar
Copy link
Member

@seanmonstar seanmonstar commented Dec 24, 2024

This new function allows attaching a callback to a request, such that when it is sent through a hyper client connection, and any 1xx informational responses are received, they are passed to the callback.

Closes #2565


This takes the unstable client informational feature (introduced in #2594, tracking issue in #2565), and promotes it to a stable API. The way it works is largely the same: a user can embed a callback in an extension in a request, and if present, it is called with each 1xx response parsed for that request.

As long as it was working in an unstable manor for curl, we didn't really discuss further if it is particularly rusty. I welcome feedback to that effect.

Alternatives

  • ResponseFuture::poll_informational() - I'll note that in the tracking issue, it was discussed that an alternative should be to add methods to ResponseFuture instead. Some of the downsides I feel with that design are:
    • It's hard to await for both informational and the final response (though not impossible, and that is the design with some other interfaces, through polling).
    • Anything that converts the ResponseFuture into an impl Future or dyn Future (or async fn) slightly higher up loses the ability to call those methods, or expose that functionality to users. For instance, composition in a tower stack.

@seanmonstar seanmonstar added the B-rfc Blocked: More comments would be useful in determine next steps. label Dec 24, 2024
@seanmonstar seanmonstar force-pushed the ext-on-informational branch 5 times, most recently from 79e6d50 to 980d5d8 Compare December 24, 2024 22:36
This new function allows attaching a callback to a request, such that
when it is sent through a hyper client connection, and any 1xx
informational responses are received, they are passed to the callback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-rfc Blocked: More comments would be useful in determine next steps.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client support for receiving 1xx informational responses
1 participant