Skip to content

docs(hips): Body::poll_progress - #4265

Draft
cratelyn wants to merge 1 commit into
hyperium:masterfrom
cratelyn:kate/body-poll-progress-hip
Draft

cratelyn wants to merge 1 commit into
hyperium:masterfrom
cratelyn:kate/body-poll-progress-hip

Conversation

@cratelyn

@cratelyn cratelyn commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Rendered

note: this is still a working draft, but i wanted to open this up as i continue to flesh this proposal out.

Important

Please make line comments, instead of comments on the PR as a whole. It makes discussion much easier to keep untangled.

@cratelyn cratelyn self-assigned this Nov 12, 2026
@cratelyn cratelyn added A-docs Area: documentation. C-feature Category: feature. This is adding a new feature. A-body Area: body streaming. labels Nov 12, 2026

## Unresolved Questions

### Clarify `Poll::Pending` vs. `Poll::Ready(())`

@cratelyn cratelyn Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this remains the largest open question to me. in hyperium/http-body#90, the question was raised about why we model this as a Poll<Result<(), E>>. one alternative was suggested:

It's done purely so you can ?-propagate errors in the implementation. Maybe Poll<Result<!, E>> would be better?

to me this indicates that there is not a meaningful distinction between these. the error is the interesting value, otherwise we are indicating whether or not progress was made by the body.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokio::net::TcpStream::poll_peek() may be a useful comparison to make here:

Note that on multiple calls to poll_peek, poll_read or poll_read_ready, only the Waker from the Context passed to the most recent call is scheduled to receive a wakeup.

perhaps the relationship between poll_frame and poll_progress could be described in similar terms. they are both mechanisms to poll a body, one of which does not expose the possibility of yielding a frame, and the Waker from the most recent call will receive a wakeup.

Comment on lines +207 to +218
## User Experience

## Implementation

## Testing Plan

(Optional: are there any special considerations for testing required?)

## Security Considerations

(What security risks might exist for the recommendation? Can we reduce them?
What should users consider when using it?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: these still need to be filled out. i don't see much unknown here, compared to the Pending question above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK if there aren't any, we can just say so. But here's some questions I have off the top of my head:

  • Could a wrong implementation result in truncated messages?
  • Could combinators that forward to a wrapped body incorrectly?
  • Could a default implementation that one forgets to override lost data?
  • Could this be used as a solution to what some may feel are security issues, like stalled streams?

consumers that a stream should be aborted.

<!-- markdownlint-disable-next-line heading-increment -->
#### The Rules of `poll_progress()`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've tried to outline "the rules" of this method here, in part to seed discussion about guarantees and edge cases.

to briefly summarize: (1) poll_progress() is always optional. (2) an error from poll_progress() should be treated as cause to discard the body, just like an error returned from poll_frame(). (3) poll_progress() may be called repeatedly.

@cratelyn
cratelyn force-pushed the kate/body-poll-progress-hip branch 3 times, most recently from 3b67f99 to b1ede02 Compare November 13, 2026 21:25
Signed-off-by: katelyn martin <[email protected]>
@cratelyn
cratelyn force-pushed the kate/body-poll-progress-hip branch from b1ede02 to e6a5fd0 Compare November 13, 2026 21:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-body Area: body streaming. A-docs Area: documentation. C-feature Category: feature. This is adding a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants