(host: string)
| 52 | } |
| 53 | |
| 54 | function isLoopbackHost(host: string): boolean { |
| 55 | if (host === "localhost") return true |
| 56 | if (host === "::1") return true |
| 57 | if (host.startsWith("127.")) return true |
| 58 | const ipVersion = isIP(host) |
| 59 | return ipVersion === 6 && host === "::1" |
| 60 | } |
| 61 | |
| 62 | function isAuthorized(request: http.IncomingMessage, options: Required<Pick<RuntimeNodeHttpServerOptions, "allowUnauthenticatedLoopback">> & Pick<RuntimeNodeHttpServerOptions, "host" | "token">): boolean { |
| 63 | const token = tokenFromRequest(request) |