Skip to content

Commit 4bffecc

Browse files
committed
fix: chunked reader parse extra data
1 parent c1e537c commit 4bffecc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

body-plz/src/reader/chunked_reader.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ impl ChunkReader {
133133
}
134134
}
135135
Self::EndCRLF => {
136-
if buf.remaining() == CRLF.as_bytes() {
137-
buf.set_position(buf.position() + 2);
136+
if let Some(index) = buf
137+
.remaining()
138+
.windows(2)
139+
.position(|window| window == CRLF.as_bytes())
140+
{
141+
buf.set_position(index + 2);
138142
*self = Self::End;
139143
Some(ChunkedBody::EndCRLF(buf.split_at_current_pos()))
140144
} else {

0 commit comments

Comments
 (0)