@mablhq/mabl-cli 2.79.1 → 2.79.9

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.
@@ -37,8 +37,11 @@ function axiosProxyConfig(httpConfig) {
37
37
  }
38
38
  return maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType);
39
39
  }
40
- function escapeRegexDots(input) {
41
- return input.replace('.', '\\.');
40
+ function removeIpv6Brackets(input) {
41
+ if (input.startsWith('[') && input.endsWith(']')) {
42
+ return input.slice(1, -1);
43
+ }
44
+ return input;
42
45
  }
43
46
  function proxyUrlToPortConfig(proxyUrl) {
44
47
  const defaultPort = proxyUrl.protocol === 'https:' ? 443 : 80;
@@ -46,9 +49,7 @@ function proxyUrlToPortConfig(proxyUrl) {
46
49
  const portNumber = maybePortNumberMatch
47
50
  ? parseInt(maybePortNumberMatch)
48
51
  : defaultPort;
49
- let hostname = proxyUrl.hostname +
50
- (proxyUrl.search ? proxyUrl.pathname + proxyUrl.search : proxyUrl.pathname);
51
- hostname = hostname.replace(new RegExp(`${escapeRegexDots(proxyUrl.hostname)}/$`), proxyUrl.hostname);
52
+ const hostname = removeIpv6Brackets(proxyUrl.hostname);
52
53
  const config = {
53
54
  host: hostname,
54
55
  port: portNumber,
@@ -70,18 +71,33 @@ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, _proxyType)
70
71
  };
71
72
  newConfig.proxy = false;
72
73
  const authConfig = config.proxy.auth;
73
- let proxyString = 'http://';
74
+ let proxyString = `${config.proxy?.protocol || 'http:'}//`;
74
75
  if (authConfig) {
75
76
  proxyString += `${authConfig.username}:${authConfig.password}@`;
76
77
  }
77
- proxyString += `${config.proxy.host}:${config.proxy.port}`;
78
+ if (config.proxy.host.includes(':')) {
79
+ proxyString += `[${config.proxy.host}]`;
80
+ }
81
+ else {
82
+ proxyString += config.proxy.host;
83
+ }
84
+ proxyString += `:${config.proxy.port}`;
85
+ const parsedProxyUrl = new URL(proxyString);
86
+ const hostname = removeIpv6Brackets(parsedProxyUrl.hostname);
87
+ const proxyUrl = {
88
+ hostname,
89
+ port: parsedProxyUrl.port,
90
+ protocol: parsedProxyUrl.protocol,
91
+ username: parsedProxyUrl.username,
92
+ password: parsedProxyUrl.password,
93
+ };
78
94
  const rejectUnauthorized = sslVerify === true;
79
95
  const httpAgentConfig = {
80
96
  keepAlive: true,
81
97
  keepAliveMsecs: 1000,
82
98
  maxSockets: 256,
83
99
  maxFreeSockets: 256,
84
- proxy: proxyString,
100
+ proxy: proxyUrl,
85
101
  proxyRequestOptions: {
86
102
  rejectUnauthorized,
87
103
  },
@@ -90,6 +106,14 @@ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, _proxyType)
90
106
  ...httpAgentConfig,
91
107
  rejectUnauthorized,
92
108
  };
109
+ console.log('Using proxy agent configuration', {
110
+ ...httpsAgentConfig,
111
+ proxy: {
112
+ ...proxyUrl,
113
+ username: proxyUrl.username ? '*****' : undefined,
114
+ password: proxyUrl.password ? '*****' : undefined,
115
+ },
116
+ });
93
117
  newConfig.httpsAgent = new hpagent_1.HttpsProxyAgent(httpsAgentConfig);
94
118
  newConfig.httpAgent = new hpagent_1.HttpProxyAgent(httpAgentConfig);
95
119
  return newConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mablhq/mabl-cli",
3
- "version": "2.79.1",
3
+ "version": "2.79.9",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The official mabl command line interface tool",
6
6
  "main": "index.js",