(host)
| 17 | const SAFE_HTTP_METHODS = new Set(["GET", "HEAD", "OPTIONS"]); |
| 18 | |
| 19 | export function isLoopbackBind(host) { |
| 20 | if (host == null || host === "") return false; |
| 21 | const normalized = String(host) |
| 22 | .trim() |
| 23 | .replace(/^\[|\]$/g, "") |
| 24 | .toLowerCase(); |
| 25 | return ( |
| 26 | STATIC_LOOPBACK_HOSTS.has(normalized) || IPV4_LOOPBACK_RE.test(normalized) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Parse a `Host` header authority without permitting URL userinfo (`@`), |
no outgoing calls
no test coverage detected