(prefix: &[u8])
| 588 | } |
| 589 | |
| 590 | fn looks_like_http(prefix: &[u8]) -> bool { |
| 591 | const METHODS: [&[u8]; 10] = [ |
| 592 | b"GET ", |
| 593 | b"POST ", |
| 594 | b"PUT ", |
| 595 | b"PATCH ", |
| 596 | b"DELETE ", |
| 597 | b"HEAD ", |
| 598 | b"OPTIONS ", |
| 599 | b"TRACE ", |
| 600 | b"CONNECT ", |
| 601 | b"PRI ", |
| 602 | ]; |
| 603 | |
| 604 | if prefix.is_empty() { |
| 605 | return false; |
| 606 | } |
| 607 | METHODS |
| 608 | .iter() |
| 609 | .any(|method| method.starts_with(prefix) || prefix.starts_with(method)) |
| 610 | } |
| 611 | |
| 612 | fn allow_plaintext_service_http( |
| 613 | enabled: bool, |
no test coverage detected