@wix/bex-utils 2.100.0 → 2.101.0

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.
@@ -8320,7 +8320,7 @@ var require_dist = __commonJS({
8320
8320
  // In order to properly update the socket pool, we need to call `getName()` on
8321
8321
  // the core `https.Agent` if it is a secureEndpoint.
8322
8322
  getName(options) {
8323
- const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options);
8323
+ const secureEndpoint = this.isSecureEndpoint(options);
8324
8324
  if (secureEndpoint) {
8325
8325
  return https_1.Agent.prototype.getName.call(this, options);
8326
8326
  }
@@ -8336,7 +8336,11 @@ var require_dist = __commonJS({
8336
8336
  Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
8337
8337
  this.decrementSockets(name, fakeSocket);
8338
8338
  if (socket instanceof http.Agent) {
8339
- return socket.addRequest(req, connectOpts);
8339
+ try {
8340
+ return socket.addRequest(req, connectOpts);
8341
+ } catch (err) {
8342
+ return cb(err);
8343
+ }
8340
8344
  }
8341
8345
  this[INTERNAL].currentSocket = socket;
8342
8346
  super.createSocket(req, options, cb);
@@ -8644,6 +8648,15 @@ var require_dist3 = __commonJS({
8644
8648
  var url_1 = require("url");
8645
8649
  var parse_proxy_response_1 = require_parse_proxy_response();
8646
8650
  var debug = (0, debug_1.default)("https-proxy-agent");
8651
+ var setServernameFromNonIpHost = (options) => {
8652
+ if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
8653
+ return {
8654
+ ...options,
8655
+ servername: options.host
8656
+ };
8657
+ }
8658
+ return options;
8659
+ };
8647
8660
  var HttpsProxyAgent = class extends agent_base_1.Agent {
8648
8661
  constructor(proxy, opts) {
8649
8662
  super(opts);
@@ -8673,11 +8686,7 @@ var require_dist3 = __commonJS({
8673
8686
  let socket;
8674
8687
  if (proxy.protocol === "https:") {
8675
8688
  debug("Creating `tls.Socket`: %o", this.connectOpts);
8676
- const servername = this.connectOpts.servername || this.connectOpts.host;
8677
- socket = tls.connect({
8678
- ...this.connectOpts,
8679
- servername
8680
- });
8689
+ socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
8681
8690
  } else {
8682
8691
  debug("Creating `net.Socket`: %o", this.connectOpts);
8683
8692
  socket = net.connect(this.connectOpts);
@@ -8708,11 +8717,9 @@ var require_dist3 = __commonJS({
8708
8717
  req.once("socket", resume);
8709
8718
  if (opts.secureEndpoint) {
8710
8719
  debug("Upgrading socket connection to TLS");
8711
- const servername = opts.servername || opts.host;
8712
8720
  return tls.connect({
8713
- ...omit(opts, "host", "path", "port"),
8714
- socket,
8715
- servername
8721
+ ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
8722
+ socket
8716
8723
  });
8717
8724
  }
8718
8725
  return socket;