(headers: &HeaderMap, origin: &str)
| 245 | } |
| 246 | |
| 247 | fn origin_matches_request_host(headers: &HeaderMap, origin: &str) -> bool { |
| 248 | let Some(origin_authority) = origin_authority(origin) else { |
| 249 | return false; |
| 250 | }; |
| 251 | headers |
| 252 | .get(header::HOST) |
| 253 | .and_then(|value| value.to_str().ok()) |
| 254 | .map(normalize_authority) |
| 255 | .is_some_and(|host| host == origin_authority) |
| 256 | } |
| 257 | |
| 258 | fn origin_authority(origin: &str) -> Option<String> { |
| 259 | let without_scheme = origin |
no test coverage detected