Skip to content

100-continue response with BodyStream impossible #3827

Open
@fungs

Description

@fungs

Version
Hyper 1.5 server (HTTP1 mode)

Description
Hey there, Hyper team! I've run into a bit of a pickle with Hyper 1.5 and the handling of 100-continue responses. Let me break it down:

  1. The newer streaming API (BodyStream) doesn't trigger an automatic 100-continue informational response when a data frame is polled. This is different from the older Body API, which sends the 100-continue when the body is first polled.

  2. Trying to send a 100-continue response manually in the application using return Ok(Response::new(Body::empty())) results in a runtime error: UnsupportedStatusCode. This leaves us in a bit of a bind.

  3. I've seen suggestions to inject the response at the TCP layer, but that's pretty awkward, especially when using TLS encryption. It feels like we're working against the library rather than with it.

I'm curious why the logic that works for Body and the older API (as described in PR #2119, which added automatic 100-continue support for Body) doesn't work with BodyStream. That PR essentially made Hyper automatically send a 100-continue response when the body is first polled if the request included an Expect: 100-continue header.

Would it be possible to implement support for the 100-continue response using the body streaming interface in the same way as it's done for Body? It seems like this would provide a consistent experience across both APIs.

I noticed PR #3815, which adds support for sending informational responses. Will this solve the problem? It looks like it adds a send_informational method to the response, but I'm not sure if this will integrate with the automatic 100-continue behavior.

Thanks for your time, and I'm looking forward to hearing your thoughts on this!

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!S-waiting-on-authorStatus: waiting on the author to provide more info, or make changes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions