File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ where
146146 loop {
147147 let bytes_read = reader. read_until ( b'\n' , & mut buf) . await ?;
148148 // No more bytes are yielded from the stream.
149- assert_eq ! ( bytes_read, 0 , "Empty response" ) ; // TODO: ensure_eq ?
149+ assert ! ( bytes_read != 0 , "Empty response" ) ; // TODO: ensure ?
150150
151151 // We've hit the end delimiter of the stream.
152152 let idx = buf. len ( ) - 1 ;
@@ -184,7 +184,7 @@ where
184184 let transfer_encoding = res. header ( & TRANSFER_ENCODING ) ;
185185
186186 http_types:: ensure!(
187- content_length. is_some ( ) && transfer_encoding. is_some ( ) ,
187+ content_length. is_none ( ) || transfer_encoding. is_none ( ) ,
188188 "Unexpected Content-Length header"
189189 ) ;
190190
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ fn parse_imf_fixdate(s: &[u8]) -> Result<HttpDate, Error> {
113113fn parse_rfc850_date ( s : & [ u8 ] ) -> Result < HttpDate , Error > {
114114 // Example: `Sunday, 06-Nov-94 08:49:37 GMT`
115115 ensure ! (
116- s. len( ) < RFC850_MAX_LENGTH ,
116+ s. len( ) >= RFC850_MAX_LENGTH ,
117117 "Date time not in rfc850 format"
118118 ) ;
119119
Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ where
363363 // Convert our header buf into an httparse instance, and validate.
364364 let status = httparse_req. parse ( & buf) ?;
365365
366- ensure ! ( status. is_partial( ) , "Malformed HTTP head" ) ;
366+ ensure ! ( ! status. is_partial( ) , "Malformed HTTP head" ) ;
367367
368368 // Convert httparse headers + body into a `http::Request` type.
369369 let method = httparse_req. method ;
@@ -389,7 +389,7 @@ where
389389 let transfer_encoding = req. header ( & TRANSFER_ENCODING ) ;
390390
391391 http_types:: ensure!(
392- content_length. is_some ( ) && transfer_encoding. is_some ( ) ,
392+ content_length. is_none ( ) || transfer_encoding. is_none ( ) ,
393393 "Unexpected Content-Length header"
394394 ) ;
395395
You can’t perform that action at this time.
0 commit comments