()
| 248 | |
| 249 | #[tokio::test] |
| 250 | async fn rejects_v1_without_terminator() { |
| 251 | // PROXY prefix matched but no \r\n terminator within V1_MAX_LENGTH bytes. |
| 252 | let bytes = vec![b'P'; V1_MAX_LENGTH + 8]; // all 'P' — never closes |
| 253 | let mut head = b"PROXY".to_vec(); |
| 254 | head.extend(std::iter::repeat(b'A').take(V1_MAX_LENGTH)); |
| 255 | let err = read_proxy_header(&head[..]).await.unwrap_err(); |
| 256 | let msg = format!("{err:#}"); |
| 257 | assert!( |
| 258 | msg.contains("v1 terminator not found") || msg.contains("no valid proxy"), |
| 259 | "unexpected error: {msg}" |
| 260 | ); |
| 261 | // Sanity: the longer no-terminator buffer would also fail (read past) |
| 262 | let _ = bytes; |
| 263 | } |
| 264 | |
| 265 | #[tokio::test] |
| 266 | async fn rejects_v2_oversize_length() { |
nothing calls this directly
no test coverage detected