(pattern: &str, host: &str)
| 1465 | } |
| 1466 | |
| 1467 | fn host_pattern_matches(pattern: &str, host: &str) -> bool { |
| 1468 | let pattern = pattern.to_ascii_lowercase(); |
| 1469 | let host = host.to_ascii_lowercase(); |
| 1470 | if pattern == host { |
| 1471 | return true; |
| 1472 | } |
| 1473 | if !pattern.contains('*') { |
| 1474 | return false; |
| 1475 | } |
| 1476 | |
| 1477 | let pattern_labels: Vec<&str> = pattern.split('.').collect(); |
| 1478 | let host_labels: Vec<&str> = host.split('.').collect(); |
| 1479 | host_pattern_labels_match(&pattern_labels, &host_labels) |
| 1480 | } |
| 1481 | |
| 1482 | fn host_pattern_labels_match(pattern: &[&str], host: &[&str]) -> bool { |
| 1483 | match pattern.split_first() { |
no test coverage detected