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.
- package/dist/adapters/curl.cjs +39 -34
- package/dist/adapters/curl.js +39 -34
- package/dist/adapters/entries/curl.d.ts +29 -17
- package/dist/adapters/entries/fetch.d.ts +29 -17
- package/dist/adapters/entries/http.d.ts +29 -17
- package/dist/adapters/entries/http2.d.ts +29 -17
- package/dist/adapters/entries/react-native.d.ts +29 -17
- package/dist/adapters/entries/xhr.d.ts +29 -17
- package/dist/adapters/fetch.cjs +42 -41
- package/dist/adapters/fetch.js +42 -41
- package/dist/adapters/http.cjs +184 -73
- package/dist/adapters/http.js +184 -73
- package/dist/adapters/http2.cjs +41 -36
- package/dist/adapters/http2.js +41 -36
- package/dist/adapters/index.cjs +6 -6
- package/dist/adapters/react-native.cjs +41 -27
- package/dist/adapters/react-native.js +41 -27
- package/dist/adapters/xhr.cjs +43 -38
- package/dist/adapters/xhr.js +43 -38
- package/dist/cache/index.cjs +13 -13
- package/dist/crawler.d.ts +29 -17
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +29 -17
- package/dist/platform/browser.d.ts +29 -17
- package/dist/platform/bun.d.ts +29 -17
- package/dist/platform/deno.d.ts +29 -17
- package/dist/platform/node.d.ts +29 -17
- package/dist/platform/react-native.d.ts +29 -17
- package/dist/platform/worker.d.ts +29 -17
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/utils/http-config.cjs +8 -4
- package/dist/utils/http-config.js +8 -4
- package/dist/utils/timing.cjs +90 -0
- package/dist/utils/timing.js +78 -0
- package/package.json +1 -1
package/dist/platform/node.d.ts
CHANGED
|
@@ -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 (
|
|
1821
|
-
|
|
1822
|
-
/** @description
|
|
1823
|
-
|
|
1824
|
-
/** @description DNS lookup
|
|
1825
|
-
|
|
1826
|
-
/** @description
|
|
1827
|
-
|
|
1828
|
-
/** @description TLS handshake
|
|
1829
|
-
|
|
1830
|
-
/** @description
|
|
1831
|
-
|
|
1832
|
-
/** @description
|
|
1833
|
-
|
|
1834
|
-
/** @description
|
|
1835
|
-
|
|
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 (
|
|
1821
|
-
|
|
1822
|
-
/** @description
|
|
1823
|
-
|
|
1824
|
-
/** @description DNS lookup
|
|
1825
|
-
|
|
1826
|
-
/** @description
|
|
1827
|
-
|
|
1828
|
-
/** @description TLS handshake
|
|
1829
|
-
|
|
1830
|
-
/** @description
|
|
1831
|
-
|
|
1832
|
-
/** @description
|
|
1833
|
-
|
|
1834
|
-
/** @description
|
|
1835
|
-
|
|
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 (
|
|
1821
|
-
|
|
1822
|
-
/** @description
|
|
1823
|
-
|
|
1824
|
-
/** @description DNS lookup
|
|
1825
|
-
|
|
1826
|
-
/** @description
|
|
1827
|
-
|
|
1828
|
-
/** @description TLS handshake
|
|
1829
|
-
|
|
1830
|
-
/** @description
|
|
1831
|
-
|
|
1832
|
-
/** @description
|
|
1833
|
-
|
|
1834
|
-
/** @description
|
|
1835
|
-
|
|
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 */
|
package/dist/plugin/index.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
const
|
|
6
|
-
exports.FileCacher =
|
|
7
|
-
const
|
|
8
|
-
exports.UrlStore =
|
|
9
|
-
const
|
|
10
|
-
exports.Oxylabs =
|
|
11
|
-
const
|
|
12
|
-
exports.OXYLABS_BROWSER_TYPES =
|
|
13
|
-
exports.OXYLABS_COMMON_LOCALES =
|
|
14
|
-
exports.OXYLABS_COMMON_GEO_LOCATIONS =
|
|
15
|
-
exports.OXYLABS_US_STATES =
|
|
16
|
-
exports.OXYLABS_EUROPEAN_COUNTRIES =
|
|
17
|
-
exports.OXYLABS_ASIAN_COUNTRIES =
|
|
18
|
-
exports.getRandomOxylabsBrowserType =
|
|
19
|
-
exports.getRandomOxylabsLocale =
|
|
20
|
-
exports.getRandomOxylabsGeoLocation =
|
|
21
|
-
const
|
|
22
|
-
exports.Decodo =
|
|
23
|
-
const
|
|
24
|
-
exports.DECODO_DEVICE_TYPES =
|
|
25
|
-
exports.DECODO_HEADLESS_MODES =
|
|
26
|
-
exports.DECODO_COMMON_LOCALES =
|
|
27
|
-
exports.DECODO_COMMON_COUNTRIES =
|
|
28
|
-
exports.DECODO_EUROPEAN_COUNTRIES =
|
|
29
|
-
exports.DECODO_ASIAN_COUNTRIES =
|
|
30
|
-
exports.DECODO_US_STATES =
|
|
31
|
-
exports.DECODO_COMMON_CITIES =
|
|
32
|
-
exports.getRandomDecodoDeviceType =
|
|
33
|
-
exports.getRandomDecodoLocale =
|
|
34
|
-
exports.getRandomDecodoCountry =
|
|
35
|
-
exports.getRandomDecodoCity =
|
|
36
|
-
exports.generateDecodoSessionId =
|
|
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;;
|
package/dist/proxy/index.cjs
CHANGED
|
@@ -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
|
|
5
|
-
exports.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 {
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.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(
|
|
275
|
-
cookiesString = cookieJar.getCookieStringSync(
|
|
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
|
|
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(
|
|
275
|
-
cookiesString = cookieJar.getCookieStringSync(
|
|
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
|
|
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.
|
|
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",
|