playwright-core 1.54.0-beta-1752093008000 → 1.54.0-beta-1752237221000

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.
@@ -41,12 +41,14 @@ module.exports = __toCommonJS(network_exports);
41
41
  var import_http = __toESM(require("http"));
42
42
  var import_http2 = __toESM(require("http2"));
43
43
  var import_https = __toESM(require("https"));
44
+ var import_url = __toESM(require("url"));
44
45
  var import_utilsBundle = require("../../utilsBundle");
45
46
  var import_happyEyeballs = require("./happyEyeballs");
46
47
  const NET_DEFAULT_TIMEOUT = 3e4;
47
48
  function httpRequest(params, onResponse, onError) {
48
- const parsedUrl = new URL(params.url);
49
- const options = {
49
+ const parsedUrl = import_url.default.parse(params.url);
50
+ let options = {
51
+ ...parsedUrl,
50
52
  agent: parsedUrl.protocol === "https:" ? import_happyEyeballs.httpsHappyEyeballsAgent : import_happyEyeballs.httpHappyEyeballsAgent,
51
53
  method: params.method || "GET",
52
54
  headers: params.headers
@@ -55,15 +57,18 @@ function httpRequest(params, onResponse, onError) {
55
57
  options.rejectUnauthorized = params.rejectUnauthorized;
56
58
  const proxyURL = (0, import_utilsBundle.getProxyForUrl)(params.url);
57
59
  if (proxyURL) {
58
- const parsedProxyURL = new URL(proxyURL);
60
+ const parsedProxyURL = import_url.default.parse(proxyURL);
59
61
  if (params.url.startsWith("http:")) {
60
- parsedUrl.pathname = parsedUrl.href;
61
- parsedUrl.host = parsedProxyURL.host;
62
+ options = {
63
+ path: parsedUrl.href,
64
+ host: parsedProxyURL.hostname,
65
+ port: parsedProxyURL.port,
66
+ headers: options.headers,
67
+ method: options.method
68
+ };
62
69
  } else {
63
- options.agent = new import_utilsBundle.HttpsProxyAgent({
64
- ...convertURLtoLegacyUrl(parsedProxyURL),
65
- secureProxy: parsedProxyURL.protocol === "https:"
66
- });
70
+ parsedProxyURL.secureProxy = parsedProxyURL.protocol === "https:";
71
+ options.agent = new import_utilsBundle.HttpsProxyAgent(parsedProxyURL);
67
72
  options.rejectUnauthorized = false;
68
73
  }
69
74
  }
@@ -77,7 +82,7 @@ function httpRequest(params, onResponse, onError) {
77
82
  onResponse(res);
78
83
  }
79
84
  };
80
- const request = options.protocol === "https:" ? import_https.default.request(parsedUrl, options, requestCallback) : import_http.default.request(parsedUrl, options, requestCallback);
85
+ const request = options.protocol === "https:" ? import_https.default.request(options, requestCallback) : import_http.default.request(options, requestCallback);
81
86
  request.on("error", onError);
82
87
  if (params.socketTimeout !== void 0) {
83
88
  request.setTimeout(params.socketTimeout, () => {
@@ -126,21 +131,19 @@ function createProxyAgent(proxy, forUrl) {
126
131
  let proxyServer = proxy.server.trim();
127
132
  if (!/^\w+:\/\//.test(proxyServer))
128
133
  proxyServer = "http://" + proxyServer;
129
- const proxyOpts = new URL(proxyServer);
134
+ const proxyOpts = import_url.default.parse(proxyServer);
130
135
  if (proxyOpts.protocol?.startsWith("socks")) {
131
136
  return new import_utilsBundle.SocksProxyAgent({
132
137
  host: proxyOpts.hostname,
133
138
  port: proxyOpts.port || void 0
134
139
  });
135
140
  }
136
- if (proxy.username) {
137
- proxyOpts.username = proxy.username;
138
- proxyOpts.password = proxy.password || "";
139
- }
141
+ if (proxy.username)
142
+ proxyOpts.auth = `${proxy.username}:${proxy.password || ""}`;
140
143
  if (forUrl && ["ws:", "wss:"].includes(forUrl.protocol)) {
141
- return new import_utilsBundle.HttpsProxyAgent(convertURLtoLegacyUrl(proxyOpts));
144
+ return new import_utilsBundle.HttpsProxyAgent(proxyOpts);
142
145
  }
143
- return new import_utilsBundle.HttpsProxyAgent(convertURLtoLegacyUrl(proxyOpts));
146
+ return new import_utilsBundle.HttpsProxyAgent(proxyOpts);
144
147
  }
145
148
  function createHttpServer(...args) {
146
149
  const server = import_http.default.createServer(...args);
@@ -200,22 +203,6 @@ function decorateServer(server) {
200
203
  return close.call(server, callback);
201
204
  };
202
205
  }
203
- function convertURLtoLegacyUrl(url2) {
204
- return {
205
- auth: url2.username ? url2.username + ":" + url2.password : null,
206
- hash: url2.hash || null,
207
- host: url2.hostname ? url2.hostname + ":" + url2.port : null,
208
- hostname: url2.hostname || null,
209
- href: url2.href,
210
- path: url2.pathname + url2.search,
211
- pathname: url2.pathname,
212
- protocol: url2.protocol,
213
- search: url2.search || null,
214
- slashes: true,
215
- port: url2.port || null,
216
- query: url2.search.slice(1) || null
217
- };
218
- }
219
206
  // Annotate the CommonJS export names for ESM import in node:
220
207
  0 && (module.exports = {
221
208
  NET_DEFAULT_TIMEOUT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-core",
3
- "version": "1.54.0-beta-1752093008000",
3
+ "version": "1.54.0-beta-1752237221000",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",