(rawUrl)
| 108 | } |
| 109 | |
| 110 | function sanitizedRequestPath(rawUrl) { |
| 111 | if (typeof rawUrl !== "string" || rawUrl.length === 0) { |
| 112 | return "/"; |
| 113 | } |
| 114 | try { |
| 115 | const parsed = new URL(rawUrl, "http://localhost"); |
| 116 | const masked = new URLSearchParams(); |
| 117 | parsed.searchParams.forEach((value, key) => { |
| 118 | masked.append(key, ALLOWED_LOGGED_QUERY_KEYS.has(key.toLowerCase()) ? value : "***"); |
| 119 | }); |
| 120 | const qs = masked.toString(); |
| 121 | return qs.length > 0 ? `${parsed.pathname}?${qs}` : parsed.pathname; |
| 122 | } catch { |
| 123 | return "/"; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | async function handleWebSocketConnection(ws, req) { |
| 128 | const url = new URL(req.url, `http://${req.headers.host || "localhost"}`); |
no test coverage detected