rezo 1.0.18 → 1.0.20

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 (38) hide show
  1. package/dist/adapters/curl.cjs +39 -34
  2. package/dist/adapters/curl.js +39 -34
  3. package/dist/adapters/entries/curl.d.ts +29 -17
  4. package/dist/adapters/entries/fetch.d.ts +29 -17
  5. package/dist/adapters/entries/http.d.ts +29 -17
  6. package/dist/adapters/entries/http2.d.ts +29 -17
  7. package/dist/adapters/entries/react-native.d.ts +29 -17
  8. package/dist/adapters/entries/xhr.d.ts +29 -17
  9. package/dist/adapters/fetch.cjs +42 -41
  10. package/dist/adapters/fetch.js +42 -41
  11. package/dist/adapters/http.cjs +184 -73
  12. package/dist/adapters/http.js +184 -73
  13. package/dist/adapters/http2.cjs +41 -36
  14. package/dist/adapters/http2.js +41 -36
  15. package/dist/adapters/index.cjs +6 -6
  16. package/dist/adapters/react-native.cjs +41 -27
  17. package/dist/adapters/react-native.js +41 -27
  18. package/dist/adapters/xhr.cjs +43 -38
  19. package/dist/adapters/xhr.js +43 -38
  20. package/dist/cache/index.cjs +13 -13
  21. package/dist/crawler.d.ts +29 -17
  22. package/dist/entries/crawler.cjs +5 -5
  23. package/dist/index.cjs +24 -24
  24. package/dist/index.d.ts +29 -17
  25. package/dist/platform/browser.d.ts +29 -17
  26. package/dist/platform/bun.d.ts +29 -17
  27. package/dist/platform/deno.d.ts +29 -17
  28. package/dist/platform/node.d.ts +29 -17
  29. package/dist/platform/react-native.d.ts +29 -17
  30. package/dist/platform/worker.d.ts +29 -17
  31. package/dist/plugin/index.cjs +36 -36
  32. package/dist/proxy/index.cjs +2 -2
  33. package/dist/queue/index.cjs +8 -8
  34. package/dist/utils/http-config.cjs +8 -4
  35. package/dist/utils/http-config.js +8 -4
  36. package/dist/utils/timing.cjs +90 -0
  37. package/dist/utils/timing.js +78 -0
  38. package/package.json +1 -1
