playwright-core 1.57.0-alpha-2025-10-08 → 1.57.0-alpha-2025-10-09

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.
@@ -58,8 +58,8 @@ function httpRequest(params, onResponse, onError) {
58
58
  options.rejectUnauthorized = params.rejectUnauthorized;
59
59
  const proxyURL = (0, import_utilsBundle.getProxyForUrl)(params.url);
60
60
  if (proxyURL) {
61
- const parsedProxyURL = import_url.default.parse(proxyURL);
62
61
  if (params.url.startsWith("http:")) {
62
+ const parsedProxyURL = import_url.default.parse(proxyURL);
63
63
  options = {
64
64
  path: parsedUrl.href,
65
65
  host: parsedProxyURL.hostname,
@@ -69,7 +69,7 @@ function httpRequest(params, onResponse, onError) {
69
69
  method: options.method
70
70
  };
71
71
  } else {
72
- options.agent = new import_utilsBundle.HttpsProxyAgent(import_url.default.format(parsedProxyURL));
72
+ options.agent = new import_utilsBundle.HttpsProxyAgent(normalizeProxyURL(proxyURL));
73
73
  options.rejectUnauthorized = false;
74
74
  }
75
75
  }
@@ -134,29 +134,33 @@ function shouldBypassProxy(url2, bypass) {
134
134
  const domain = "." + url2.hostname;
135
135
  return domains.some((d) => domain.endsWith(d));
136
136
  }
137
+ function normalizeProxyURL(proxy) {
138
+ proxy = proxy.trim();
139
+ if (!/^\w+:\/\//.test(proxy))
140
+ proxy = "http://" + proxy;
141
+ return new URL(proxy);
142
+ }
137
143
  function createProxyAgent(proxy, forUrl) {
138
144
  if (!proxy)
139
145
  return;
140
146
  if (forUrl && proxy.bypass && shouldBypassProxy(forUrl, proxy.bypass))
141
147
  return;
142
- let proxyServer = proxy.server.trim();
143
- if (!/^\w+:\/\//.test(proxyServer))
144
- proxyServer = "http://" + proxyServer;
145
- const proxyOpts = import_url.default.parse(proxyServer);
146
- if (proxyOpts.protocol?.startsWith("socks")) {
147
- const socksProxyURL = new URL(proxyServer);
148
- if (proxyOpts.protocol === "socks5:")
149
- socksProxyURL.protocol = "socks5h:";
150
- else if (proxyOpts.protocol === "socks4:")
151
- socksProxyURL.protocol = "socks4a:";
152
- return new import_utilsBundle.SocksProxyAgent(socksProxyURL);
148
+ const proxyURL = normalizeProxyURL(proxy.server);
149
+ if (proxyURL.protocol?.startsWith("socks")) {
150
+ if (proxyURL.protocol === "socks5:")
151
+ proxyURL.protocol = "socks5h:";
152
+ else if (proxyURL.protocol === "socks4:")
153
+ proxyURL.protocol = "socks4a:";
154
+ return new import_utilsBundle.SocksProxyAgent(proxyURL);
155
+ }
156
+ if (proxy.username) {
157
+ proxyURL.username = proxy.username;
158
+ proxyURL.password = proxy.password || "";
153
159
  }
154
- if (proxy.username)
155
- proxyOpts.auth = `${proxy.username}:${proxy.password || ""}`;
156
160
  if (forUrl && ["ws:", "wss:"].includes(forUrl.protocol)) {
157
- return new import_utilsBundle.HttpsProxyAgent(import_url.default.format(proxyOpts));
161
+ return new import_utilsBundle.HttpsProxyAgent(proxyURL);
158
162
  }
159
- return new import_utilsBundle.HttpsProxyAgent(import_url.default.format(proxyOpts));
163
+ return new import_utilsBundle.HttpsProxyAgent(proxyURL);
160
164
  }
161
165
  function createHttpServer(...args) {
162
166
  const server = import_http.default.createServer(...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-core",
3
- "version": "1.57.0-alpha-2025-10-08",
3
+ "version": "1.57.0-alpha-2025-10-09",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",