In short, reqwest sends a `content-length: 0` header in GET requests for a reason maybe related to this issue: https://github.com/seanmonstar/reqwest/issues/1971 For now, let's ignore Content-Length header lines.
Unified · Split
| @@ -160,6 +160,7 @@ fn http_authentication_error_can_be_differentiated_and_identity_is_transmitted() · 159 unmodified lines | |||
| 160 | .received_as_string() | 160 | .received_as_string() |
| 161 | .lines() | 161 | .lines() |
| 162 | .map(str::to_lowercase) | 162 | .map(str::to_lowercase) |
| 163 | .filter(ignore_reqwest_content_length) | ||
| 163 | .collect::<HashSet<_>>(), | 164 | .collect::<HashSet<_>>(), |
| 164 | format!( | 165 | format!( |
| 165 | "GET /path/not-important/info/refs?service=git-upload-pack HTTP/1.1 | 166 | "GET /path/not-important/info/refs?service=git-upload-pack HTTP/1.1 |
| @@ -187,6 +188,7 @@ Authorization: Basic dXNlcjpwYXNzd29yZA== · 21 unmodified lines | |||
| 187 | .lines() | 188 | .lines() |
| 188 | .map(str::to_lowercase) | 189 | .map(str::to_lowercase) |
| 189 | .filter(|l| !l.starts_with("expect: ")) | 190 | .filter(|l| !l.starts_with("expect: ")) |
| 191 | .filter(ignore_reqwest_content_length) | ||
| 190 | .collect::<HashSet<_>>(); | 192 | .collect::<HashSet<_>>(); |
| 191 | // On linux on CI, for some reason, it won't have this chunk id here, but | 193 | // On linux on CI, for some reason, it won't have this chunk id here, but |
| 192 | // it has it whenever and where-ever I run it. | 194 | // it has it whenever and where-ever I run it. |
| @@ -337,6 +339,7 @@ fn handshake_v1() -> crate::Result { · 144 unmodified lines | |||
| 337 | .received_as_string() | 339 | .received_as_string() |
| 338 | .lines() | 340 | .lines() |
| 339 | .map(str::to_lowercase) | 341 | .map(str::to_lowercase) |
| 342 | .filter(ignore_reqwest_content_length) | ||
| 340 | .collect::<HashSet<_>>(), | 343 | .collect::<HashSet<_>>(), |
| 341 | format!( | 344 | format!( |
| 342 | "GET /path/not/important/due/to/mock/info/refs?service=git-upload-pack HTTP/1.1 | 345 | "GET /path/not/important/due/to/mock/info/refs?service=git-upload-pack HTTP/1.1 |
| @@ -550,6 +553,7 @@ fn handshake_and_lsrefs_and_fetch_v2_impl(handshake_fixture: &str) -> crate::Res · 207 unmodified lines | |||
| 550 | .received_as_string() | 553 | .received_as_string() |
| 551 | .lines() | 554 | .lines() |
| 552 | .map(str::to_lowercase) | 555 | .map(str::to_lowercase) |
| 556 | .filter(ignore_reqwest_content_length) | ||
| 553 | .collect::<HashSet<_>>(), | 557 | .collect::<HashSet<_>>(), |
| 554 | format!( | 558 | format!( |
| 555 | "GET /path/not/important/due/to/mock/info/refs?service=git-upload-pack HTTP/1.1 | 559 | "GET /path/not/important/due/to/mock/info/refs?service=git-upload-pack HTTP/1.1 |
| @@ -680,3 +684,7 @@ fn check_content_type_is_case_insensitive() -> crate::Result { · 124 unmodified lines | |||
| 680 | assert!(result.is_ok()); | 684 | assert!(result.is_ok()); |
| 681 | Ok(()) | 685 | Ok(()) |
| 682 | } | 686 | } |
| 687 | |||
| 688 | fn ignore_reqwest_content_length(header_line: &String) -> bool { | ||
| 689 | header_line != "content-length: 0" | ||
| 690 | } | ||