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
146
146
loop {
147
147
let bytes_read = reader. read_until ( b'\n' , & mut buf) . await ?;
148
148
// 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 ?
150
150
151
151
// We've hit the end delimiter of the stream.
152
152
let idx = buf. len ( ) - 1 ;
@@ -184,7 +184,7 @@ where
184
184
let transfer_encoding = res. header ( & TRANSFER_ENCODING ) ;
185
185
186
186
http_types:: ensure!(
187
- content_length. is_some ( ) && transfer_encoding. is_some ( ) ,
187
+ content_length. is_none ( ) || transfer_encoding. is_none ( ) ,
188
188
"Unexpected Content-Length header"
189
189
) ;
190
190
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ fn parse_imf_fixdate(s: &[u8]) -> Result<HttpDate, Error> {
113
113
fn parse_rfc850_date ( s : & [ u8 ] ) -> Result < HttpDate , Error > {
114
114
// Example: `Sunday, 06-Nov-94 08:49:37 GMT`
115
115
ensure ! (
116
- s. len( ) < RFC850_MAX_LENGTH ,
116
+ s. len( ) >= RFC850_MAX_LENGTH ,
117
117
"Date time not in rfc850 format"
118
118
) ;
119
119
Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ where
363
363
// Convert our header buf into an httparse instance, and validate.
364
364
let status = httparse_req. parse ( & buf) ?;
365
365
366
- ensure ! ( status. is_partial( ) , "Malformed HTTP head" ) ;
366
+ ensure ! ( ! status. is_partial( ) , "Malformed HTTP head" ) ;
367
367
368
368
// Convert httparse headers + body into a `http::Request` type.
369
369
let method = httparse_req. method ;
@@ -389,7 +389,7 @@ where
389
389
let transfer_encoding = req. header ( & TRANSFER_ENCODING ) ;
390
390
391
391
http_types:: ensure!(
392
- content_length. is_some ( ) && transfer_encoding. is_some ( ) ,
392
+ content_length. is_none ( ) || transfer_encoding. is_none ( ) ,
393
393
"Unexpected Content-Length header"
394
394
) ;
395
395
You can’t perform that action at this time.
0 commit comments