-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Client support for receiving 1xx informational responses #2565
Copy link
Copy link
Closed
Labels
A-clientArea: client.Area: client.B-rfcBlocked: More comments would be useful in determine next steps.Blocked: More comments would be useful in determine next steps.C-featureCategory: feature. This is adding a new feature.Category: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.Effort: medium. Some knowledge of how hyper internal works would be useful.
Metadata
Metadata
Assignees
Labels
A-clientArea: client.Area: client.B-rfcBlocked: More comments would be useful in determine next steps.Blocked: More comments would be useful in determine next steps.C-featureCategory: feature. This is adding a new feature.Category: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.Effort: medium. Some knowledge of how hyper internal works would be useful.
This is to discuss adding support for accessing 1xx informational responses on the client side (see #2426 for server side). Currently, hyper parses all 1xx responses and ignores them, as RFC 7230 says it must at least be able to receive and ignore them.
The Client (and
client::conn) interfaces return animpl Future<Output = Result<Response>>, which only allows awaiting it for a single response. We can't really add new methods to allow also awaiting for informational responses, unless we stuck to always return a specialized type that is both aFutureand has extra methods. However, using those together wouldn't be that clear to a user. You can't be sure if or how many informational responses would be received before the full response, so you would want to await "both" types.Instead, we can use a callback format. We could define a type (
hyper::client::ext::Informational?On1xx? names...), and the user would store that in the request extensions. We'd then check for that in the h1 proto code and if it exists, call the callback with the 1xx headers.