@@ -1815,24 +1815,26 @@ export interface RezoConfig {
1815
1815
  * - removeAllCookiesSync(): Clear all cookies
1816
1816
  */
1817
1817
  cookieJar: RezoCookieJar;
1818
- /** @description Comprehensive timing information */
1818
+ /** @description Comprehensive timing information (matches PerformanceResourceTiming API) */
1819
1819
  timing: {
1820
- /** @description Request start timestamp (absolute performance.now() value) */
1821
- startTimestamp: number;
1822
- /** @description Request end timestamp (absolute performance.now() value) */
1823
- endTimestamp: number;
1824
- /** @description DNS lookup duration in milliseconds */
1825
- dnsMs?: number;
1826
- /** @description TCP connection duration in milliseconds */
1827
- tcpMs?: number;
1828
- /** @description TLS handshake duration in milliseconds */
1829
- tlsMs?: number;
1830
- /** @description Time to first byte in milliseconds (from start to first response byte) */
1831
- ttfbMs?: number;
1832
- /** @description Content transfer duration in milliseconds */
1833
- transferMs?: number;
1834
- /** @description Total request duration in milliseconds (endTimestamp - startTimestamp) */
1835
- durationMs: number;
1820
+ /** @description Request start timestamp (performance.now() value when request began) */
1821
+ startTime: number;
1822
+ /** @description Timestamp when DNS lookup started */
1823
+ domainLookupStart: number;
1824
+ /** @description Timestamp when DNS lookup ended */
1825
+ domainLookupEnd: number;
1826
+ /** @description Timestamp when connection started */
1827
+ connectStart: number;
1828
+ /** @description Timestamp when TLS handshake started (0 for HTTP) */
1829
+ secureConnectionStart: number;
1830
+ /** @description Timestamp when connection completed */
1831
+ connectEnd: number;
1832
+ /** @description Timestamp when request was sent */
1833
+ requestStart: number;
1834
+ /** @description Timestamp when first byte of response received */
1835
+ responseStart: number;
1836
+ /** @description Timestamp when response completed */
1837
+ responseEnd: number;
1836
1838
  };
1837
1839
  /** @description Network connection information */
1838
1840
  network: {
@@ -1894,6 +1896,8 @@ export interface RezoConfig {
1894
1896
  };
1895
1897
  /** @description Debug mode flag */
1896
1898
  debug?: boolean;
1899
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1900
+ trackUrl?: boolean;
1897
1901
  /** @description Request tracking identifier */
1898
1902
  requestId: string;
1899
1903
  /** @description Session identifier */
@@ -2753,6 +2757,12 @@ export interface RezoRequestConfig<D = any> {
2753
2757
  debug?: boolean;
2754
2758
  /** Enable verbose logging with detailed information */
2755
2759
  verbose?: boolean;
2760
+ /**
2761
+ * Enable URL tracking to log the complete redirect chain with status codes.
2762
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2763
+ * Also logs retry attempts with their status codes.
2764
+ */
2765
+ trackUrl?: boolean;
2756
2766
  /** Name of the cookie containing XSRF token */
2757
2767
  xsrfCookieName?: string;
2758
2768
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3244,8 @@ export interface RezoDefaultOptions {
3234
3244
  debug?: RezoHttpRequest["debug"];
3235
3245
  /** Enable verbose logging with detailed information */
3236
3246
  verbose?: RezoHttpRequest["verbose"];
3247
+ /** Enable URL tracking to log redirect chain and retry attempts */
3248
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3249
  /** HTTP agent for HTTP requests */
3238
3250
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3251
  /** HTTPS agent for HTTPS requests */
@@ -1815,24 +1815,26 @@ export interface RezoConfig {
1815
1815
  * - removeAllCookiesSync(): Clear all cookies
1816
1816
  */
1817
1817
  cookieJar: RezoCookieJar;
1818
- /** @description Comprehensive timing information */
1818
+ /** @description Comprehensive timing information (matches PerformanceResourceTiming API) */
1819
1819
  timing: {
1820
- /** @description Request start timestamp (absolute performance.now() value) */
1821
- startTimestamp: number;
1822
- /** @description Request end timestamp (absolute performance.now() value) */
1823
- endTimestamp: number;
1824
- /** @description DNS lookup duration in milliseconds */
1825
- dnsMs?: number;
1826
- /** @description TCP connection duration in milliseconds */
1827
- tcpMs?: number;
1828
- /** @description TLS handshake duration in milliseconds */
1829
- tlsMs?: number;
1830
- /** @description Time to first byte in milliseconds (from start to first response byte) */
1831
- ttfbMs?: number;
1832
- /** @description Content transfer duration in milliseconds */
1833
- transferMs?: number;
1834
- /** @description Total request duration in milliseconds (endTimestamp - startTimestamp) */
1835
- durationMs: number;
1820
+ /** @description Request start timestamp (performance.now() value when request began) */
1821
+ startTime: number;
1822
+ /** @description Timestamp when DNS lookup started */
1823
+ domainLookupStart: number;
1824
+ /** @description Timestamp when DNS lookup ended */
1825
+ domainLookupEnd: number;
1826
+ /** @description Timestamp when connection started */
1827
+ connectStart: number;
1828
+ /** @description Timestamp when TLS handshake started (0 for HTTP) */
1829
+ secureConnectionStart: number;
1830
+ /** @description Timestamp when connection completed */
1831
+ connectEnd: number;
1832
+ /** @description Timestamp when request was sent */
1833
+ requestStart: number;
1834
+ /** @description Timestamp when first byte of response received */
1835
+ responseStart: number;
1836
+ /** @description Timestamp when response completed */
1837
+ responseEnd: number;
1836
1838
  };
1837
1839
  /** @description Network connection information */
1838
1840
  network: {
@@ -1894,6 +1896,8 @@ export interface RezoConfig {
1894
1896
  };
1895
1897
  /** @description Debug mode flag */
1896
1898
  debug?: boolean;
1899
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1900
+ trackUrl?: boolean;
1897
1901
  /** @description Request tracking identifier */
1898
1902
  requestId: string;
1899
1903
  /** @description Session identifier */
@@ -2753,6 +2757,12 @@ export interface RezoRequestConfig<D = any> {
2753
2757
  debug?: boolean;
2754
2758
  /** Enable verbose logging with detailed information */
2755
2759
  verbose?: boolean;
2760
+ /**
2761
+ * Enable URL tracking to log the complete redirect chain with status codes.
2762
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2763
+ * Also logs retry attempts with their status codes.
2764
+ */
2765
+ trackUrl?: boolean;
2756
2766
  /** Name of the cookie containing XSRF token */
2757
2767
  xsrfCookieName?: string;
2758
2768
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3244,8 @@ export interface RezoDefaultOptions {
3234
3244
  debug?: RezoHttpRequest["debug"];
3235
3245
  /** Enable verbose logging with detailed information */
3236
3246
  verbose?: RezoHttpRequest["verbose"];
3247
+ /** Enable URL tracking to log redirect chain and retry attempts */
3248
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3249
  /** HTTP agent for HTTP requests */
3238
3250
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3251
  /** HTTPS agent for HTTPS requests */
@@ -1815,24 +1815,26 @@ export interface RezoConfig {
1815
1815
  * - removeAllCookiesSync(): Clear all cookies
1816
1816
  */
1817
1817
  cookieJar: RezoCookieJar;
1818
- /** @description Comprehensive timing information */
1818
+ /** @description Comprehensive timing information (matches PerformanceResourceTiming API) */
1819
1819
  timing: {
1820
- /** @description Request start timestamp (absolute performance.now() value) */
1821
- startTimestamp: number;
1822
- /** @description Request end timestamp (absolute performance.now() value) */
1823
- endTimestamp: number;
1824
- /** @description DNS lookup duration in milliseconds */
1825
- dnsMs?: number;
1826
- /** @description TCP connection duration in milliseconds */
1827
- tcpMs?: number;
1828
- /** @description TLS handshake duration in milliseconds */
1829
- tlsMs?: number;
1830
- /** @description Time to first byte in milliseconds (from start to first response byte) */
1831
- ttfbMs?: number;
1832
- /** @description Content transfer duration in milliseconds */
1833
- transferMs?: number;
1834
- /** @description Total request duration in milliseconds (endTimestamp - startTimestamp) */
1835
- durationMs: number;
1820
+ /** @description Request start timestamp (performance.now() value when request began) */
1821
+ startTime: number;
1822
+ /** @description Timestamp when DNS lookup started */
1823
+ domainLookupStart: number;
1824
+ /** @description Timestamp when DNS lookup ended */
1825
+ domainLookupEnd: number;
1826
+ /** @description Timestamp when connection started */
1827
+ connectStart: number;
1828
+ /** @description Timestamp when TLS handshake started (0 for HTTP) */
1829
+ secureConnectionStart: number;
1830
+ /** @description Timestamp when connection completed */
1831
+ connectEnd: number;
1832
+ /** @description Timestamp when request was sent */
1833
+ requestStart: number;
1834
+ /** @description Timestamp when first byte of response received */
1835
+ responseStart: number;
1836
+ /** @description Timestamp when response completed */
1837
+ responseEnd: number;
1836
1838
  };
1837
1839
  /** @description Network connection information */
1838
1840
  network: {
@@ -1894,6 +1896,8 @@ export interface RezoConfig {
1894
1896
  };
1895
1897
  /** @description Debug mode flag */
1896
1898
  debug?: boolean;
1899
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1900
+ trackUrl?: boolean;
1897
1901
  /** @description Request tracking identifier */
1898
1902
  requestId: string;
1899
1903
  /** @description Session identifier */
@@ -2753,6 +2757,12 @@ export interface RezoRequestConfig<D = any> {
2753
2757
  debug?: boolean;
2754
2758
  /** Enable verbose logging with detailed information */
2755
2759
  verbose?: boolean;
2760
+ /**
2761
+ * Enable URL tracking to log the complete redirect chain with status codes.
2762
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2763
+ * Also logs retry attempts with their status codes.
2764
+ */
2765
+ trackUrl?: boolean;
2756
2766
  /** Name of the cookie containing XSRF token */
2757
2767
  xsrfCookieName?: string;
2758
2768
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3244,8 @@ export interface RezoDefaultOptions {
3234
3244
  debug?: RezoHttpRequest["debug"];
3235
3245
  /** Enable verbose logging with detailed information */
3236
3246
  verbose?: RezoHttpRequest["verbose"];
3247
+ /** Enable URL tracking to log redirect chain and retry attempts */
3248
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3249
  /** HTTP agent for HTTP requests */
3238
3250
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3251
  /** HTTPS agent for HTTPS requests */
@@ -1,36 +1,36 @@
1
- const _mod_hn992k = require('./crawler.cjs');
2
- exports.Crawler = _mod_hn992k.Crawler;;
3
- const _mod_m53bio = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_m53bio.CrawlerOptions;;
5
- const _mod_lj4o1a = require('../cache/file-cacher.cjs');
6
- exports.FileCacher = _mod_lj4o1a.FileCacher;;
7
- const _mod_79e6u8 = require('../cache/url-store.cjs');
8
- exports.UrlStore = _mod_79e6u8.UrlStore;;
9
- const _mod_e2lhpw = require('./addon/oxylabs/index.cjs');
10
- exports.Oxylabs = _mod_e2lhpw.Oxylabs;;
11
- const _mod_x1fqvd = require('./addon/oxylabs/options.cjs');
12
- exports.OXYLABS_BROWSER_TYPES = _mod_x1fqvd.OXYLABS_BROWSER_TYPES;
13
- exports.OXYLABS_COMMON_LOCALES = _mod_x1fqvd.OXYLABS_COMMON_LOCALES;
14
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_x1fqvd.OXYLABS_COMMON_GEO_LOCATIONS;
15
- exports.OXYLABS_US_STATES = _mod_x1fqvd.OXYLABS_US_STATES;
16
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_x1fqvd.OXYLABS_EUROPEAN_COUNTRIES;
17
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_x1fqvd.OXYLABS_ASIAN_COUNTRIES;
18
- exports.getRandomOxylabsBrowserType = _mod_x1fqvd.getRandomBrowserType;
19
- exports.getRandomOxylabsLocale = _mod_x1fqvd.getRandomLocale;
20
- exports.getRandomOxylabsGeoLocation = _mod_x1fqvd.getRandomGeoLocation;;
21
- const _mod_h4etyg = require('./addon/decodo/index.cjs');
22
- exports.Decodo = _mod_h4etyg.Decodo;;
23
- const _mod_m3dnsx = require('./addon/decodo/options.cjs');
24
- exports.DECODO_DEVICE_TYPES = _mod_m3dnsx.DECODO_DEVICE_TYPES;
25
- exports.DECODO_HEADLESS_MODES = _mod_m3dnsx.DECODO_HEADLESS_MODES;
26
- exports.DECODO_COMMON_LOCALES = _mod_m3dnsx.DECODO_COMMON_LOCALES;
27
- exports.DECODO_COMMON_COUNTRIES = _mod_m3dnsx.DECODO_COMMON_COUNTRIES;
28
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_m3dnsx.DECODO_EUROPEAN_COUNTRIES;
29
- exports.DECODO_ASIAN_COUNTRIES = _mod_m3dnsx.DECODO_ASIAN_COUNTRIES;
30
- exports.DECODO_US_STATES = _mod_m3dnsx.DECODO_US_STATES;
31
- exports.DECODO_COMMON_CITIES = _mod_m3dnsx.DECODO_COMMON_CITIES;
32
- exports.getRandomDecodoDeviceType = _mod_m3dnsx.getRandomDeviceType;
33
- exports.getRandomDecodoLocale = _mod_m3dnsx.getRandomLocale;
34
- exports.getRandomDecodoCountry = _mod_m3dnsx.getRandomCountry;
35
- exports.getRandomDecodoCity = _mod_m3dnsx.getRandomCity;
36
- exports.generateDecodoSessionId = _mod_m3dnsx.generateSessionId;;
1
+ const _mod_2ijd3k = require('./crawler.cjs');
2
+ exports.Crawler = _mod_2ijd3k.Crawler;;
3
+ const _mod_gc69uh = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_gc69uh.CrawlerOptions;;
5
+ const _mod_4wjcb5 = require('../cache/file-cacher.cjs');
6
+ exports.FileCacher = _mod_4wjcb5.FileCacher;;
7
+ const _mod_hoe0p4 = require('../cache/url-store.cjs');
8
+ exports.UrlStore = _mod_hoe0p4.UrlStore;;
9
+ const _mod_87dbqg = require('./addon/oxylabs/index.cjs');
10
+ exports.Oxylabs = _mod_87dbqg.Oxylabs;;
11
+ const _mod_0u3ysd = require('./addon/oxylabs/options.cjs');
12
+ exports.OXYLABS_BROWSER_TYPES = _mod_0u3ysd.OXYLABS_BROWSER_TYPES;
13
+ exports.OXYLABS_COMMON_LOCALES = _mod_0u3ysd.OXYLABS_COMMON_LOCALES;
14
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_0u3ysd.OXYLABS_COMMON_GEO_LOCATIONS;
15
+ exports.OXYLABS_US_STATES = _mod_0u3ysd.OXYLABS_US_STATES;
16
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_0u3ysd.OXYLABS_EUROPEAN_COUNTRIES;
17
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_0u3ysd.OXYLABS_ASIAN_COUNTRIES;
18
+ exports.getRandomOxylabsBrowserType = _mod_0u3ysd.getRandomBrowserType;
19
+ exports.getRandomOxylabsLocale = _mod_0u3ysd.getRandomLocale;
20
+ exports.getRandomOxylabsGeoLocation = _mod_0u3ysd.getRandomGeoLocation;;
21
+ const _mod_qvvezh = require('./addon/decodo/index.cjs');
22
+ exports.Decodo = _mod_qvvezh.Decodo;;
23
+ const _mod_c8oa9x = require('./addon/decodo/options.cjs');
24
+ exports.DECODO_DEVICE_TYPES = _mod_c8oa9x.DECODO_DEVICE_TYPES;
25
+ exports.DECODO_HEADLESS_MODES = _mod_c8oa9x.DECODO_HEADLESS_MODES;
26
+ exports.DECODO_COMMON_LOCALES = _mod_c8oa9x.DECODO_COMMON_LOCALES;
27
+ exports.DECODO_COMMON_COUNTRIES = _mod_c8oa9x.DECODO_COMMON_COUNTRIES;
28
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_c8oa9x.DECODO_EUROPEAN_COUNTRIES;
29
+ exports.DECODO_ASIAN_COUNTRIES = _mod_c8oa9x.DECODO_ASIAN_COUNTRIES;
30
+ exports.DECODO_US_STATES = _mod_c8oa9x.DECODO_US_STATES;
31
+ exports.DECODO_COMMON_CITIES = _mod_c8oa9x.DECODO_COMMON_CITIES;
32
+ exports.getRandomDecodoDeviceType = _mod_c8oa9x.getRandomDeviceType;
33
+ exports.getRandomDecodoLocale = _mod_c8oa9x.getRandomLocale;
34
+ exports.getRandomDecodoCountry = _mod_c8oa9x.getRandomCountry;
35
+ exports.getRandomDecodoCity = _mod_c8oa9x.getRandomCity;
36
+ exports.generateDecodoSessionId = _mod_c8oa9x.generateSessionId;;
@@ -1,8 +1,8 @@
1
1
  const { SocksProxyAgent: RezoSocksProxy } = require("socks-proxy-agent");
2
2
  const { HttpsProxyAgent: RezoHttpsSocks } = require("https-proxy-agent");
3
3
  const { HttpProxyAgent: RezoHttpSocks } = require("http-proxy-agent");
4
- const _mod_p57bt6 = require('./manager.cjs');
5
- exports.ProxyManager = _mod_p57bt6.ProxyManager;;
4
+ const _mod_iw6rg6 = require('./manager.cjs');
5
+ exports.ProxyManager = _mod_iw6rg6.ProxyManager;;
6
6
  function createOptions(uri, opts) {
7
7
  if (uri instanceof URL || typeof uri === "string") {
8
8
  return {
@@ -1,8 +1,8 @@
1
- const _mod_5dkxsd = require('./queue.cjs');
2
- exports.RezoQueue = _mod_5dkxsd.RezoQueue;;
3
- const _mod_9nx7e1 = require('./http-queue.cjs');
4
- exports.HttpQueue = _mod_9nx7e1.HttpQueue;
5
- exports.extractDomain = _mod_9nx7e1.extractDomain;;
6
- const _mod_i04bue = require('./types.cjs');
7
- exports.Priority = _mod_i04bue.Priority;
8
- exports.HttpMethodPriority = _mod_i04bue.HttpMethodPriority;;
1
+ const _mod_sdr4pe = require('./queue.cjs');
2
+ exports.RezoQueue = _mod_sdr4pe.RezoQueue;;
3
+ const _mod_p0tjg8 = require('./http-queue.cjs');
4
+ exports.HttpQueue = _mod_p0tjg8.HttpQueue;
5
+ exports.extractDomain = _mod_p0tjg8.extractDomain;;
6
+ const _mod_tfd6vx = require('./types.cjs');
7
+ exports.Priority = _mod_tfd6vx.Priority;
8
+ exports.HttpMethodPriority = _mod_tfd6vx.HttpMethodPriority;;
@@ -269,10 +269,12 @@ function prepareHTTPOptions(options, jar, addedOptions, config) {
269
269
  cookieJar.setCookiesSync(options.cookies, options.url instanceof URL ? options.url.href : options.url);
270
270
  }
271
271
  }
272
+ const resolvedUrl = fetchOptions.url || options.url;
273
+ const cookieUrl = resolvedUrl instanceof URL ? resolvedUrl.href : resolvedUrl;
272
274
  let cookiesString = "";
273
275
  if (config.useCookies) {
274
- requestCookies = cookieJar.getCookiesSync(options.url instanceof URL ? options.url.href : options.url).map((c) => new Cookie(c));
275
- cookiesString = cookieJar.getCookieStringSync(options.url instanceof URL ? options.url.href : options.url);
276
+ requestCookies = cookieJar.getCookiesSync(cookieUrl).map((c) => new Cookie(c));
277
+ cookiesString = cookieJar.getCookieStringSync(cookieUrl);
276
278
  }
277
279
  if (options.xsrfCookieName && options.xsrfHeaderName && requestCookies.length > 0) {
278
280
  const xsrfCookie = requestCookies.find((c) => c.key === options.xsrfCookieName);
@@ -285,7 +287,7 @@ function prepareHTTPOptions(options, jar, addedOptions, config) {
285
287
  config.requestCookies = requestCookies;
286
288
  } else {
287
289
  for (const cookie of requestCookies) {
288
- config.requestCookies = config.requestCookies.filter((c) => c.key !== cookie.key);
290
+ config.requestCookies = config.requestCookies.filter((c) => !(c.key === cookie.key && c.domain === cookie.domain));
289
291
  config.requestCookies.push(cookie);
290
292
  }
291
293
  }
@@ -582,7 +584,9 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
582
584
  proxy: normalizedProxy,
583
585
  enableRedirectCycleDetection,
584
586
  rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true,
585
- decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true
587
+ decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true,
588
+ debug: requestOptions.debug === true || defaultOptions.debug === true,
589
+ trackUrl: requestOptions.trackUrl === true || defaultOptions.trackUrl === true
586
590
  };
587
591
  config.setSignal = setSignal.bind(config);
588
592
  if (requestOptions.encoding || defaultOptions.encoding) {
@@ -269,10 +269,12 @@ export function prepareHTTPOptions(options, jar, addedOptions, config) {
269
269
  cookieJar.setCookiesSync(options.cookies, options.url instanceof URL ? options.url.href : options.url);
270
270
  }
271
271
  }
272
+ const resolvedUrl = fetchOptions.url || options.url;
273
+ const cookieUrl = resolvedUrl instanceof URL ? resolvedUrl.href : resolvedUrl;
272
274
  let cookiesString = "";
273
275
  if (config.useCookies) {
274
- requestCookies = cookieJar.getCookiesSync(options.url instanceof URL ? options.url.href : options.url).map((c) => new Cookie(c));
275
- cookiesString = cookieJar.getCookieStringSync(options.url instanceof URL ? options.url.href : options.url);
276
+ requestCookies = cookieJar.getCookiesSync(cookieUrl).map((c) => new Cookie(c));
277
+ cookiesString = cookieJar.getCookieStringSync(cookieUrl);
276
278
  }
277
279
  if (options.xsrfCookieName && options.xsrfHeaderName && requestCookies.length > 0) {
278
280
  const xsrfCookie = requestCookies.find((c) => c.key === options.xsrfCookieName);
@@ -285,7 +287,7 @@ export function prepareHTTPOptions(options, jar, addedOptions, config) {
285
287
  config.requestCookies = requestCookies;
286
288
  } else {
287
289
  for (const cookie of requestCookies) {
288
- config.requestCookies = config.requestCookies.filter((c) => c.key !== cookie.key);
290
+ config.requestCookies = config.requestCookies.filter((c) => !(c.key === cookie.key && c.domain === cookie.domain));
289
291
  config.requestCookies.push(cookie);
290
292
  }
291
293
  }
@@ -582,7 +584,9 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
582
584
  proxy: normalizedProxy,
583
585
  enableRedirectCycleDetection,
584
586
  rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true,
585
- decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true
587
+ decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true,
588
+ debug: requestOptions.debug === true || defaultOptions.debug === true,
589
+ trackUrl: requestOptions.trackUrl === true || defaultOptions.trackUrl === true
586
590
  };
587
591
  config.setSignal = setSignal.bind(config);
588
592
  if (requestOptions.encoding || defaultOptions.encoding) {
@@ -0,0 +1,90 @@
1
+ function createTimingTracker() {
2
+ return {
3
+ startTime: performance.now()
4
+ };
5
+ }
6
+ function markDnsStart(tracker) {
7
+ if (!tracker.dnsStart) {
8
+ tracker.dnsStart = performance.now();
9
+ }
10
+ }
11
+ function markDnsEnd(tracker) {
12
+ if (!tracker.dnsEnd) {
13
+ tracker.dnsEnd = performance.now();
14
+ if (!tracker.tcpStart) {
15
+ tracker.tcpStart = tracker.dnsEnd;
16
+ }
17
+ }
18
+ }
19
+ function markConnectStart(tracker) {
20
+ if (!tracker.tcpStart) {
21
+ tracker.tcpStart = performance.now();
22
+ }
23
+ }
24
+ function markSecureConnectStart(tracker) {
25
+ if (!tracker.tlsStart) {
26
+ tracker.tlsStart = performance.now();
27
+ }
28
+ }
29
+ function markConnectEnd(tracker) {
30
+ const now = performance.now();
31
+ if (!tracker.tcpEnd) {
32
+ tracker.tcpEnd = now;
33
+ }
34
+ if (!tracker.tlsEnd && tracker.tlsStart) {
35
+ tracker.tlsEnd = now;
36
+ }
37
+ if (!tracker.requestStart) {
38
+ tracker.requestStart = now;
39
+ }
40
+ }
41
+ function markRequestStart(tracker) {
42
+ if (!tracker.requestStart) {
43
+ tracker.requestStart = performance.now();
44
+ }
45
+ }
46
+ function markResponseStart(tracker) {
47
+ if (!tracker.firstByteTime) {
48
+ tracker.firstByteTime = performance.now();
49
+ }
50
+ }
51
+ function markResponseEnd(tracker) {
52
+ tracker.responseEnd = performance.now();
53
+ }
54
+ function buildTimingMarks(tracker) {
55
+ const now = tracker.responseEnd || performance.now();
56
+ const start = tracker.startTime;
57
+ return {
58
+ startTime: start,
59
+ domainLookupStart: tracker.dnsStart ?? start,
60
+ domainLookupEnd: tracker.dnsEnd ?? tracker.dnsStart ?? start,
61
+ connectStart: tracker.tcpStart ?? tracker.dnsEnd ?? start,
62
+ secureConnectionStart: tracker.tlsStart ?? 0,
63
+ connectEnd: tracker.tcpEnd ?? tracker.tlsEnd ?? tracker.tcpStart ?? start,
64
+ requestStart: tracker.requestStart ?? tracker.tcpEnd ?? start,
65
+ responseStart: tracker.firstByteTime ?? tracker.requestStart ?? start,
66
+ responseEnd: now
67
+ };
68
+ }
69
+ function getTimingDurations(marks) {
70
+ return {
71
+ dns: marks.domainLookupEnd - marks.domainLookupStart,
72
+ tcp: marks.secureConnectionStart > 0 ? marks.secureConnectionStart - marks.connectStart : marks.connectEnd - marks.connectStart,
73
+ tls: marks.secureConnectionStart > 0 ? marks.connectEnd - marks.secureConnectionStart : 0,
74
+ ttfb: marks.responseStart - marks.startTime,
75
+ transfer: marks.responseEnd - marks.responseStart,
76
+ total: marks.responseEnd - marks.startTime
77
+ };
78
+ }
79
+
80
+ exports.createTimingTracker = createTimingTracker;
81
+ exports.markDnsStart = markDnsStart;
82
+ exports.markDnsEnd = markDnsEnd;
83
+ exports.markConnectStart = markConnectStart;
84
+ exports.markSecureConnectStart = markSecureConnectStart;
85
+ exports.markConnectEnd = markConnectEnd;
86
+ exports.markRequestStart = markRequestStart;
87
+ exports.markResponseStart = markResponseStart;
88
+ exports.markResponseEnd = markResponseEnd;
89
+ exports.buildTimingMarks = buildTimingMarks;
90
+ exports.getTimingDurations = getTimingDurations;
@@ -0,0 +1,78 @@
1
+ export function createTimingTracker() {
2
+ return {
3
+ startTime: performance.now()
4
+ };
5
+ }
6
+ export function markDnsStart(tracker) {
7
+ if (!tracker.dnsStart) {
8
+ tracker.dnsStart = performance.now();
9
+ }
10
+ }
11
+ export function markDnsEnd(tracker) {
12
+ if (!tracker.dnsEnd) {
13
+ tracker.dnsEnd = performance.now();
14
+ if (!tracker.tcpStart) {
15
+ tracker.tcpStart = tracker.dnsEnd;
16
+ }
17
+ }
18
+ }
19
+ export function markConnectStart(tracker) {
20
+ if (!tracker.tcpStart) {
21
+ tracker.tcpStart = performance.now();
22
+ }
23
+ }
24
+ export function markSecureConnectStart(tracker) {
25
+ if (!tracker.tlsStart) {
26
+ tracker.tlsStart = performance.now();
27
+ }
28
+ }
29
+ export function markConnectEnd(tracker) {
30
+ const now = performance.now();
31
+ if (!tracker.tcpEnd) {
32
+ tracker.tcpEnd = now;
33
+ }
34
+ if (!tracker.tlsEnd && tracker.tlsStart) {
35
+ tracker.tlsEnd = now;
36
+ }
37
+ if (!tracker.requestStart) {
38
+ tracker.requestStart = now;
39
+ }
40
+ }
41
+ export function markRequestStart(tracker) {
42
+ if (!tracker.requestStart) {
43
+ tracker.requestStart = performance.now();
44
+ }
45
+ }
46
+ export function markResponseStart(tracker) {
47
+ if (!tracker.firstByteTime) {
48
+ tracker.firstByteTime = performance.now();
49
+ }
50
+ }
51
+ export function markResponseEnd(tracker) {
52
+ tracker.responseEnd = performance.now();
53
+ }
54
+ export function buildTimingMarks(tracker) {
55
+ const now = tracker.responseEnd || performance.now();
56
+ const start = tracker.startTime;
57
+ return {
58
+ startTime: start,
59
+ domainLookupStart: tracker.dnsStart ?? start,
60
+ domainLookupEnd: tracker.dnsEnd ?? tracker.dnsStart ?? start,
61
+ connectStart: tracker.tcpStart ?? tracker.dnsEnd ?? start,
62
+ secureConnectionStart: tracker.tlsStart ?? 0,
63
+ connectEnd: tracker.tcpEnd ?? tracker.tlsEnd ?? tracker.tcpStart ?? start,
64
+ requestStart: tracker.requestStart ?? tracker.tcpEnd ?? start,
65
+ responseStart: tracker.firstByteTime ?? tracker.requestStart ?? start,
66
+ responseEnd: now
67
+ };
68
+ }
69
+ export function getTimingDurations(marks) {
70
+ return {
71
+ dns: marks.domainLookupEnd - marks.domainLookupStart,
72
+ tcp: marks.secureConnectionStart > 0 ? marks.secureConnectionStart - marks.connectStart : marks.connectEnd - marks.connectStart,
73
+ tls: marks.secureConnectionStart > 0 ? marks.connectEnd - marks.secureConnectionStart : 0,
74
+ ttfb: marks.responseStart - marks.startTime,
75
+ transfer: marks.responseEnd - marks.responseStart,
76
+ total: marks.responseEnd - marks.startTime
77
+ };
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rezo",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",