@@ -30,10 +30,10 @@ where
3030 Self :: Start ( decode_struct)
3131 }
3232
33- pub fn try_next ( self ) -> Self {
33+ pub fn try_next ( self ) -> Result < Self , MultiDecompressErrorReason > {
3434 match self {
3535 DecodeState :: Start ( mut decode_struct) => {
36- if decode_struct. transfer_encoding_is_some ( ) {
36+ let next_state = if decode_struct. transfer_encoding_is_some ( ) {
3737 let encodings = decode_struct. transfer_encoding ( ) ;
3838 Self :: TransferEncoding ( decode_struct, encodings)
3939 } else if decode_struct. content_encoding_is_some ( ) {
4343 Self :: UpdateContentLength ( decode_struct)
4444 } else {
4545 Self :: End
46- }
46+ } ;
47+ Ok ( next_state)
4748 }
4849 DecodeState :: TransferEncoding (
4950 mut decode_struct,
5556 decode_struct. chunked_to_raw ( ) ;
5657 }
5758 // TODO: check if only te is chunked
58- match apply_encoding ( & mut decode_struct, & mut encoding_infos) {
59+ let next_state = match apply_encoding (
60+ & mut decode_struct,
61+ & mut encoding_infos,
62+ ) {
5963 Ok ( ( ) ) if decode_struct. content_encoding_is_some ( ) => {
6064 let encodings = decode_struct. content_encoding ( ) ;
6165 Self :: ContentEncoding ( decode_struct, encodings)
7074 Self :: End
7175 }
7276 }
73- }
77+ } ;
78+ Ok ( next_state)
7479 }
7580 DecodeState :: ContentEncoding (
7681 mut decode_struct,
@@ -79,17 +84,17 @@ where
7984 match apply_encoding ( & mut decode_struct, & mut encoding_infos) {
8085 Err ( e) if !e. is_partial ( ) => {
8186 error ! ( "{}" , e) ;
82- return Self :: End ;
87+ return Ok ( Self :: End ) ;
8388 }
8489 _ => { }
8590 }
86- Self :: UpdateContentLength ( decode_struct)
91+ Ok ( Self :: UpdateContentLength ( decode_struct) )
8792 }
8893 DecodeState :: UpdateContentLength ( mut decode_struct) => {
8994 decode_struct. add_body_and_update_cl ( ) ;
9095 Ok ( Self :: End )
9196 }
92- DecodeState :: End => Self :: End ,
97+ DecodeState :: End => Ok ( Self :: End ) ,
9398 }
9499 }
95100
0 commit comments