hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 269 forks source link

Support SendResponse::send_continue #601

Open rawler opened 2 years ago

rawler commented 2 years ago

Support for Expect: 100-continue is mandated as MUST by https://datatracker.ietf.org/doc/html/rfc7231#section-5.1.1. Yet servers built on h2 cannot currently support this requirement.

One example of such usage, is hyper #2743.

This approach adds a send_continue method to SendResponse that a server application can use to implement support itself. This PR does not solve the feature itself, it merely provides sufficient support for a server application to implement the functionality as desired.

rawler commented 2 years ago

One possible alternate solution, could be to implement more of the functionality directly, by hooking up the first attempt to read the request-body, as a signal to send 100-continue, if the header was there on the Request. Ideally, that would be implemented in Request::into_body, or add the behavior to the first call of RecvStream::poll_data. However, it seemed more invasive than I'd like it to be, and I didn't manage to wire it up in an acceptable way anyways.

rawler commented 2 years ago

Thank you :pray: for a good and clear review. I've changed the according to the feedback.

rawler commented 2 years ago

Ping

rawler commented 2 years ago

Ping

rawler commented 1 year ago

Ping @seanmonstar

rawler commented 1 year ago

Maybe @LucioFranco have some time for a review? :pray:

zh-jq commented 1 year ago

Any progress? It's an important feature

zh-jq-b commented 1 year ago

@seanmonstar This is ready for a new review, do you have anytime to do it?