Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): provider updates on macOS use the system proxy #36301

Openjuliusmarmingewants to merge 4 commits intomain fromrefs/pull/36301/headopened View on GitHub

Showing 4 changed files with 141 additions and 0 deletions (loading 3).

x
0 of 4 viewed, 4 left
141 additions and 0 deletionsapps/server/src/provider/macosSystemProxy.test.tsAdded
View file
@@ -0,0 +1,141 @@
+import { assert, describe, it } from "@effect/vitest";
+​
+import { macosSystemProxyEnv } from "./macosSystemProxy.ts";
+​
+const PROXY = [
+ "HTTPEnable : 1",
+ "HTTPPort : 3128",
+ "HTTPProxy : proxy.corp",
+ "HTTPSEnable : 1",
+ "HTTPSPort : 3128",
+ "HTTPSProxy : proxy.corp",
+];
+​
+const scutil = (...lines: ReadonlyArray<string>) =>
+ ["<dictionary> {", ...lines.map((line) => ` ${line}`), "}", ""].join("\n");
+​
+const exceptions = (...hosts: ReadonlyArray<string>) => [
+ "ExceptionsList : <array> {",
+ ...hosts.map((host, index) => ` ${index} : ${host}`),
+ "}",
+];
+​
+// npm's matcher (@npmcli/agent): NO_PROXY entries are dot-separated suffixes, never ranges.
+function npmBypasses(noProxy: string, hostname: string): boolean {
+ const host = hostname.split(".").toReversed();
+ return noProxy.split(",").some((entry) => {
+ const segments = entry.split(".").filter(Boolean).toReversed();
+ return segments.length > 0 && segments.every((segment, index) => host[index] === segment);
+ });
+}