Skip to content

Add hyper-util helpers to support handling expect: 100-continue header #3833

Open
hyperium/hyper-util
#321

Description

@heiwais25

Is your feature request related to a problem? Please describe.

When I use Hyper Client based on the example (

hyper/examples/client.rs

Lines 49 to 54 in 3817a79

let (mut sender, conn) = hyper::client::conn::http1::handshake(io).await?;
tokio::task::spawn(async move {
if let Err(err) = conn.await {
println!("Connection failed: {:?}", err);
}
});
), it doesn't correctly handle the expect: 100-continue header in the request.

Describe the solution you'd like

Hyper Client needs to wait for the 100 continue response from the S3WSServer after sending the request header parts for certain time and then send the request body if it gets the response from the server or after certain time threshold.

This is to have the same functionality as https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100

Describe alternatives you've considered

Expose the client parts where it sends the request header and body, but it will be inefficient for the developers to implement the same functionality.

Additional context
Add any other context or screenshots about the feature request here.

Activity

  1. added
    C-featureCategory: feature. This is adding a new feature.
    on Jan 17, 2025
  2. seanmonstar commented on Jan 17, 2025

    @seanmonstar
    Member

    I'm not certain I want to add explicit support inside hyper, because a timeout is needed, and I'd prefer as much as possible that those be done outside of hyper. That doesn't mean we couldn't eventually someday add explicit support, of course. But, in order to support it, it needs two things:

    1. Support for knowing when a 100 response is received (see Client support for receiving 1xx informational responses #2565)
    2. A body which combines waiting for that response or a timeout, whichever comes first.

    I think we can provide both, the first one in hyper, and a helper body type in hyper-util which registers a callback and then provides a body wrapper that make use of it and a timmer.

  3. heiwais25 commented on Jan 17, 2025

    @heiwais25
    Author

    Thank you for sharing the earlier discussions and the follow up.

    It would be great if the client supports this behavior somehow even though Hyper doesn't have explicit support.

    I understand the point of on_information(), but have some questions about the second one.

    It seems hyper-util uses SendRequest

    pub fn try_send_request(
    to send the request eventually which is in Hyper crate.

    Could you share the high level idea about the second one without updating Hyper? I think we ended up updating Hyper.

  4. heiwais25 commented on Jan 17, 2025

    @heiwais25
    Author

    Also, to add few thoughts, I think it makes sense to add it to the Hyper explicitly since it is listed in RFC https://www.rfc-editor.org/rfc/rfc9110#name-expect.

  5. heiwais25 commented on Jun 25, 2025

    @heiwais25
    Author

    Hi, I was able to implement 100 Continue behavior by using set_on_informational_hook that you exposed.

    Thanks! Let me create an example code as an Hyper example. I think it would be helpful reference.

  6. heiwais25 commented on Jul 7, 2025

    @heiwais25
    Author

    Created a new PR to add a new example

  7. Roshyoshi commented on Jul 17, 2026

    @Roshyoshi

    Hi, I am interested in taking over the fix for this issue, seems like expect_continue helper in hyper-util was never added, wondering what direction we want to go for this? From what I can see, maybe small helper in legacy client.rs that will wrap the header itself?

  8. seanmonstar commented on Jul 17, 2026

    @seanmonstar
    Member

    It would need to create a body wrapper, and set the callback. The body would wrap an underlying body, set a timeout, and wait for either the timeout, or for some kind of notification from the callback, before poll_frame would make progress and call the underlying body to begin streaming.

  9. bountis commented on Aug 18, 2026

    @bountis

    Hey, I would love to work on this!

  10. Catwoman08 commented on Aug 20, 2026

    @Catwoman08
    Contributor

    @bountis - Awesome! please see Seanmonstar's thoughts above! If its helpful see https://hyper.rs/contrib/pull-requests/ Looking forward to it!

  11. changed the title [-]Update Hyper Client to support handling `expect: 100-continue` header[/-] [+]Add hyper-util helpers to support handling `expect: 100-continue` header[/+] on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature. This is adding a new feature.E-pr-welcomeEffort: a pull request is welcome.K-hyper-utilCrate: hyper-util

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions