/** * A GET that goes through the proxy the environment names — the same rule in * all five implementations. * * Node's `fetch` reads no proxy variable at all (not on the Node versions this * package supports), so behind a proxy that is the only way out — a corporate * network, a CI runner, an agent's sandbox — `tdcv2 pack add` went straight * for the registry and failed with two words, `fetch failed`, while npm and * curl worked on the same machine. The rule, as curl and npm read it: * * - An `https` address takes the first non-empty of `https_proxy`, * `HTTPS_PROXY`, `all_proxy`, `ALL_PROXY`; an `http` one `http_proxy`, * `HTTP_PROXY`, `all_proxy`, `ALL_PROXY`. * - `no_proxy` (or `NO_PROXY`) is a comma-separated list of hosts that go * direct: `*` for all, otherwise a host matches an entry it equals or ends * with after a dot, with a leading dot and a port ignored. * - A value with no scheme is an `http://` proxy. * * An `https` address is reached through an HTTP `CONNECT` tunnel, an `http` * one by asking the proxy for the absolute URL. Redirects are followed, as * `fetch` followed them. */ /** The proxy an address goes through, and the variable that named it. */ export interface ProxyChoice { /** The proxy as written, credentials included — what the request uses. */ readonly url: URL; /** `scheme://host:port`, the port always spelled out and the credentials left out. */ readonly shown: string; readonly variable: string; } /** A proxy value that is not an address, said in words the other four use too. */ export declare class ProxyAddressError extends Error { } /** Whether `host` is listed in `no_proxy` / `NO_PROXY`. */ export declare function bypassed(host: string, env?: NodeJS.ProcessEnv): boolean; /** The proxy for `target`, or `undefined` to go direct. */ export declare function proxyFor(target: URL, env?: NodeJS.ProcessEnv): ProxyChoice | undefined; /** A response that is not a 2xx, with its status for the caller to word. */ export declare class HttpStatusError extends Error { readonly status: number; readonly statusText: string; constructor(status: number, statusText: string); } /** * GET `address`, following redirects, through whatever proxy the environment * names for it. `onProgress(received, total)` sees the bytes as they arrive; * `total` is 0 when the server sends no length. * * Rejects with `HttpStatusError` for a non-2xx answer, `ProxyAddressError` for * a proxy variable that is not an address, and the network's own error * otherwise — `connect ECONNREFUSED 127.0.0.1:9`, `getaddrinfo ENOTFOUND host`. */ export declare function proxiedGet(address: string, onProgress?: (received: number, total: number) => void): Promise; //# sourceMappingURL=proxied-get.d.ts.map