hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Expect: 100-continue not implemented for HTTP/2

Open rawler opened this issue 3 years ago • 3 comments

Hyper (server) does not support sending 100 Continue upon receiving an HTTP/2 request with a Expect: 100-continue specified. This is currently blocking moving a project from HTTP/1.1 to HTTP2 for me.

I've been digging through the specs, and as far as I can tell;

HTTP's existing semantics remain unchanged.

An origin server MUST, upon receiving an HTTP/1.1 (or later) request-line and a complete header section that contains a 100-continue expectation and indicates a request message body will follow, either send an immediate response with a final status code, if that status can be determined by examining just the request-line and header fields, or send an immediate 100 (Continue) response to encourage the client to send the request's message body. The origin server MUST NOT wait for the message body before sending the 100 (Continue) response.

I think the simple solution here is to try to replicate the behavior hyper already expose for HTTP/1.1? https://github.com/hyperium/hyper/issues/838

rawler avatar Jan 30 '22 17:01 rawler

I'm not sure about the "bug" label, but given the emphasis on correct by Hyper, and this is technically breaking spec I chose "bug" over "feature request". Feel free to change if there is some better convention.

rawler avatar Jan 30 '22 17:01 rawler

Yep, sounds like a good thing to add!

seanmonstar avatar Jan 31 '22 17:01 seanmonstar

I started looking into it myself, by adding send_continue-method to H2, but I've gotten stuck on writing an integration-test for it. For some reason, despite client.send_frame(frames::data(1, "hello world").eos()) succeeding, reading the request-body in the server task fails. https://github.com/rawler/h2/commit/d4cf4632e8633d108d337f399c6f26a6c5e01046

rawler avatar Feb 03 '22 12:02 rawler