Skip to content

Commit d91a0f7

Browse files
committed
fix(decompression-plz): improved Init to End transition if no encodings are present
1 parent 8f6ecf8 commit d91a0f7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

decompression-plz/src/state.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ where
2929
T: DecompressTrait + 'a + std::fmt::Debug,
3030
{
3131
pub fn init(message: &'a mut T, buf: &'a mut BytesMut) -> Self {
32-
let decode_struct = DecodeStruct::new(message, buf);
33-
Self::Start(decode_struct)
32+
Self::Start(DecodeStruct::new(message, buf))
3433
}
3534

3635
pub fn try_next(self) -> Result<Self, MultiDecompressErrorReason> {
@@ -45,12 +44,8 @@ where
4544
} else if decode_struct.extra_body_is_some() {
4645
Self::UpdateContentLength(decode_struct)
4746
} else {
48-
if decode_struct.extra_body_is_none() {
49-
let mut body = decode_struct.take_main_body();
50-
decode_struct.message.set_body(Body::Raw(body));
51-
} else {
52-
decode_struct.add_body_and_update_cl();
53-
}
47+
let mut body = decode_struct.take_main_body();
48+
decode_struct.message.set_body(Body::Raw(body));
5449
Self::End
5550
};
5651
Ok(next_state)

0 commit comments

Comments
 (0)