Question: can frame.into_data() be incomplete?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 173
- Forks
- 69
- Avg merge
- 6d 15h
- Merged PRs (30d)
- 4
Description
I use http-body to parse the body of an endless Transfer-Encoding: Chunked stream.
let frame = response.frame().await.expect("Stream ended").expect("Failed to read frame");
let Ok(data) = frame.into_data() else {
// frame is trailers, ignored
continue;
};
let decoded = serde_json::from_slice(&data)?;
// ...
But as I've discovered, under certain conditions data is incomplete. When complete it ends in \n.
To fix it I have a buffer that I only parse out the part of [0..(index of first b'\n'] and remove it from the buffer.
This leaves me with the following questions:
- Is this expected behavior from
Frame? Having a partial piece in there? - Is the
\na left-over from the Chunked separator\r\n?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the frame() and Frame::into_data() entry points used in the example, then compare their behavior across complete and incomplete chunked-stream data. Determine whether partial data is part of the documented behavior and whether the trailing newline is relevant; done means a clear answer supported by a focused regression test or documentation update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100