@stryke/http 0.12.14 → 0.12.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{chunk-Bmb41Sf3.cjs → _virtual/rolldown_runtime.cjs} +1 -1
  3. package/dist/agent.cjs +2 -1
  4. package/dist/agent.d.cts +40 -2
  5. package/dist/agent.d.cts.map +1 -0
  6. package/dist/agent.d.mts +40 -2
  7. package/dist/agent.d.mts.map +1 -0
  8. package/dist/agent.mjs +3 -1
  9. package/dist/agent.mjs.map +1 -0
  10. package/dist/fetch.cjs +1 -1
  11. package/dist/fetch.d.cts +24 -2
  12. package/dist/fetch.d.cts.map +1 -0
  13. package/dist/fetch.d.mts +24 -2
  14. package/dist/fetch.d.mts.map +1 -0
  15. package/dist/fetch.mjs +2 -1
  16. package/dist/fetch.mjs.map +1 -0
  17. package/dist/format-data-uri.cjs +1 -1
  18. package/dist/format-data-uri.d.cts +50 -2
  19. package/dist/format-data-uri.d.cts.map +1 -0
  20. package/dist/format-data-uri.d.mts +50 -2
  21. package/dist/format-data-uri.d.mts.map +1 -0
  22. package/dist/format-data-uri.mjs +2 -1
  23. package/dist/format-data-uri.mjs.map +1 -0
  24. package/dist/get-free-port.cjs +1 -1
  25. package/dist/get-free-port.d.cts +10 -2
  26. package/dist/get-free-port.d.cts.map +1 -0
  27. package/dist/get-free-port.d.mts +10 -2
  28. package/dist/get-free-port.d.mts.map +1 -0
  29. package/dist/get-free-port.mjs +2 -1
  30. package/dist/get-free-port.mjs.map +1 -0
  31. package/dist/http-proxy.cjs +3 -1
  32. package/dist/http-proxy.d.cts +40 -2
  33. package/dist/http-proxy.d.cts.map +1 -0
  34. package/dist/http-proxy.d.mts +40 -2
  35. package/dist/http-proxy.d.mts.map +1 -0
  36. package/dist/http-proxy.mjs +4 -1
  37. package/dist/http-proxy.mjs.map +1 -0
  38. package/dist/https-proxy.cjs +1 -1
  39. package/dist/https-proxy.d.cts +43 -2
  40. package/dist/https-proxy.d.cts.map +1 -0
  41. package/dist/https-proxy.d.mts +43 -2
  42. package/dist/https-proxy.d.mts.map +1 -0
  43. package/dist/https-proxy.mjs +2 -1
  44. package/dist/https-proxy.mjs.map +1 -0
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.d.cts +8 -8
  47. package/dist/index.d.mts +8 -8
  48. package/dist/index.mjs +1 -1
  49. package/dist/parse-response.cjs +4 -1
  50. package/dist/parse-response.d.cts +23 -2
  51. package/dist/parse-response.d.cts.map +1 -0
  52. package/dist/parse-response.d.mts +23 -2
  53. package/dist/parse-response.d.mts.map +1 -0
  54. package/dist/parse-response.mjs +5 -1
  55. package/dist/parse-response.mjs.map +1 -0
  56. package/dist/proxy-agent.cjs +1 -1
  57. package/dist/proxy-agent.d.cts +13 -2
  58. package/dist/proxy-agent.d.cts.map +1 -0
  59. package/dist/proxy-agent.d.mts +13 -2
  60. package/dist/proxy-agent.d.mts.map +1 -0
  61. package/dist/proxy-agent.mjs +2 -1
  62. package/dist/proxy-agent.mjs.map +1 -0
  63. package/dist/type-checks/src/index.cjs +1 -0
  64. package/dist/type-checks/src/index.mjs +1 -0
  65. package/dist/type-checks/src/is-boolean.cjs +1 -0
  66. package/dist/type-checks/src/is-boolean.mjs +2 -0
  67. package/dist/type-checks/src/is-boolean.mjs.map +1 -0
  68. package/dist/type-checks/src/is-buffer.cjs +1 -0
  69. package/dist/type-checks/src/is-buffer.mjs +2 -0
  70. package/dist/type-checks/src/is-buffer.mjs.map +1 -0
  71. package/dist/type-checks/src/is-collection.cjs +1 -0
  72. package/dist/type-checks/src/is-collection.mjs +1 -0
  73. package/dist/type-checks/src/is-empty.cjs +1 -0
  74. package/dist/type-checks/src/is-empty.mjs +2 -0
  75. package/dist/type-checks/src/is-empty.mjs.map +1 -0
  76. package/dist/type-checks/src/is-null.cjs +1 -0
  77. package/dist/type-checks/src/is-null.mjs +2 -0
  78. package/dist/type-checks/src/is-null.mjs.map +1 -0
  79. package/dist/type-checks/src/is-set-string.cjs +1 -0
  80. package/dist/type-checks/src/is-set-string.mjs +2 -0
  81. package/dist/type-checks/src/is-set-string.mjs.map +1 -0
  82. package/dist/type-checks/src/is-set.cjs +1 -0
  83. package/dist/type-checks/src/is-set.mjs +2 -0
  84. package/dist/type-checks/src/is-set.mjs.map +1 -0
  85. package/dist/type-checks/src/is-string.cjs +1 -0
  86. package/dist/type-checks/src/is-string.mjs +2 -0
  87. package/dist/type-checks/src/is-string.mjs.map +1 -0
  88. package/dist/type-checks/src/is-undefined.cjs +1 -0
  89. package/dist/type-checks/src/is-undefined.mjs +2 -0
  90. package/dist/type-checks/src/is-undefined.mjs.map +1 -0
  91. package/dist/type-checks/src/type-detect.cjs +1 -0
  92. package/dist/type-checks/src/type-detect.mjs +2 -0
  93. package/dist/type-checks/src/type-detect.mjs.map +1 -0
  94. package/dist/url/src/helpers.cjs +1 -0
  95. package/dist/url/src/helpers.mjs +2 -0
  96. package/dist/url/src/helpers.mjs.map +1 -0
  97. package/package.json +6 -6
  98. package/dist/agent-Cc4PYJ-j.d.cts +0 -40
  99. package/dist/agent-Cc4PYJ-j.d.cts.map +0 -1
  100. package/dist/agent-DKevd8Ll.cjs +0 -2
  101. package/dist/agent-DXIpD4O5.d.mts +0 -40
  102. package/dist/agent-DXIpD4O5.d.mts.map +0 -1
  103. package/dist/agent-DrFvt4od.mjs +0 -3
  104. package/dist/agent-DrFvt4od.mjs.map +0 -1
  105. package/dist/fetch-BYPFJG9Y.d.cts +0 -24
  106. package/dist/fetch-BYPFJG9Y.d.cts.map +0 -1
  107. package/dist/fetch-D3masEhH.d.mts +0 -24
  108. package/dist/fetch-D3masEhH.d.mts.map +0 -1
  109. package/dist/fetch-DXVSCX2B.cjs +0 -1
  110. package/dist/fetch-DgPaAZTB.mjs +0 -2
  111. package/dist/fetch-DgPaAZTB.mjs.map +0 -1
  112. package/dist/format-data-uri-B-rw3THu.d.cts +0 -50
  113. package/dist/format-data-uri-B-rw3THu.d.cts.map +0 -1
  114. package/dist/format-data-uri-C59EgrXn.cjs +0 -1
  115. package/dist/format-data-uri-D864kwXt.d.mts +0 -50
  116. package/dist/format-data-uri-D864kwXt.d.mts.map +0 -1
  117. package/dist/format-data-uri-WSwfftd0.mjs +0 -2
  118. package/dist/format-data-uri-WSwfftd0.mjs.map +0 -1
  119. package/dist/get-free-port-Bf-x1nt8.d.cts +0 -10
  120. package/dist/get-free-port-Bf-x1nt8.d.cts.map +0 -1
  121. package/dist/get-free-port-BwvXPXFs.d.mts +0 -10
  122. package/dist/get-free-port-BwvXPXFs.d.mts.map +0 -1
  123. package/dist/get-free-port-D9hjek4b.cjs +0 -1
  124. package/dist/get-free-port-DvWNGhhy.mjs +0 -2
  125. package/dist/get-free-port-DvWNGhhy.mjs.map +0 -1
  126. package/dist/http-proxy-CJqbqeZN.cjs +0 -3
  127. package/dist/http-proxy-ChUYEQ71.mjs +0 -4
  128. package/dist/http-proxy-ChUYEQ71.mjs.map +0 -1
  129. package/dist/http-proxy-CzvOBKWd.d.cts +0 -40
  130. package/dist/http-proxy-CzvOBKWd.d.cts.map +0 -1
  131. package/dist/http-proxy-DuPPyvFw.d.mts +0 -40
  132. package/dist/http-proxy-DuPPyvFw.d.mts.map +0 -1
  133. package/dist/https-proxy-B8w-jm17.d.cts +0 -43
  134. package/dist/https-proxy-B8w-jm17.d.cts.map +0 -1
  135. package/dist/https-proxy-f4-C_EL8.d.mts +0 -43
  136. package/dist/https-proxy-f4-C_EL8.d.mts.map +0 -1
  137. package/dist/https-proxy-k0GW_xX8.cjs +0 -1
  138. package/dist/https-proxy-rNc_8MiC.mjs +0 -2
  139. package/dist/https-proxy-rNc_8MiC.mjs.map +0 -1
  140. package/dist/parse-response-BRlQF_8K.cjs +0 -4
  141. package/dist/parse-response-CGkjN9j0.mjs +0 -5
  142. package/dist/parse-response-CGkjN9j0.mjs.map +0 -1
  143. package/dist/parse-response-CS657Hki.d.cts +0 -23
  144. package/dist/parse-response-CS657Hki.d.cts.map +0 -1
  145. package/dist/parse-response-ujHVHmwG.d.mts +0 -23
  146. package/dist/parse-response-ujHVHmwG.d.mts.map +0 -1
  147. package/dist/proxy-agent-BrxQeFy2.d.mts +0 -13
  148. package/dist/proxy-agent-BrxQeFy2.d.mts.map +0 -1
  149. package/dist/proxy-agent-CnWrJ59l.d.cts +0 -13
  150. package/dist/proxy-agent-CnWrJ59l.d.cts.map +0 -1
  151. package/dist/proxy-agent-DMsOloiQ.cjs +0 -1
  152. package/dist/proxy-agent-uGI03t_I.mjs +0 -2
  153. package/dist/proxy-agent-uGI03t_I.mjs.map +0 -1
@@ -1,43 +0,0 @@
1
- import * as http from "node:http";
2
- import { OutgoingHttpHeaders } from "node:http";
3
- import * as net from "node:net";
4
- import * as tls from "node:tls";
5
- import { URL } from "node:url";
6
- import { Agent, AgentConnectOpts } from "agent-base";
7
-
8
- //#region src/https-proxy.d.ts
9
- type Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
10
- interface ConnectOptsMap {
11
- http: Omit<net.TcpNetConnectOpts, "host" | "port">;
12
- https: Omit<tls.ConnectionOptions, "host" | "port">;
13
- }
14
- type ConnectOpts<T> = { [P in keyof ConnectOptsMap]: Protocol<T> extends P ? ConnectOptsMap[P] : never }[keyof ConnectOptsMap];
15
- type HttpsProxyAgentOptions<T> = ConnectOpts<T> & http.AgentOptions & {
16
- headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
17
- };
18
- /**
19
- * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
20
- * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
21
- *
22
- * Outgoing HTTP requests are first tunneled through the proxy server using the
23
- * `CONNECT` HTTP request method to establish a connection to the proxy server,
24
- * and then the proxy server connects to the destination target and issues the
25
- * HTTP request from the proxy server.
26
- *
27
- * `https:` requests have their socket connection upgraded to TLS once
28
- * the connection to the proxy server has been established.
29
- */
30
- declare class HttpsProxyAgent<Uri extends string> extends Agent {
31
- static protocols: readonly ["http", "https"];
32
- readonly proxy: URL;
33
- proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
34
- connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;
35
- constructor(proxy: Uri | URL, opts?: HttpsProxyAgentOptions<Uri>);
36
- /**
37
- * Called when the node-core HTTP client library is creating a new HTTP request.
38
- */
39
- connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<net.Socket>;
40
- }
41
- //#endregion
42
- export { HttpsProxyAgentOptions as n, HttpsProxyAgent as t };
43
- //# sourceMappingURL=https-proxy-f4-C_EL8.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"https-proxy-f4-C_EL8.d.mts","names":[],"sources":["../src/https-proxy.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA+CK,cAAc;AArBY,UAuBrB,cAAA,CAFG;EAEH,IAAA,EACF,IADE,CACG,GAAA,CAAI,iBADO,EAAA,MAAA,GAAA,MAAA,CAAA;EACX,KAAI,EACR,IADQ,CACH,GAAA,CAAI,iBADD,EAAA,MAAA,GAAA,MAAA,CAAA;;KAIZ,WAHa,CAAA,CAAA,CAAA,GAAA,QAAT,MAIK,cAJL,GAIsB,QAJtB,CAI+B,CAJ/B,CAAA,SAI0C,CAJ1C,GAKH,cALG,CAKY,CALZ,CAAA,GAAA,KAAA,EAAI,CAAA,MAOL,cAPK,CAAA;AAGR,KAMO,sBANI,CAAA,CAAA,CAAA,GAMwB,WANxB,CAMoC,CANpC,CAAA,GAOd,IAAA,CAAK,YAPS,GAAA;EACF,OAAA,CAAA,EAOA,mBAPA,GAAA,CAAA,GAAA,GAO6B,mBAP7B,CAAA;CAA0B;;;;;;;AAKxC;;;;;;AAE8D,cAejD,eAfiD,CAAA,YAAA,MAAA,CAAA,SAeL,KAAA,CAfK;EAejD,OAAA,SAAA,EAAe,SAAA,CAAA,MAAA,EAAA,OAAA,CAAA;EAGV,SAAA,KAAA,EAAA,GAAA;EAEF,YAAA,EAAA,mBAAA,GAAA,CAAA,GAAA,GAA6B,mBAA7B,CAAA;EAA6B,WAAA,EAE9B,GAAA,CAAI,iBAF0B,GAEN,GAAA,CAAI,iBAFE;EAE9B,WAAI,CAAA,KAAA,EAEE,GAFF,GAEQ,GAFR,EAAA,IAAA,CAAA,EAEoB,sBAFpB,CAE2C,GAF3C,CAAA;EAAoB;;;EAEuB,OAAA,CAAA,GAAA,EA6BrD,IAAA,CAAK,aA7BgD,EAAA,IAAA,EA8BpD,gBA9BoD,CAAA,EA+BzD,OA/ByD,CA+BjD,GAAA,CAAI,MA/B6C,CAAA"}
@@ -1 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./parse-response-BRlQF_8K.cjs`);let n=require(`node:net`);n=e.t(n);let r=require(`node:buffer`),i=require(`node:tls`);i=e.t(i);let a=require(`node:url`),o=require(`agent-base`),s=require(`node:assert`);s=e.t(s);const c=e=>e.servername===void 0&&e.host&&!n.isIP(e.host)?{...e,servername:e.host}:e;var l=class extends o.Agent{static protocols=[`http`,`https`];proxy;proxyHeaders;connectOpts;constructor(e,t){super(t),this.options={path:void 0},this.proxy=typeof e==`string`?new a.URL(e):e,this.proxyHeaders=t?.headers??{};let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?Number.parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?d(t,`headers`):null,host:n,port:r}}async connect(e,a){let{proxy:o}=this;if(!a.host)throw TypeError(`No "host" provided`);let l;l=o.protocol===`https:`?i.connect(c(this.connectOpts)):n.connect(this.connectOpts);let f=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},p=n.isIPv6(a.host)?`[${a.host}]`:a.host,m=`CONNECT ${p}:${a.port} HTTP/1.1\r\n`;if(o.username||o.password){let e=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;f[`Proxy-Authorization`]=`Basic ${r.Buffer.from(e).toString(`base64`)}`}f.Host=`${p}:${a.port}`,f[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(f))m+=`${e}: ${f[e]?.toString()}\r\n`;let h=t.t(l);l.write(`${m}\r\n`);let{connect:g,buffered:_}=await h;if(e.emit(`proxyConnect`,g),this.emit(`proxyConnect`,g,e),g.statusCode===200)return e.once(`socket`,u),a.secureEndpoint?i.connect({...d(c(a),`host`,`path`,`port`),socket:l}):l;l.destroy();let v=new n.Socket({writable:!1});return v.readable=!0,e.once(`socket`,e=>{(0,s.default)(e.listenerCount(`data`)>0),e.push(_),e.push(null)}),v}};function u(e){e.resume()}function d(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
@@ -1,2 +0,0 @@
1
- import{t as e}from"./parse-response-CGkjN9j0.mjs";import*as t from"node:net";import{Buffer as n}from"node:buffer";import*as r from"node:tls";import{URL as i}from"node:url";import{Agent as a}from"agent-base";import o from"node:assert";const s=e=>e.servername===void 0&&e.host&&!t.isIP(e.host)?{...e,servername:e.host}:e;var c=class extends a{static protocols=[`http`,`https`];proxy;proxyHeaders;connectOpts;constructor(e,t){super(t),this.options={path:void 0},this.proxy=typeof e==`string`?new i(e):e,this.proxyHeaders=t?.headers??{};let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?Number.parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?u(t,`headers`):null,host:n,port:r}}async connect(i,a){let{proxy:c}=this;if(!a.host)throw TypeError(`No "host" provided`);let d;d=c.protocol===`https:`?r.connect(s(this.connectOpts)):t.connect(this.connectOpts);let f=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},p=t.isIPv6(a.host)?`[${a.host}]`:a.host,m=`CONNECT ${p}:${a.port} HTTP/1.1\r\n`;if(c.username||c.password){let e=`${decodeURIComponent(c.username)}:${decodeURIComponent(c.password)}`;f[`Proxy-Authorization`]=`Basic ${n.from(e).toString(`base64`)}`}f.Host=`${p}:${a.port}`,f[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(f))m+=`${e}: ${f[e]?.toString()}\r\n`;let h=e(d);d.write(`${m}\r\n`);let{connect:g,buffered:_}=await h;if(i.emit(`proxyConnect`,g),this.emit(`proxyConnect`,g,i),g.statusCode===200)return i.once(`socket`,l),a.secureEndpoint?r.connect({...u(s(a),`host`,`path`,`port`),socket:d}):d;d.destroy();let v=new t.Socket({writable:!1});return v.readable=!0,i.once(`socket`,e=>{o(e.listenerCount(`data`)>0),e.push(_),e.push(null)}),v}};function l(e){e.resume()}function u(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}export{c as t};
2
- //# sourceMappingURL=https-proxy-rNc_8MiC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"https-proxy-rNc_8MiC.mjs","names":["socket: net.Socket","headers: OutgoingHttpHeaders","key: keyof typeof obj"],"sources":["../src/https-proxy.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AgentConnectOpts } from \"agent-base\";\nimport { Agent } from \"agent-base\";\nimport assert from \"node:assert\";\nimport { Buffer } from \"node:buffer\";\nimport type * as http from \"node:http\";\nimport type { OutgoingHttpHeaders } from \"node:http\";\nimport * as net from \"node:net\";\nimport * as tls from \"node:tls\";\nimport { URL } from \"node:url\";\nimport { parseProxyResponse } from \"./parse-response\";\n\nconst setServernameFromNonIpHost = <\n T extends { host?: string; servername?: string }\n>(\n options: T\n) => {\n if (\n options.servername === undefined &&\n options.host &&\n !net.isIP(options.host)\n ) {\n return {\n ...options,\n servername: options.host\n };\n }\n return options;\n};\n\ntype Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;\n\ninterface ConnectOptsMap {\n http: Omit<net.TcpNetConnectOpts, \"host\" | \"port\">;\n https: Omit<tls.ConnectionOptions, \"host\" | \"port\">;\n}\n\ntype ConnectOpts<T> = {\n [P in keyof ConnectOptsMap]: Protocol<T> extends P\n ? ConnectOptsMap[P]\n : never;\n}[keyof ConnectOptsMap];\n\nexport type HttpsProxyAgentOptions<T> = ConnectOpts<T> &\n http.AgentOptions & {\n headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);\n };\n\n/**\n * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to\n * the specified \"HTTP(s) proxy server\" in order to proxy HTTPS requests.\n *\n * Outgoing HTTP requests are first tunneled through the proxy server using the\n * `CONNECT` HTTP request method to establish a connection to the proxy server,\n * and then the proxy server connects to the destination target and issues the\n * HTTP request from the proxy server.\n *\n * `https:` requests have their socket connection upgraded to TLS once\n * the connection to the proxy server has been established.\n */\nexport class HttpsProxyAgent<Uri extends string> extends Agent {\n static protocols = [\"http\", \"https\"] as const;\n\n readonly proxy: URL;\n\n proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);\n\n connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;\n\n constructor(proxy: Uri | URL, opts?: HttpsProxyAgentOptions<Uri>) {\n super(opts);\n this.options = { path: undefined };\n this.proxy = typeof proxy === \"string\" ? new URL(proxy) : proxy;\n this.proxyHeaders = opts?.headers ?? {};\n\n // Trim off the brackets from IPv6 addresses\n const host = (this.proxy.hostname || this.proxy.host).replace(\n /^\\[|\\]$/g,\n \"\"\n );\n const port = this.proxy.port\n ? Number.parseInt(this.proxy.port, 10)\n : this.proxy.protocol === \"https:\"\n ? 443\n : 80;\n this.connectOpts = {\n // Attempt to negotiate http/1.1 for proxy servers that support http/2\n ALPNProtocols: [\"http/1.1\"],\n ...(opts ? omit(opts, \"headers\") : null),\n host,\n port\n };\n }\n\n /**\n * Called when the node-core HTTP client library is creating a new HTTP request.\n */\n async connect(\n req: http.ClientRequest,\n opts: AgentConnectOpts\n ): Promise<net.Socket> {\n const { proxy } = this;\n\n if (!opts.host) {\n throw new TypeError('No \"host\" provided');\n }\n\n // Create a socket connection to the proxy server.\n let socket: net.Socket;\n if (proxy.protocol === \"https:\") {\n socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));\n } else {\n socket = net.connect(this.connectOpts);\n }\n\n const headers: OutgoingHttpHeaders =\n typeof this.proxyHeaders === \"function\"\n ? this.proxyHeaders()\n : { ...this.proxyHeaders };\n const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;\n let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\\r\\n`;\n\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.username || proxy.password) {\n const auth = `${decodeURIComponent(\n proxy.username\n )}:${decodeURIComponent(proxy.password)}`;\n headers[\"Proxy-Authorization\"] = `Basic ${Buffer.from(auth).toString(\n \"base64\"\n )}`;\n }\n\n headers.Host = `${host}:${opts.port}`;\n\n if (!headers[\"Proxy-Connection\"]) {\n headers[\"Proxy-Connection\"] = this.keepAlive ? \"Keep-Alive\" : \"close\";\n }\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]?.toString()}\\r\\n`;\n }\n\n const proxyResponsePromise = parseProxyResponse(socket);\n\n socket.write(`${payload}\\r\\n`);\n\n const { connect, buffered } = await proxyResponsePromise;\n req.emit(\"proxyConnect\", connect);\n this.emit(\"proxyConnect\", connect, req);\n\n if (connect.statusCode === 200) {\n req.once(\"socket\", resume);\n\n if (opts.secureEndpoint) {\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n return tls.connect({\n ...omit(setServernameFromNonIpHost(opts), \"host\", \"path\", \"port\"),\n socket\n });\n }\n\n return socket;\n }\n\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n\n const fakeSocket = new net.Socket({ writable: false });\n fakeSocket.readable = true;\n\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once(\"socket\", (s: net.Socket) => {\n assert(s.listenerCount(\"data\") > 0);\n\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n\n return fakeSocket;\n }\n}\n\nfunction resume(socket: net.Socket | tls.TLSSocket): void {\n socket.resume();\n}\n\nfunction omit<T extends object, K extends [...(keyof T)[]]>(\n obj: T,\n ...keys: K\n): {\n [K2 in Exclude<keyof T, K[number]>]: T[K2];\n} {\n const ret = {} as {\n [K in keyof typeof obj]: (typeof obj)[K];\n };\n let key: keyof typeof obj;\n for (key in obj) {\n if (!keys.includes(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n}\n"],"mappings":"0OA6BA,MAAM,EAGJ,GAGE,EAAQ,aAAe,IAAA,IACvB,EAAQ,MACR,CAAC,EAAI,KAAK,EAAQ,KAAK,CAEhB,CACL,GAAG,EACH,WAAY,EAAQ,KACrB,CAEI,EAiCT,IAAa,EAAb,cAAyD,CAAM,CAC7D,OAAO,UAAY,CAAC,OAAQ,QAAQ,CAEpC,MAEA,aAEA,YAEA,YAAY,EAAkB,EAAoC,CAChE,MAAM,EAAK,CACX,KAAK,QAAU,CAAE,KAAM,IAAA,GAAW,CAClC,KAAK,MAAQ,OAAO,GAAU,SAAW,IAAI,EAAI,EAAM,CAAG,EAC1D,KAAK,aAAe,GAAM,SAAW,EAAE,CAGvC,IAAM,GAAQ,KAAK,MAAM,UAAY,KAAK,MAAM,MAAM,QACpD,WACA,GACD,CACK,EAAO,KAAK,MAAM,KACpB,OAAO,SAAS,KAAK,MAAM,KAAM,GAAG,CACpC,KAAK,MAAM,WAAa,SACtB,IACA,GACN,KAAK,YAAc,CAEjB,cAAe,CAAC,WAAW,CAC3B,GAAI,EAAO,EAAK,EAAM,UAAU,CAAG,KACnC,OACA,OACD,CAMH,MAAM,QACJ,EACA,EACqB,CACrB,GAAM,CAAE,SAAU,KAElB,GAAI,CAAC,EAAK,KACR,MAAU,UAAU,qBAAqB,CAI3C,IAAIA,EACJ,AAGE,EAHE,EAAM,WAAa,SACZ,EAAI,QAAQ,EAA2B,KAAK,YAAY,CAAC,CAEzD,EAAI,QAAQ,KAAK,YAAY,CAGxC,IAAMC,EACJ,OAAO,KAAK,cAAiB,WACzB,KAAK,cAAc,CACnB,CAAE,GAAG,KAAK,aAAc,CACxB,EAAO,EAAI,OAAO,EAAK,KAAK,CAAG,IAAI,EAAK,KAAK,GAAK,EAAK,KACzD,EAAU,WAAW,EAAK,GAAG,EAAK,KAAK,eAG3C,GAAI,EAAM,UAAY,EAAM,SAAU,CACpC,IAAM,EAAO,GAAG,mBACd,EAAM,SACP,CAAC,GAAG,mBAAmB,EAAM,SAAS,GACvC,EAAQ,uBAAyB,SAAS,EAAO,KAAK,EAAK,CAAC,SAC1D,SACD,GAGH,EAAQ,KAAO,GAAG,EAAK,GAAG,EAAK,OAE/B,AACE,EAAQ,sBAAsB,KAAK,UAAY,aAAe,QAEhE,IAAK,IAAM,KAAQ,OAAO,KAAK,EAAQ,CACrC,GAAW,GAAG,EAAK,IAAI,EAAQ,IAAO,UAAU,CAAC,MAGnD,IAAM,EAAuB,EAAmB,EAAO,CAEvD,EAAO,MAAM,GAAG,EAAQ,MAAM,CAE9B,GAAM,CAAE,UAAS,YAAa,MAAM,EAIpC,GAHA,EAAI,KAAK,eAAgB,EAAQ,CACjC,KAAK,KAAK,eAAgB,EAAS,EAAI,CAEnC,EAAQ,aAAe,IAYzB,OAXA,EAAI,KAAK,SAAU,EAAO,CAEtB,EAAK,eAGA,EAAI,QAAQ,CACjB,GAAG,EAAK,EAA2B,EAAK,CAAE,OAAQ,OAAQ,OAAO,CACjE,SACD,CAAC,CAGG,EAcT,EAAO,SAAS,CAEhB,IAAM,EAAa,IAAI,EAAI,OAAO,CAAE,SAAU,GAAO,CAAC,CActD,MAbA,GAAW,SAAW,GAGtB,EAAI,KAAK,SAAW,GAAkB,CACpC,EAAO,EAAE,cAAc,OAAO,CAAG,EAAE,CAKnC,EAAE,KAAK,EAAS,CAChB,EAAE,KAAK,KAAK,EACZ,CAEK,IAIX,SAAS,EAAO,EAA0C,CACxD,EAAO,QAAQ,CAGjB,SAAS,EACP,EACA,GAAG,EAGH,CACA,IAAM,EAAM,EAAE,CAGVC,EACJ,IAAK,KAAO,EACL,EAAK,SAAS,EAAI,GACrB,EAAI,GAAO,EAAI,IAGnB,OAAO"}
@@ -1,4 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:buffer`);async function n(e){return new Promise((n,r)=>{let i=0,a=[];function o(){let t=e.read();t?u(t):e.once(`readable`,o)}function s(){e.removeListener(`end`,c),e.removeListener(`error`,l),e.removeListener(`readable`,o)}function c(){s(),r(Error(`Proxy connection ended before receiving CONNECT response`))}function l(e){s(),r(e)}function u(c){a.push(c),i+=c.length;let l=t.Buffer.concat(a,i),u=l.indexOf(`\r
2
- \r
3
- `);if(u===-1){o();return}let d=l.subarray(0,u).toString(`ascii`).split(`\r
4
- `),f=d.shift();if(!f)return e.destroy(),r(Error(`No header received from proxy CONNECT response`));let p=f.split(` `),m=+p[1],h=p.slice(2).join(` `),g={};for(let t of d){if(!t)continue;let n=t.indexOf(`:`);if(n===-1)return e.destroy(),r(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,n).toLowerCase(),a=t.slice(n+1).trimStart(),o=g[i];typeof o==`string`?g[i]=[o,a]:Array.isArray(o)?o.push(a):g[i]=a}s(),n({connect:{statusCode:m,statusText:h,headers:g},buffered:l})}e.on(`error`,l),e.on(`end`,c),o()})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
@@ -1,5 +0,0 @@
1
- import{Buffer as e}from"node:buffer";async function t(t){return new Promise((n,r)=>{let i=0,a=[];function o(){let e=t.read();e?u(e):t.once(`readable`,o)}function s(){t.removeListener(`end`,c),t.removeListener(`error`,l),t.removeListener(`readable`,o)}function c(){s(),r(Error(`Proxy connection ended before receiving CONNECT response`))}function l(e){s(),r(e)}function u(c){a.push(c),i+=c.length;let l=e.concat(a,i),u=l.indexOf(`\r
2
- \r
3
- `);if(u===-1){o();return}let d=l.subarray(0,u).toString(`ascii`).split(`\r
4
- `),f=d.shift();if(!f)return t.destroy(),r(Error(`No header received from proxy CONNECT response`));let p=f.split(` `),m=+p[1],h=p.slice(2).join(` `),g={};for(let e of d){if(!e)continue;let n=e.indexOf(`:`);if(n===-1)return t.destroy(),r(Error(`Invalid header from proxy CONNECT response: "${e}"`));let i=e.slice(0,n).toLowerCase(),a=e.slice(n+1).trimStart(),o=g[i];typeof o==`string`?g[i]=[o,a]:Array.isArray(o)?o.push(a):g[i]=a}s(),n({connect:{statusCode:m,statusText:h,headers:g},buffered:l})}t.on(`error`,l),t.on(`end`,c),o()})}export{t};
5
- //# sourceMappingURL=parse-response-CGkjN9j0.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-response-CGkjN9j0.mjs","names":["buffers: Buffer[]","headers: IncomingHttpHeaders"],"sources":["../src/parse-response.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Buffer } from \"node:buffer\";\nimport type { IncomingHttpHeaders } from \"node:http\";\nimport type { Readable } from \"node:stream\";\n\nexport interface ConnectResponse {\n statusCode: number;\n statusText: string;\n headers: IncomingHttpHeaders;\n}\n\n/**\n * Parses the proxy CONNECT response from the given socket.\n *\n * @param socket - The socket to read the response from.\n * @returns A promise that resolves to the CONNECT response and any buffered data.\n */\nexport async function parseProxyResponse(\n socket: Readable\n): Promise<{ connect: ConnectResponse; buffered: Buffer }> {\n return new Promise((resolve, reject) => {\n // we need to buffer any HTTP traffic that happens with the proxy before we get\n // the CONNECT response, so that if the response is anything other than an \"200\"\n // response code, then we can re-play the \"data\" events on the socket once the\n // HTTP parser is hooked up...\n let buffersLength = 0;\n const buffers: Buffer[] = [];\n\n function read() {\n const b = socket.read();\n if (b) ondata(b);\n else socket.once(\"readable\", read);\n }\n\n function cleanup() {\n socket.removeListener(\"end\", onend);\n socket.removeListener(\"error\", onerror);\n socket.removeListener(\"readable\", read);\n }\n\n function onend() {\n cleanup();\n reject(\n new Error(\"Proxy connection ended before receiving CONNECT response\")\n );\n }\n\n function onerror(err: Error) {\n cleanup();\n reject(err);\n }\n\n function ondata(b: Buffer) {\n buffers.push(b);\n buffersLength += b.length;\n\n const buffered = Buffer.concat(buffers, buffersLength);\n const endOfHeaders = buffered.indexOf(\"\\r\\n\\r\\n\");\n\n if (endOfHeaders === -1) {\n // keep buffering\n read();\n return;\n }\n\n const headerParts = buffered\n .subarray(0, endOfHeaders)\n .toString(\"ascii\")\n .split(\"\\r\\n\");\n const firstLine = headerParts.shift();\n if (!firstLine) {\n socket.destroy();\n return reject(\n new Error(\"No header received from proxy CONNECT response\")\n );\n }\n const firstLineParts = firstLine.split(\" \");\n const statusCode = +firstLineParts[1]!;\n const statusText = firstLineParts.slice(2).join(\" \");\n const headers: IncomingHttpHeaders = {};\n for (const header of headerParts) {\n if (!header) continue;\n const firstColon = header.indexOf(\":\");\n if (firstColon === -1) {\n socket.destroy();\n return reject(\n new Error(`Invalid header from proxy CONNECT response: \"${header}\"`)\n );\n }\n const key = header.slice(0, firstColon).toLowerCase();\n const value = header.slice(firstColon + 1).trimStart();\n const current = headers[key];\n if (typeof current === \"string\") {\n headers[key] = [current, value];\n } else if (Array.isArray(current)) {\n current.push(value);\n } else {\n headers[key] = value;\n }\n }\n\n cleanup();\n resolve({\n connect: {\n statusCode,\n statusText,\n headers\n },\n buffered\n });\n }\n\n socket.on(\"error\", onerror);\n socket.on(\"end\", onend);\n\n read();\n });\n}\n"],"mappings":"qCAkCA,eAAsB,EACpB,EACyD,CACzD,OAAO,IAAI,SAAS,EAAS,IAAW,CAKtC,IAAI,EAAgB,EACdA,EAAoB,EAAE,CAE5B,SAAS,GAAO,CACd,IAAM,EAAI,EAAO,MAAM,CACnB,EAAG,EAAO,EAAE,CACX,EAAO,KAAK,WAAY,EAAK,CAGpC,SAAS,GAAU,CACjB,EAAO,eAAe,MAAO,EAAM,CACnC,EAAO,eAAe,QAAS,EAAQ,CACvC,EAAO,eAAe,WAAY,EAAK,CAGzC,SAAS,GAAQ,CACf,GAAS,CACT,EACM,MAAM,2DAA2D,CACtE,CAGH,SAAS,EAAQ,EAAY,CAC3B,GAAS,CACT,EAAO,EAAI,CAGb,SAAS,EAAO,EAAW,CACzB,EAAQ,KAAK,EAAE,CACf,GAAiB,EAAE,OAEnB,IAAM,EAAW,EAAO,OAAO,EAAS,EAAc,CAChD,EAAe,EAAS,QAAQ;;EAAW,CAEjD,GAAI,IAAiB,GAAI,CAEvB,GAAM,CACN,OAGF,IAAM,EAAc,EACjB,SAAS,EAAG,EAAa,CACzB,SAAS,QAAQ,CACjB,MAAM;EAAO,CACV,EAAY,EAAY,OAAO,CACrC,GAAI,CAAC,EAEH,OADA,EAAO,SAAS,CACT,EACD,MAAM,iDAAiD,CAC5D,CAEH,IAAM,EAAiB,EAAU,MAAM,IAAI,CACrC,EAAa,CAAC,EAAe,GAC7B,EAAa,EAAe,MAAM,EAAE,CAAC,KAAK,IAAI,CAC9CC,EAA+B,EAAE,CACvC,IAAK,IAAM,KAAU,EAAa,CAChC,GAAI,CAAC,EAAQ,SACb,IAAM,EAAa,EAAO,QAAQ,IAAI,CACtC,GAAI,IAAe,GAEjB,OADA,EAAO,SAAS,CACT,EACD,MAAM,gDAAgD,EAAO,GAAG,CACrE,CAEH,IAAM,EAAM,EAAO,MAAM,EAAG,EAAW,CAAC,aAAa,CAC/C,EAAQ,EAAO,MAAM,EAAa,EAAE,CAAC,WAAW,CAChD,EAAU,EAAQ,GACpB,OAAO,GAAY,SACrB,EAAQ,GAAO,CAAC,EAAS,EAAM,CACtB,MAAM,QAAQ,EAAQ,CAC/B,EAAQ,KAAK,EAAM,CAEnB,EAAQ,GAAO,EAInB,GAAS,CACT,EAAQ,CACN,QAAS,CACP,aACA,aACA,UACD,CACD,WACD,CAAC,CAGJ,EAAO,GAAG,QAAS,EAAQ,CAC3B,EAAO,GAAG,MAAO,EAAM,CAEvB,GAAM,EACN"}
@@ -1,23 +0,0 @@
1
- import { IncomingHttpHeaders } from "node:http";
2
- import { Readable } from "node:stream";
3
- import { Buffer } from "node:buffer";
4
-
5
- //#region src/parse-response.d.ts
6
- interface ConnectResponse {
7
- statusCode: number;
8
- statusText: string;
9
- headers: IncomingHttpHeaders;
10
- }
11
- /**
12
- * Parses the proxy CONNECT response from the given socket.
13
- *
14
- * @param socket - The socket to read the response from.
15
- * @returns A promise that resolves to the CONNECT response and any buffered data.
16
- */
17
- declare function parseProxyResponse(socket: Readable): Promise<{
18
- connect: ConnectResponse;
19
- buffered: Buffer;
20
- }>;
21
- //#endregion
22
- export { parseProxyResponse as n, ConnectResponse as t };
23
- //# sourceMappingURL=parse-response-CS657Hki.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-response-CS657Hki.d.cts","names":[],"sources":["../src/parse-response.ts"],"sourcesContent":[],"mappings":";;;;;UAsBiB,eAAA;;EAAA,UAAA,EAAA,MAAe;EAYV,OAAA,EATX,mBAS6B;;;;;;;;iBAAlB,kBAAA,SACZ,WACP;WAAmB;YAA2B"}
@@ -1,23 +0,0 @@
1
- import { IncomingHttpHeaders } from "node:http";
2
- import { Buffer } from "node:buffer";
3
- import { Readable } from "node:stream";
4
-
5
- //#region src/parse-response.d.ts
6
- interface ConnectResponse {
7
- statusCode: number;
8
- statusText: string;
9
- headers: IncomingHttpHeaders;
10
- }
11
- /**
12
- * Parses the proxy CONNECT response from the given socket.
13
- *
14
- * @param socket - The socket to read the response from.
15
- * @returns A promise that resolves to the CONNECT response and any buffered data.
16
- */
17
- declare function parseProxyResponse(socket: Readable): Promise<{
18
- connect: ConnectResponse;
19
- buffered: Buffer;
20
- }>;
21
- //#endregion
22
- export { parseProxyResponse as n, ConnectResponse as t };
23
- //# sourceMappingURL=parse-response-ujHVHmwG.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-response-ujHVHmwG.d.mts","names":[],"sources":["../src/parse-response.ts"],"sourcesContent":[],"mappings":";;;;;UAsBiB,eAAA;;EAAA,UAAA,EAAA,MAAe;EAYV,OAAA,EATX,mBAS6B;;;;;;;;iBAAlB,kBAAA,SACZ,WACP;WAAmB;YAA2B"}
@@ -1,13 +0,0 @@
1
- import { Agent } from "node:https";
2
-
3
- //#region src/proxy-agent.d.ts
4
-
5
- /**
6
- * If the http(s)_proxy environment variables is set, return a proxy agent.
7
- *
8
- * @returns The proxy agent or undefined if no proxy is set.
9
- */
10
- declare function getProxyAgent(): Agent | undefined;
11
- //#endregion
12
- export { getProxyAgent as t };
13
- //# sourceMappingURL=proxy-agent-BrxQeFy2.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy-agent-BrxQeFy2.d.mts","names":[],"sources":["../src/proxy-agent.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;iBAAgB,aAAA,CAAA,GAAiB"}
@@ -1,13 +0,0 @@
1
- import { Agent } from "node:https";
2
-
3
- //#region src/proxy-agent.d.ts
4
-
5
- /**
6
- * If the http(s)_proxy environment variables is set, return a proxy agent.
7
- *
8
- * @returns The proxy agent or undefined if no proxy is set.
9
- */
10
- declare function getProxyAgent(): Agent | undefined;
11
- //#endregion
12
- export { getProxyAgent as t };
13
- //# sourceMappingURL=proxy-agent-CnWrJ59l.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy-agent-CnWrJ59l.d.cts","names":[],"sources":["../src/proxy-agent.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;iBAAgB,aAAA,CAAA,GAAiB"}
@@ -1 +0,0 @@
1
- const e=require(`./http-proxy-CJqbqeZN.cjs`),t=require(`./https-proxy-k0GW_xX8.cjs`);function n(){let n=process.env.https_proxy||process.env.HTTPS_PROXY;if(n)return new t.t(n);let r=process.env.http_proxy||process.env.HTTP_PROXY;if(r)return new e.t(r)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
@@ -1,2 +0,0 @@
1
- import{t as e}from"./http-proxy-ChUYEQ71.mjs";import{t}from"./https-proxy-rNc_8MiC.mjs";function n(){let n=process.env.https_proxy||process.env.HTTPS_PROXY;if(n)return new t(n);let r=process.env.http_proxy||process.env.HTTP_PROXY;if(r)return new e(r)}export{n as t};
2
- //# sourceMappingURL=proxy-agent-uGI03t_I.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy-agent-uGI03t_I.mjs","names":[],"sources":["../src/proxy-agent.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Agent } from \"node:https\";\nimport { HttpProxyAgent } from \"./http-proxy\";\nimport { HttpsProxyAgent } from \"./https-proxy\";\n\n/**\n * If the http(s)_proxy environment variables is set, return a proxy agent.\n *\n * @returns The proxy agent or undefined if no proxy is set.\n */\nexport function getProxyAgent(): Agent | undefined {\n const httpsProxy = process.env.https_proxy || process.env.HTTPS_PROXY;\n if (httpsProxy) {\n return new HttpsProxyAgent(httpsProxy);\n }\n\n const httpProxy = process.env.http_proxy || process.env.HTTP_PROXY;\n if (httpProxy) {\n return new HttpProxyAgent(httpProxy);\n }\n\n return undefined;\n}\n"],"mappings":"wFA2BA,SAAgB,GAAmC,CACjD,IAAM,EAAa,QAAQ,IAAI,aAAe,QAAQ,IAAI,YAC1D,GAAI,EACF,OAAO,IAAI,EAAgB,EAAW,CAGxC,IAAM,EAAY,QAAQ,IAAI,YAAc,QAAQ,IAAI,WACxD,GAAI,EACF,OAAO,IAAI,EAAe,EAAU"}