(pattern: &str, host: &str)
| 678 | } |
| 679 | |
| 680 | fn host_pattern_matches(pattern: &str, host: &str) -> bool { |
| 681 | let pattern = pattern.to_ascii_lowercase(); |
| 682 | let host = host.to_ascii_lowercase(); |
| 683 | if pattern == host { |
| 684 | return true; |
| 685 | } |
| 686 | if !pattern.contains('*') { |
| 687 | return false; |
| 688 | } |
| 689 | |
| 690 | let pattern_labels: Vec<&str> = pattern.split('.').collect(); |
| 691 | let host_labels: Vec<&str> = host.split('.').collect(); |
| 692 | host_pattern_labels_match(&pattern_labels, &host_labels) |
| 693 | } |
| 694 | |
| 695 | fn host_pattern_labels_match(pattern: &[&str], host: &[&str]) -> bool { |
| 696 | match pattern.split_first() { |
no test coverage detected