+12
-17
@@ -7,2 +7,3 @@ import "../_chunks/_utils.mjs"; | ||
| import { Duplex, PassThrough, Readable } from "node:stream"; | ||
| import { pipeline } from "node:stream/promises"; | ||
| import nodeHTTPS from "node:https"; | ||
@@ -21,6 +22,3 @@ import nodeHTTP2 from "node:http2"; | ||
| if (res.body instanceof ReadableStream) return streamBody(res.body, nodeRes); | ||
| else if (typeof res.body?.pipe === "function") { | ||
| res.body.pipe(nodeRes); | ||
| return new Promise((resolve) => nodeRes.on("close", resolve)); | ||
| } | ||
| else if (typeof res.body?.pipe === "function") return pipeBody(res.body, nodeRes); | ||
| nodeRes.write(res.body); | ||
@@ -42,2 +40,9 @@ } | ||
| } | ||
| function pipeBody(stream, nodeRes) { | ||
| if (nodeRes.destroyed) { | ||
| stream.destroy(); | ||
| return; | ||
| } | ||
| return pipeline(stream, nodeRes).catch(() => {}); | ||
| } | ||
| function streamBody(stream, nodeRes) { | ||
@@ -86,5 +91,4 @@ if (nodeRes.destroyed) { | ||
| let host = req.headers.host || req.headers[":authority"]; | ||
| if (host) { | ||
| if (!HOST_RE.test(host)) throw new TypeError(`Invalid host header: ${host}`); | ||
| } else if (req.socket) host = `${req.socket.localFamily === "IPv6" ? "[" + req.socket.localAddress + "]" : req.socket.localAddress}:${req.socket?.localPort || "80"}`; | ||
| if (host && !HOST_RE.test(host)) host = "_invalid_"; | ||
| else if (!host) if (req.socket) host = `${req.socket.localFamily === "IPv6" ? "[" + req.socket.localAddress + "]" : req.socket.localAddress}:${req.socket?.localPort || "80"}`; | ||
| else host = "localhost"; | ||
@@ -151,13 +155,4 @@ const protocol = req.socket?.encrypted || req.headers["x-forwarded-proto"] === "https" || req.headers[":scheme"] === "https" ? "https:" : "http:"; | ||
| } | ||
| *_entries() { | ||
| const rawHeaders = this.#req.rawHeaders; | ||
| const len = rawHeaders.length; | ||
| for (let i = 0; i < len; i += 2) { | ||
| const key = rawHeaders[i]; | ||
| if (key.charCodeAt(0) === 58) continue; | ||
| yield [key.toLowerCase(), rawHeaders[i + 1]]; | ||
| } | ||
| } | ||
| entries() { | ||
| return this.#headers ? this.#headers.entries() : this._entries(); | ||
| return this._headers.entries(); | ||
| } | ||
@@ -164,0 +159,0 @@ [Symbol.iterator]() { |
+11
-11
| { | ||
| "name": "srvx", | ||
| "version": "0.11.9", | ||
| "version": "0.11.10", | ||
| "description": "Universal Server.", | ||
@@ -62,3 +62,3 @@ "homepage": "https://srvx.h3.dev", | ||
| "devDependencies": { | ||
| "@cloudflare/workers-types": "^4.20260307.1", | ||
| "@cloudflare/workers-types": "^4.20260313.1", | ||
| "@hono/node-server": "^1.19.11", | ||
@@ -71,7 +71,7 @@ "@mitata/counters": "^0.0.8", | ||
| "@types/express": "^5.0.6", | ||
| "@types/node": "^25.3.5", | ||
| "@types/node": "^25.5.0", | ||
| "@types/node-forge": "^1.3.14", | ||
| "@types/serviceworker": "^0.0.193", | ||
| "@typescript/native-preview": "7.0.0-dev.20260309.1", | ||
| "@vitest/coverage-v8": "^4.0.18", | ||
| "@typescript/native-preview": "^7.0.0-dev.20260315.1", | ||
| "@vitest/coverage-v8": "^4.1.0", | ||
| "@whatwg-node/server": "^0.10.18", | ||
@@ -89,9 +89,9 @@ "automd": "^0.4.3", | ||
| "obuild": "^0.4.32", | ||
| "oxfmt": "^0.36.0", | ||
| "oxlint": "^1.51.0", | ||
| "srvx-release": "npm:srvx@^0.11.8", | ||
| "oxfmt": "^0.40.0", | ||
| "oxlint": "^1.55.0", | ||
| "srvx-release": "npm:srvx@^0.11.9", | ||
| "tslib": "^2.8.1", | ||
| "typescript": "^5.9.3", | ||
| "undici": "^7.22.0", | ||
| "vitest": "^4.0.18" | ||
| "undici": "^7.24.3", | ||
| "vitest": "^4.1.0" | ||
| }, | ||
@@ -104,3 +104,3 @@ "resolutions": { | ||
| }, | ||
| "packageManager": "pnpm@10.30.2" | ||
| "packageManager": "pnpm@10.32.1" | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
115482
-0.17%2553
-0.2%