Update Hyper Client to support handling `expect: 100-continue` header
Is your feature request related to a problem? Please describe.
When I use Hyper Client based on the example (https://github.com/hyperium/hyper/blob/3817a79b213f840302d7e27fac8508de9caada0f/examples/client.rs#L49-L54), 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.
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:
- Support for knowing when a 100 response is received (see #2565)
- 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.
- [x] #3818
- [ ] Provide an
expect_continuehelper inhyper-util
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 https://github.com/hyperium/hyper/blob/3817a79b213f840302d7e27fac8508de9caada0f/src/client/conn/http1.rs#L221 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.
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.
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.
Created a new PR to add a new example