import { describe, expect, it } from "vitest";
import { parseConnectTarget } from "./proxy-server.js";
describe("parseConnectTarget", () => {
it("parses bracketed IPv6 CONNECT targets safely", () => {
expect(parseConnectTarget("[::1]:8443")).toEqual({
hostname: "::1",
port: 8443,
});
});
it("parses unbracketed host:port CONNECT targets", () => {
expect(parseConnectTarget("api.openai.com:443")).toEqual({
hostname: "api.openai.com",
port: 443,
});
});
it("rejects invalid CONNECT ports", () => {
expect(() => parseConnectTarget("[::1]:99999")).toThrow("Invalid CONNECT target port");
});
});
| Messung V0.5 in Prozent |
|---|
| | | |
[Verzeichnis aufwärts0.19unsichere VerbindungÜbersetzung europäischer Sprachen durch Browser2026-06-09]