@nocobase/plugin-ai-gigachat 2.2.17 → 2.2.18
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/externalVersion.js +5 -5
- package/dist/node_modules/gigachat/index.js +1 -1
- package/dist/node_modules/gigachat/node_modules/axios/dist/axios.js +2165 -1269
- package/dist/node_modules/gigachat/node_modules/axios/dist/axios.min.js +3 -3
- package/dist/node_modules/gigachat/node_modules/axios/dist/browser/axios.cjs +2771 -1604
- package/dist/node_modules/gigachat/node_modules/axios/dist/esm/axios.js +2784 -1619
- package/dist/node_modules/gigachat/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/dist/node_modules/gigachat/node_modules/axios/dist/node/axios.cjs +3201 -2520
- package/dist/node_modules/gigachat/node_modules/axios/index.d.cts +270 -123
- package/dist/node_modules/gigachat/node_modules/axios/index.d.ts +176 -231
- package/dist/node_modules/gigachat/node_modules/axios/index.js +5 -3
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/adapters.js +23 -17
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/fetch.js +467 -112
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/http.js +1158 -639
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/xhr.js +192 -164
- package/dist/node_modules/gigachat/node_modules/axios/lib/axios.js +6 -6
- package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/CancelToken.js +4 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/Axios.js +84 -50
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/AxiosError.js +161 -46
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/AxiosHeaders.js +65 -28
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/InterceptorManager.js +1 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/buildFullPath.js +30 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/dispatchRequest.js +37 -29
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/mergeConfig.js +65 -25
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/settle.js +1 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/defaults/index.js +92 -76
- package/dist/node_modules/gigachat/node_modules/axios/lib/defaults/transitional.js +3 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/env/data.js +1 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/AxiosTransformStream.js +37 -24
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +10 -9
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +5 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/buildURL.js +24 -19
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/callbackify.js +13 -11
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/composeSignals.js +42 -33
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/cookies.js +55 -44
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/deprecatedMethod.js +9 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +37 -5
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/formDataToJSON.js +29 -5
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/formDataToStream.js +34 -27
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/fromDataURI.js +22 -7
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isAxiosError.js +1 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isURLSameOrigin.js +13 -11
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/parseHeaders.js +34 -20
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/parseProtocol.js +2 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/progressEventReducer.js +30 -20
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/readBlob.js +4 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/resolveConfig.js +87 -29
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/shouldBypassProxy.js +210 -0
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/speedometer.js +1 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/throttle.js +4 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/toFormData.js +94 -32
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/toURLEncodedForm.js +2 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/trackStream.js +33 -31
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/validator.js +20 -7
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/Blob.js +2 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/index.js +5 -5
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/common/utils.js +6 -5
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/index.js +2 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/index.js +9 -10
- package/dist/node_modules/gigachat/node_modules/axios/lib/utils.js +270 -116
- package/dist/node_modules/gigachat/node_modules/axios/package.json +113 -132
- package/dist/node_modules/gigachat/node_modules/follow-redirects/index.js +24 -1
- package/dist/node_modules/gigachat/node_modules/follow-redirects/package.json +1 -1
- package/dist/node_modules/gigachat/node_modules/proxy-from-env/index.cjs +105 -0
- package/dist/node_modules/gigachat/node_modules/proxy-from-env/index.js +103 -0
- package/dist/node_modules/gigachat/node_modules/proxy-from-env/package.json +43 -0
- package/dist/node_modules/gigachat/package.json +1 -1
- package/dist/node_modules/langchain-gigachat/index.cjs +2 -2
- package/dist/node_modules/langchain-gigachat/package.json +1 -1
- package/package.json +2 -2
- package/dist/node_modules/gigachat/node_modules/es-define-property/.eslintrc +0 -13
- package/dist/node_modules/gigachat/node_modules/es-define-property/.github/FUNDING.yml +0 -12
- package/dist/node_modules/gigachat/node_modules/es-define-property/.nycrc +0 -9
- package/dist/node_modules/gigachat/node_modules/es-define-property/index.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/es-define-property/index.js +0 -14
- package/dist/node_modules/gigachat/node_modules/es-define-property/package.json +0 -81
- package/dist/node_modules/gigachat/node_modules/es-define-property/test/index.js +0 -56
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/.eslintrc +0 -16
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/ToObject.d.ts +0 -7
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/ToObject.js +0 -10
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/index.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/index.js +0 -4
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/isObject.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/isObject.js +0 -6
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/package.json +0 -80
- package/dist/node_modules/gigachat/node_modules/es-object-atoms/test/index.js +0 -38
- package/dist/node_modules/gigachat/node_modules/es-set-tostringtag/.eslintrc +0 -13
- package/dist/node_modules/gigachat/node_modules/es-set-tostringtag/.nycrc +0 -9
- package/dist/node_modules/gigachat/node_modules/es-set-tostringtag/index.d.ts +0 -10
- package/dist/node_modules/gigachat/node_modules/es-set-tostringtag/index.js +0 -35
- package/dist/node_modules/gigachat/node_modules/es-set-tostringtag/package.json +0 -78
- package/dist/node_modules/gigachat/node_modules/es-set-tostringtag/test/index.js +0 -85
- package/dist/node_modules/gigachat/node_modules/form-data/License +0 -19
- package/dist/node_modules/gigachat/node_modules/form-data/index.d.ts +0 -62
- package/dist/node_modules/gigachat/node_modules/form-data/lib/browser.js +0 -4
- package/dist/node_modules/gigachat/node_modules/form-data/lib/form_data.js +0 -494
- package/dist/node_modules/gigachat/node_modules/form-data/lib/populate.js +0 -10
- package/dist/node_modules/gigachat/node_modules/form-data/package.json +0 -82
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/.eslintrc +0 -42
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/.nycrc +0 -9
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/index.js +0 -378
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/.eslintrc +0 -11
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/.nycrc +0 -9
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/index.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/index.js +0 -14
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/package.json +0 -111
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/shams.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/shams.js +0 -45
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/test/index.js +0 -22
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/test/shams/core-js.js +0 -29
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/node_modules/has-symbols/test/tests.js +0 -58
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/package.json +0 -97
- package/dist/node_modules/gigachat/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/dist/node_modules/gigachat/node_modules/gopd/.eslintrc +0 -16
- package/dist/node_modules/gigachat/node_modules/gopd/.github/FUNDING.yml +0 -12
- package/dist/node_modules/gigachat/node_modules/gopd/gOPD.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/gopd/gOPD.js +0 -4
- package/dist/node_modules/gigachat/node_modules/gopd/index.d.ts +0 -5
- package/dist/node_modules/gigachat/node_modules/gopd/index.js +0 -15
- package/dist/node_modules/gigachat/node_modules/gopd/package.json +0 -77
- package/dist/node_modules/gigachat/node_modules/gopd/test/index.js +0 -36
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/.eslintrc +0 -5
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/.github/FUNDING.yml +0 -12
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/.nycrc +0 -13
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/index.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/index.js +0 -8
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/package.json +0 -108
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/shams.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/shams.js +0 -8
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/test/index.js +0 -21
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/test/shams/core-js.js +0 -31
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +0 -30
- package/dist/node_modules/gigachat/node_modules/has-tostringtag/test/tests.js +0 -15
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/index.d.ts +0 -15
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/index.js +0 -31
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/max.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/max.js +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/md5.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/md5.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/native.d.ts +0 -6
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/native.js +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/nil.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/nil.js +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/package.json +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/parse.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/parse.js +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/regex.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/regex.js +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/rng.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/rng.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/sha1.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/sha1.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/stringify.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/stringify.js +0 -39
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/types.d.ts +0 -21
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/types.js +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/uuid-bin.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/uuid-bin.js +0 -72
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v1.d.ts +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v1.js +0 -87
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v1ToV6.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v1ToV6.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v3.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v3.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v35.d.ts +0 -7
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v35.js +0 -44
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v4.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v4.js +0 -29
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v5.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v5.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v6.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v6.js +0 -22
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v6ToV1.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v6ToV1.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v7.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/v7.js +0 -69
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/validate.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/validate.js +0 -7
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/version.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs/version.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/index.d.ts +0 -15
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/index.js +0 -31
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/max.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/max.js +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/md5.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/md5.js +0 -137
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/native.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/native.js +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/nil.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/nil.js +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/package.json +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/parse.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/parse.js +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/regex.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/regex.js +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/rng.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/rng.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/sha1.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/sha1.js +0 -72
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/stringify.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/stringify.js +0 -39
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/types.d.ts +0 -21
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/types.js +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/uuid-bin.js +0 -72
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v1.d.ts +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v1.js +0 -87
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v1ToV6.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v3.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v3.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v35.d.ts +0 -7
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v35.js +0 -44
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v4.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v4.js +0 -29
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v5.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v5.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v6.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v6.js +0 -22
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v6ToV1.js +0 -13
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v7.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/v7.js +0 -69
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/validate.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/validate.js +0 -7
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/version.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/cjs-browser/version.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/bin/uuid +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/index.d.ts +0 -15
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/index.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/max.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/max.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/md5.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/md5.js +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/native.d.ts +0 -6
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/native.js +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/nil.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/nil.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/parse.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/parse.js +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/regex.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/regex.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/rng.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/rng.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/sha1.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/sha1.js +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/stringify.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/stringify.js +0 -35
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/types.d.ts +0 -21
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/types.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/uuid-bin.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/uuid-bin.js +0 -70
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v1.d.ts +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v1.js +0 -83
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v1ToV6.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v1ToV6.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v3.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v3.js +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v35.d.ts +0 -7
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v35.js +0 -39
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v4.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v4.js +0 -27
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v5.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v5.js +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v6.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v6.js +0 -20
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v6ToV1.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v6ToV1.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v7.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/v7.js +0 -65
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/validate.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/validate.js +0 -5
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/version.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm/version.js +0 -8
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/index.d.ts +0 -15
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/index.js +0 -14
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/max.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/max.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/md5.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/md5.js +0 -135
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/native.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/native.js +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/nil.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/nil.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/parse.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/parse.js +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/regex.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/rng.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/rng.js +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/sha1.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/sha1.js +0 -70
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/stringify.d.ts +0 -3
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/stringify.js +0 -35
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/types.d.ts +0 -21
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/types.js +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +0 -1
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/uuid-bin.js +0 -70
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v1.d.ts +0 -11
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v1.js +0 -83
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v1ToV6.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v3.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v3.js +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v35.d.ts +0 -7
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v35.js +0 -39
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v4.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v4.js +0 -27
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v5.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v5.js +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v6.d.ts +0 -4
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v6.js +0 -20
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v6ToV1.js +0 -10
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v7.d.ts +0 -9
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/v7.js +0 -65
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/validate.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/validate.js +0 -5
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/version.d.ts +0 -2
- package/dist/node_modules/gigachat/node_modules/uuid/dist/esm-browser/version.js +0 -8
- package/dist/node_modules/gigachat/node_modules/uuid/package.json +0 -132
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/index.d.ts +0 -15
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/index.js +0 -31
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/max.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/max.js +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/md5.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/md5.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/native.d.ts +0 -6
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/native.js +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/nil.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/nil.js +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/package.json +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/parse.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/parse.js +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/regex.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/regex.js +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/rng.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/rng.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/sha1.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/sha1.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/stringify.d.ts +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/stringify.js +0 -39
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/types.d.ts +0 -21
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/types.js +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/uuid-bin.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/uuid-bin.js +0 -72
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v1.d.ts +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v1.js +0 -87
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v1ToV6.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v1ToV6.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v3.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v3.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v35.d.ts +0 -7
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v35.js +0 -44
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v4.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v4.js +0 -29
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v5.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v5.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v6.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v6.js +0 -22
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v6ToV1.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v6ToV1.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v7.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/v7.js +0 -69
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/validate.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/validate.js +0 -7
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/version.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs/version.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/index.d.ts +0 -15
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/index.js +0 -31
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/max.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/max.js +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/md5.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/md5.js +0 -137
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/native.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/native.js +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/nil.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/nil.js +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/package.json +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/parse.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/parse.js +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/regex.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/regex.js +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/rng.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/rng.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/sha1.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/sha1.js +0 -72
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/stringify.d.ts +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/stringify.js +0 -39
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/types.d.ts +0 -21
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/types.js +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/uuid-bin.js +0 -72
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v1.d.ts +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v1.js +0 -87
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v1ToV6.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v3.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v3.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v35.d.ts +0 -7
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v35.js +0 -44
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v4.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v4.js +0 -29
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v5.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v5.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v6.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v6.js +0 -22
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v6ToV1.js +0 -13
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v7.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/v7.js +0 -69
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/validate.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/validate.js +0 -7
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/version.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/cjs-browser/version.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/bin/uuid +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/index.d.ts +0 -15
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/index.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/max.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/max.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/md5.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/md5.js +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/native.d.ts +0 -6
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/native.js +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/nil.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/nil.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/parse.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/parse.js +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/regex.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/regex.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/rng.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/rng.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/sha1.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/sha1.js +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/stringify.d.ts +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/stringify.js +0 -35
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/types.d.ts +0 -21
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/types.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/uuid-bin.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/uuid-bin.js +0 -70
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v1.d.ts +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v1.js +0 -83
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v1ToV6.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v1ToV6.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v3.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v3.js +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v35.d.ts +0 -7
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v35.js +0 -39
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v4.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v4.js +0 -27
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v5.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v5.js +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v6.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v6.js +0 -20
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v6ToV1.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v6ToV1.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v7.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/v7.js +0 -65
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/validate.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/validate.js +0 -5
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/version.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm/version.js +0 -8
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/index.d.ts +0 -15
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/index.js +0 -14
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/max.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/max.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/md5.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/md5.js +0 -135
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/native.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/native.js +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/nil.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/nil.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/parse.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/parse.js +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/regex.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/rng.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/rng.js +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/sha1.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/sha1.js +0 -70
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/stringify.d.ts +0 -3
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/stringify.js +0 -35
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/types.d.ts +0 -21
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/types.js +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +0 -1
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/uuid-bin.js +0 -70
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v1.d.ts +0 -11
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v1.js +0 -83
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v1ToV6.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v3.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v3.js +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v35.d.ts +0 -7
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v35.js +0 -39
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v4.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v4.js +0 -27
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v5.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v5.js +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v6.d.ts +0 -4
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v6.js +0 -20
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v6ToV1.js +0 -10
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v7.d.ts +0 -9
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/v7.js +0 -65
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/validate.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/validate.js +0 -5
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/version.d.ts +0 -2
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/dist/esm-browser/version.js +0 -8
- package/dist/node_modules/langchain-gigachat/node_modules/uuid/package.json +0 -132
|
@@ -2,14 +2,16 @@ import utils from '../utils.js';
|
|
|
2
2
|
import settle from '../core/settle.js';
|
|
3
3
|
import buildFullPath from '../core/buildFullPath.js';
|
|
4
4
|
import buildURL from '../helpers/buildURL.js';
|
|
5
|
-
import
|
|
5
|
+
import { getProxyForUrl } from 'proxy-from-env';
|
|
6
|
+
import HttpsProxyAgent from 'https-proxy-agent';
|
|
6
7
|
import http from 'http';
|
|
7
8
|
import https from 'https';
|
|
8
9
|
import http2 from 'http2';
|
|
9
10
|
import util from 'util';
|
|
11
|
+
import { resolve as resolvePath } from 'path';
|
|
10
12
|
import followRedirects from 'follow-redirects';
|
|
11
13
|
import zlib from 'zlib';
|
|
12
|
-
import {VERSION} from '../env/data.js';
|
|
14
|
+
import { VERSION } from '../env/data.js';
|
|
13
15
|
import transitionalDefaults from '../defaults/transitional.js';
|
|
14
16
|
import AxiosError from '../core/AxiosError.js';
|
|
15
17
|
import CanceledError from '../cancel/CanceledError.js';
|
|
@@ -18,153 +20,231 @@ import fromDataURI from '../helpers/fromDataURI.js';
|
|
|
18
20
|
import stream from 'stream';
|
|
19
21
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
|
20
22
|
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
|
|
21
|
-
import {EventEmitter} from 'events';
|
|
22
|
-
import formDataToStream from
|
|
23
|
-
import readBlob from
|
|
23
|
+
import { EventEmitter } from 'events';
|
|
24
|
+
import formDataToStream from '../helpers/formDataToStream.js';
|
|
25
|
+
import readBlob from '../helpers/readBlob.js';
|
|
24
26
|
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
+
import Http2Sessions from '../helpers/Http2Sessions.js';
|
|
28
|
+
import callbackify from '../helpers/callbackify.js';
|
|
29
|
+
import shouldBypassProxy from '../helpers/shouldBypassProxy.js';
|
|
30
|
+
import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
|
|
31
|
+
import {
|
|
32
|
+
progressEventReducer,
|
|
33
|
+
progressEventDecorator,
|
|
34
|
+
asyncDecorator,
|
|
35
|
+
} from '../helpers/progressEventReducer.js';
|
|
27
36
|
import estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';
|
|
28
37
|
|
|
29
38
|
const zlibOptions = {
|
|
30
39
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
31
|
-
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
40
|
+
finishFlush: zlib.constants.Z_SYNC_FLUSH,
|
|
32
41
|
};
|
|
33
42
|
|
|
34
43
|
const brotliOptions = {
|
|
35
44
|
flush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
|
36
|
-
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
|
37
|
-
}
|
|
45
|
+
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const zstdOptions = {
|
|
49
|
+
flush: zlib.constants.ZSTD_e_flush,
|
|
50
|
+
finishFlush: zlib.constants.ZSTD_e_flush,
|
|
51
|
+
};
|
|
38
52
|
|
|
39
53
|
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
|
54
|
+
const isZstdSupported = utils.isFunction(zlib.createZstdDecompress);
|
|
55
|
+
const ACCEPT_ENCODING = 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : '');
|
|
56
|
+
const ACCEPT_ENCODING_WITH_ZSTD = ACCEPT_ENCODING + (isZstdSupported ? ', zstd' : '');
|
|
40
57
|
|
|
41
|
-
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|
58
|
+
const { http: httpFollow, https: httpsFollow } = followRedirects;
|
|
42
59
|
|
|
43
60
|
const isHttps = /https:?/;
|
|
61
|
+
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
44
62
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
51
|
-
stream
|
|
52
|
-
.on('end', flush)
|
|
53
|
-
.on('error', flush);
|
|
54
|
-
|
|
55
|
-
return throttled;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class Http2Sessions {
|
|
59
|
-
constructor() {
|
|
60
|
-
this.sessions = Object.create(null);
|
|
63
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
64
|
+
if (policy !== 'content-only') {
|
|
65
|
+
headers.set(formHeaders);
|
|
66
|
+
return;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, options);
|
|
67
|
-
|
|
68
|
-
let authoritySessions = this.sessions[authority];
|
|
69
|
-
|
|
70
|
-
if (authoritySessions) {
|
|
71
|
-
let len = authoritySessions.length;
|
|
72
|
-
|
|
73
|
-
for (let i = 0; i < len; i++) {
|
|
74
|
-
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
|
75
|
-
if (!sessionHandle.destroyed && !sessionHandle.closed && util.isDeepStrictEqual(sessionOptions, options)) {
|
|
76
|
-
return sessionHandle;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
69
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
70
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
71
|
+
headers.set(key, val);
|
|
79
72
|
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
// Symbols used to bind a single 'error' listener to a pooled socket and track
|
|
77
|
+
// the request currently owning that socket across keep-alive reuse (issue #10780).
|
|
78
|
+
const kAxiosSocketListener = Symbol('axios.http.socketListener');
|
|
79
|
+
const kAxiosCurrentReq = Symbol('axios.http.currentReq');
|
|
80
|
+
|
|
81
|
+
// Tags HttpsProxyAgent instances installed by setProxy() so the redirect path
|
|
82
|
+
// can strip them without clobbering a user-supplied agent that happens to be
|
|
83
|
+
// an HttpsProxyAgent.
|
|
84
|
+
const kAxiosInstalledTunnel = Symbol('axios.http.installedTunnel');
|
|
85
|
+
|
|
86
|
+
// Cache of CONNECT-tunneling agents keyed by proxy config so repeat requests
|
|
87
|
+
// through the same proxy reuse a single agent (and its socket pool). The
|
|
88
|
+
// keyspace is bounded by the set of distinct proxy configs the process uses,
|
|
89
|
+
// so unbounded growth is not a concern in practice.
|
|
90
|
+
const tunnelingAgentCache = new Map();
|
|
91
|
+
const tunnelingAgentCacheUser = new WeakMap();
|
|
92
|
+
// Minimum minor versions where Node's HTTP Agent supports native proxyEnv
|
|
93
|
+
// handling. Checking the selected agent below also covers startup modes such
|
|
94
|
+
// as NODE_OPTIONS=--use-env-proxy and --no-use-env-proxy precedence.
|
|
95
|
+
const NODE_NATIVE_ENV_PROXY_SUPPORT = {
|
|
96
|
+
22: 21,
|
|
97
|
+
24: 5,
|
|
98
|
+
};
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
function isNodeNativeEnvProxySupported(nodeVersion = process.versions && process.versions.node) {
|
|
101
|
+
if (!nodeVersion) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
93
104
|
|
|
94
|
-
|
|
95
|
-
if (entries[i][0] === session) {
|
|
96
|
-
if (len === 1) {
|
|
97
|
-
delete this.sessions[authority];
|
|
98
|
-
} else {
|
|
99
|
-
entries.splice(i, 1);
|
|
100
|
-
}
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
+
const [major, minor] = nodeVersion.split('.').map((part) => Number(part));
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
if (!Number.isInteger(major) || !Number.isInteger(minor)) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
if (major > 24) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
109
114
|
|
|
110
|
-
|
|
115
|
+
return (
|
|
116
|
+
NODE_NATIVE_ENV_PROXY_SUPPORT[major] != null && minor >= NODE_NATIVE_ENV_PROXY_SUPPORT[major]
|
|
117
|
+
);
|
|
118
|
+
}
|
|
111
119
|
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.versions.node) {
|
|
121
|
+
if (!isNodeNativeEnvProxySupported(nodeVersion)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
114
124
|
|
|
115
|
-
|
|
116
|
-
const stream = originalRequestFn.apply(this, arguments);
|
|
125
|
+
const agentOptions = agent && agent.options;
|
|
117
126
|
|
|
118
|
-
|
|
127
|
+
return Boolean(
|
|
128
|
+
agentOptions &&
|
|
129
|
+
utils.hasOwnProp(agentOptions, 'proxyEnv') &&
|
|
130
|
+
agentOptions.proxyEnv != null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
119
133
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
function getProxyEnvAgent(options, configHttpAgent, configHttpsAgent) {
|
|
135
|
+
return isHttps.test(options.protocol)
|
|
136
|
+
? (configHttpsAgent || https.globalAgent)
|
|
137
|
+
: (configHttpAgent || http.globalAgent);
|
|
138
|
+
}
|
|
124
139
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
140
|
+
function getTunnelingAgent(agentOptions, userHttpsAgent) {
|
|
141
|
+
const key =
|
|
142
|
+
agentOptions.protocol +
|
|
143
|
+
'//' +
|
|
144
|
+
agentOptions.hostname +
|
|
145
|
+
':' +
|
|
146
|
+
(agentOptions.port || '') +
|
|
147
|
+
'#' +
|
|
148
|
+
(agentOptions.auth || '');
|
|
149
|
+
const cache = userHttpsAgent
|
|
150
|
+
? (tunnelingAgentCacheUser.get(userHttpsAgent) ||
|
|
151
|
+
tunnelingAgentCacheUser.set(userHttpsAgent, new Map()).get(userHttpsAgent))
|
|
152
|
+
: tunnelingAgentCache;
|
|
153
|
+
let agent = cache.get(key);
|
|
154
|
+
if (agent) return agent;
|
|
155
|
+
// Forward the user's TLS options (custom CA, rejectUnauthorized, client cert,
|
|
156
|
+
// etc.) into the tunneling agent so they apply to the origin TLS upgrade
|
|
157
|
+
// performed after CONNECT. Our proxy fields take precedence on conflict.
|
|
158
|
+
const merged = userHttpsAgent && userHttpsAgent.options
|
|
159
|
+
? { ...userHttpsAgent.options, ...agentOptions }
|
|
160
|
+
: agentOptions;
|
|
161
|
+
agent = new HttpsProxyAgent(merged);
|
|
162
|
+
if (userHttpsAgent && userHttpsAgent.options) {
|
|
163
|
+
const originTLSOptions = { ...userHttpsAgent.options };
|
|
164
|
+
const callback = agent.callback;
|
|
165
|
+
agent.callback = function axiosTunnelingAgentCallback(req, opts) {
|
|
166
|
+
// HttpsProxyAgent v5 reads callback opts for the post-CONNECT origin TLS upgrade.
|
|
167
|
+
return callback.call(this, req, { ...originTLSOptions, ...opts });
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
agent[kAxiosInstalledTunnel] = true;
|
|
171
|
+
cache.set(key, agent);
|
|
172
|
+
return agent;
|
|
173
|
+
}
|
|
133
174
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
175
|
+
const supportedProtocols = platform.protocols.map((protocol) => {
|
|
176
|
+
return protocol + ':';
|
|
177
|
+
});
|
|
137
178
|
|
|
138
|
-
|
|
179
|
+
// Node's WHATWG URL parser returns `username` and `password` percent-encoded.
|
|
180
|
+
// Decode before composing the `auth` option so credentials such as
|
|
181
|
+
// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
|
|
182
|
+
// original value for malformed input so a bad encoding never throws.
|
|
183
|
+
const decodeURIComponentSafe = (value) => {
|
|
184
|
+
if (!utils.isString(value)) {
|
|
185
|
+
return value;
|
|
186
|
+
}
|
|
139
187
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
188
|
+
try {
|
|
189
|
+
return decodeURIComponent(value);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
144
194
|
|
|
145
|
-
|
|
195
|
+
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
196
|
+
stream.on('end', flush).on('error', flush);
|
|
146
197
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
198
|
+
return throttled;
|
|
199
|
+
};
|
|
150
200
|
|
|
151
201
|
const http2Sessions = new Http2Sessions();
|
|
152
202
|
|
|
153
|
-
|
|
154
203
|
/**
|
|
155
|
-
* If the proxy or config beforeRedirects functions are defined,
|
|
156
|
-
* object.
|
|
204
|
+
* If the proxy, auth, sensitive header, or config beforeRedirects functions are defined,
|
|
205
|
+
* call them with the options object.
|
|
157
206
|
*
|
|
158
207
|
* @param {Object<string, any>} options - The options object that was passed to the request.
|
|
159
208
|
*
|
|
160
209
|
* @returns {Object<string, any>}
|
|
161
210
|
*/
|
|
162
|
-
function dispatchBeforeRedirect(options, responseDetails) {
|
|
211
|
+
function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
163
212
|
if (options.beforeRedirects.proxy) {
|
|
164
213
|
options.beforeRedirects.proxy(options);
|
|
165
214
|
}
|
|
215
|
+
if (options.beforeRedirects.auth) {
|
|
216
|
+
options.beforeRedirects.auth(options);
|
|
217
|
+
}
|
|
218
|
+
if (options.beforeRedirects.sensitiveHeaders) {
|
|
219
|
+
options.beforeRedirects.sensitiveHeaders(options, requestDetails);
|
|
220
|
+
}
|
|
166
221
|
if (options.beforeRedirects.config) {
|
|
167
|
-
options.beforeRedirects.config(options, responseDetails);
|
|
222
|
+
options.beforeRedirects.config(options, responseDetails, requestDetails);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function stripMatchingHeaders(headers, sensitiveSet) {
|
|
227
|
+
if (!headers) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
Object.keys(headers).forEach((header) => {
|
|
232
|
+
if (sensitiveSet.has(header.toLowerCase())) {
|
|
233
|
+
delete headers[header];
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function isSameOriginRedirect(redirectOptions, requestDetails) {
|
|
239
|
+
if (!requestDetails) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
try {
|
|
244
|
+
return new URL(requestDetails.url).origin === new URL(redirectOptions.href).origin;
|
|
245
|
+
} catch (e) {
|
|
246
|
+
// If origin comparison fails, treat the redirect as unsafe.
|
|
247
|
+
return false;
|
|
168
248
|
}
|
|
169
249
|
}
|
|
170
250
|
|
|
@@ -177,55 +257,173 @@ function dispatchBeforeRedirect(options, responseDetails) {
|
|
|
177
257
|
*
|
|
178
258
|
* @returns {http.ClientRequestArgs}
|
|
179
259
|
*/
|
|
180
|
-
function setProxy(options, configProxy, location) {
|
|
260
|
+
function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
|
|
181
261
|
let proxy = configProxy;
|
|
182
|
-
|
|
183
|
-
|
|
262
|
+
const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
|
|
263
|
+
if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
264
|
+
const proxyUrl = getProxyForUrl(location);
|
|
184
265
|
if (proxyUrl) {
|
|
185
|
-
|
|
266
|
+
if (!shouldBypassProxy(location)) {
|
|
267
|
+
proxy = new URL(proxyUrl);
|
|
268
|
+
}
|
|
186
269
|
}
|
|
187
270
|
}
|
|
271
|
+
// On redirect re-invocation, strip any stale Proxy-Authorization header carried
|
|
272
|
+
// over from the prior request (e.g. new target no longer uses a proxy, or uses
|
|
273
|
+
// a different proxy). Skip on the initial request so user-supplied headers are
|
|
274
|
+
// preserved. Header names are case-insensitive, so remove every case variant.
|
|
275
|
+
if (isRedirect && options.headers) {
|
|
276
|
+
for (const name of Object.keys(options.headers)) {
|
|
277
|
+
if (name.toLowerCase() === 'proxy-authorization') {
|
|
278
|
+
delete options.headers[name];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// Strip any tunneling agent we installed for the previous hop so a redirect
|
|
283
|
+
// that drops the proxy or crosses an HTTPS↔HTTP boundary doesn't reuse a
|
|
284
|
+
// stale one. Match on our Symbol marker so a user-supplied HttpsProxyAgent
|
|
285
|
+
// (which won't carry the marker) is left alone.
|
|
286
|
+
if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
|
|
287
|
+
options.agent = undefined;
|
|
288
|
+
}
|
|
188
289
|
if (proxy) {
|
|
290
|
+
// Read proxy fields without traversing the prototype chain. URL instances expose
|
|
291
|
+
// username/password/hostname/host/port/protocol via getters on URL.prototype (so
|
|
292
|
+
// direct reads are shielded), but plain object proxies — and the `auth` field
|
|
293
|
+
// (which URL does not expose) — must be guarded so a polluted Object.prototype
|
|
294
|
+
// (e.g. Object.prototype.auth = { username, password }) cannot inject
|
|
295
|
+
// attacker-controlled credentials into the Proxy-Authorization header or
|
|
296
|
+
// redirect proxying to an attacker-controlled host.
|
|
297
|
+
const isProxyURL = proxy instanceof URL;
|
|
298
|
+
const readProxyField = (key) =>
|
|
299
|
+
isProxyURL || utils.hasOwnProp(proxy, key) ? proxy[key] : undefined;
|
|
300
|
+
|
|
301
|
+
const proxyUsername = readProxyField('username');
|
|
302
|
+
const proxyPassword = readProxyField('password');
|
|
303
|
+
let proxyAuth = utils.hasOwnProp(proxy, 'auth') ? proxy.auth : undefined;
|
|
304
|
+
|
|
189
305
|
// Basic proxy authorization
|
|
190
|
-
if (
|
|
191
|
-
|
|
306
|
+
if (proxyUsername) {
|
|
307
|
+
proxyAuth = (proxyUsername || '') + ':' + (proxyPassword || '');
|
|
192
308
|
}
|
|
193
309
|
|
|
194
|
-
if (
|
|
195
|
-
// Support proxy auth object form
|
|
196
|
-
|
|
310
|
+
if (proxyAuth) {
|
|
311
|
+
// Support proxy auth object form. Read sub-fields via own-prop checks so a
|
|
312
|
+
// plain object inheriting from polluted Object.prototype cannot leak creds.
|
|
313
|
+
const authIsObject = typeof proxyAuth === 'object';
|
|
314
|
+
const authUsername =
|
|
315
|
+
authIsObject && utils.hasOwnProp(proxyAuth, 'username') ? proxyAuth.username : undefined;
|
|
316
|
+
const authPassword =
|
|
317
|
+
authIsObject && utils.hasOwnProp(proxyAuth, 'password') ? proxyAuth.password : undefined;
|
|
318
|
+
const validProxyAuth = Boolean(authUsername || authPassword);
|
|
197
319
|
|
|
198
320
|
if (validProxyAuth) {
|
|
199
|
-
|
|
200
|
-
} else if (
|
|
321
|
+
proxyAuth = (authUsername || '') + ':' + (authPassword || '');
|
|
322
|
+
} else if (authIsObject) {
|
|
201
323
|
throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, { proxy });
|
|
202
324
|
}
|
|
203
|
-
|
|
204
|
-
const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
|
|
205
|
-
|
|
206
|
-
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
207
325
|
}
|
|
208
326
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
options.
|
|
327
|
+
const targetIsHttps = isHttps.test(options.protocol);
|
|
328
|
+
|
|
329
|
+
if (targetIsHttps) {
|
|
330
|
+
// CONNECT-tunneling path for HTTPS targets. Preserves end-to-end TLS to
|
|
331
|
+
// the origin so the proxy cannot inspect the URL, headers, or body — the
|
|
332
|
+
// behavior already promised by THREATMODEL.md (T-R9). HttpsProxyAgent
|
|
333
|
+
// sends Proxy-Authorization on the CONNECT request only, never on the
|
|
334
|
+
// wrapped TLS request, which is why we don't stamp it onto
|
|
335
|
+
// options.headers here. If the user already supplied an HttpsProxyAgent,
|
|
336
|
+
// they own tunneling end-to-end and we leave them alone; otherwise we
|
|
337
|
+
// install our own tunneling agent and forward their TLS options (if any)
|
|
338
|
+
// so a custom httpsAgent for cert pinning / rejectUnauthorized still
|
|
339
|
+
// applies to the origin TLS upgrade.
|
|
340
|
+
if (!(configHttpsAgent instanceof HttpsProxyAgent)) {
|
|
341
|
+
const proxyHost = readProxyField('hostname') || readProxyField('host');
|
|
342
|
+
const proxyPort = readProxyField('port');
|
|
343
|
+
const rawProxyProtocol = readProxyField('protocol');
|
|
344
|
+
const normalizedProtocol = rawProxyProtocol
|
|
345
|
+
? rawProxyProtocol.includes(':')
|
|
346
|
+
? rawProxyProtocol
|
|
347
|
+
: `${rawProxyProtocol}:`
|
|
348
|
+
: 'http:';
|
|
349
|
+
// Bracket IPv6 literals for URL parsing; URL.hostname strips the
|
|
350
|
+
// brackets again on read so the agent receives the raw form.
|
|
351
|
+
const proxyHostForURL =
|
|
352
|
+
proxyHost && proxyHost.includes(':') && !proxyHost.startsWith('[')
|
|
353
|
+
? `[${proxyHost}]`
|
|
354
|
+
: proxyHost;
|
|
355
|
+
const proxyURL = new URL(
|
|
356
|
+
`${normalizedProtocol}//${proxyHostForURL}${proxyPort ? ':' + proxyPort : ''}`
|
|
357
|
+
);
|
|
358
|
+
const agentOptions = {
|
|
359
|
+
protocol: proxyURL.protocol,
|
|
360
|
+
hostname: proxyURL.hostname.replace(/^\[|\]$/g, ''),
|
|
361
|
+
port: proxyURL.port,
|
|
362
|
+
auth: proxyAuth && typeof proxyAuth === 'string' ? proxyAuth : undefined,
|
|
363
|
+
};
|
|
364
|
+
if (proxyURL.protocol === 'https:') {
|
|
365
|
+
agentOptions.ALPNProtocols = ['http/1.1'];
|
|
366
|
+
}
|
|
367
|
+
const tunnelingAgent = getTunnelingAgent(agentOptions, configHttpsAgent);
|
|
368
|
+
// Set both: `options.agent` is consumed by the native https.request path
|
|
369
|
+
// (maxRedirects === 0); `options.agents.https` is consumed by
|
|
370
|
+
// follow-redirects, which ignores `options.agent` when `options.agents`
|
|
371
|
+
// is present.
|
|
372
|
+
options.agent = tunnelingAgent;
|
|
373
|
+
if (options.agents) {
|
|
374
|
+
options.agents.https = tunnelingAgent;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
// Forward-proxy mode for plaintext HTTP targets. The request line carries
|
|
379
|
+
// the absolute URL and the proxy sees everything — acceptable for plain
|
|
380
|
+
// HTTP since the wire was already plaintext.
|
|
381
|
+
if (proxyAuth) {
|
|
382
|
+
const base64 = Buffer.from(proxyAuth, 'utf8').toString('base64');
|
|
383
|
+
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Preserve a user-supplied Host header (case-insensitive) so callers can override
|
|
387
|
+
// the value forwarded to the proxy; otherwise default to the request URL's host.
|
|
388
|
+
let hasUserHostHeader = false;
|
|
389
|
+
for (const name of Object.keys(options.headers)) {
|
|
390
|
+
if (name.toLowerCase() === 'host') {
|
|
391
|
+
hasUserHostHeader = true;
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (!hasUserHostHeader) {
|
|
396
|
+
options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
|
|
397
|
+
}
|
|
398
|
+
const proxyHost = readProxyField('hostname') || readProxyField('host');
|
|
399
|
+
options.hostname = proxyHost;
|
|
400
|
+
// Replace 'host' since options is not a URL object
|
|
401
|
+
options.host = proxyHost;
|
|
402
|
+
options.port = readProxyField('port');
|
|
403
|
+
options.path = location;
|
|
404
|
+
const proxyProtocol = readProxyField('protocol');
|
|
405
|
+
if (proxyProtocol) {
|
|
406
|
+
options.protocol = proxyProtocol.includes(':') ? proxyProtocol : `${proxyProtocol}:`;
|
|
407
|
+
}
|
|
218
408
|
}
|
|
219
409
|
}
|
|
220
410
|
|
|
221
411
|
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
|
|
222
412
|
// Configure proxy for redirected request, passing the original config proxy to apply
|
|
223
413
|
// the exact same logic as if the redirected request was performed by axios directly.
|
|
224
|
-
setProxy(
|
|
414
|
+
setProxy(
|
|
415
|
+
redirectOptions,
|
|
416
|
+
configProxy,
|
|
417
|
+
redirectOptions.href,
|
|
418
|
+
true,
|
|
419
|
+
configHttpsAgent,
|
|
420
|
+
configHttpAgent
|
|
421
|
+
);
|
|
225
422
|
};
|
|
226
423
|
}
|
|
227
424
|
|
|
228
|
-
const isHttpAdapterSupported =
|
|
425
|
+
const isHttpAdapterSupported =
|
|
426
|
+
typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
|
229
427
|
|
|
230
428
|
// temporary hotfix
|
|
231
429
|
|
|
@@ -238,7 +436,7 @@ const wrapAsync = (asyncExecutor) => {
|
|
|
238
436
|
if (isDone) return;
|
|
239
437
|
isDone = true;
|
|
240
438
|
onDone && onDone(value, isRejected);
|
|
241
|
-
}
|
|
439
|
+
};
|
|
242
440
|
|
|
243
441
|
const _resolve = (value) => {
|
|
244
442
|
done(value);
|
|
@@ -248,651 +446,972 @@ const wrapAsync = (asyncExecutor) => {
|
|
|
248
446
|
const _reject = (reason) => {
|
|
249
447
|
done(reason, true);
|
|
250
448
|
reject(reason);
|
|
251
|
-
}
|
|
449
|
+
};
|
|
252
450
|
|
|
253
451
|
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
|
254
|
-
})
|
|
452
|
+
});
|
|
255
453
|
};
|
|
256
454
|
|
|
257
|
-
const resolveFamily = ({address, family}) => {
|
|
455
|
+
const resolveFamily = ({ address, family }) => {
|
|
258
456
|
if (!utils.isString(address)) {
|
|
259
457
|
throw TypeError('address must be a string');
|
|
260
458
|
}
|
|
261
|
-
return
|
|
459
|
+
return {
|
|
262
460
|
address,
|
|
263
|
-
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
461
|
+
family: family || (address.indexOf('.') < 0 ? 6 : 4),
|
|
462
|
+
};
|
|
463
|
+
};
|
|
266
464
|
|
|
267
|
-
const buildAddressEntry = (address, family) =>
|
|
465
|
+
const buildAddressEntry = (address, family) =>
|
|
466
|
+
resolveFamily(utils.isObject(address) ? address : { address, family });
|
|
268
467
|
|
|
269
468
|
const http2Transport = {
|
|
270
469
|
request(options, cb) {
|
|
271
|
-
|
|
470
|
+
const authority =
|
|
471
|
+
options.protocol +
|
|
472
|
+
'//' +
|
|
473
|
+
options.hostname +
|
|
474
|
+
':' +
|
|
475
|
+
(options.port || (options.protocol === 'https:' ? 443 : 80));
|
|
272
476
|
|
|
477
|
+
const { http2Options, headers } = options;
|
|
273
478
|
|
|
274
|
-
|
|
479
|
+
const session = http2Sessions.getSession(authority, http2Options);
|
|
275
480
|
|
|
276
|
-
|
|
481
|
+
const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } =
|
|
482
|
+
http2.constants;
|
|
277
483
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
} = http2.constants;
|
|
284
|
-
|
|
285
|
-
const http2Headers = {
|
|
286
|
-
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
|
287
|
-
[HTTP2_HEADER_METHOD]: options.method,
|
|
288
|
-
[HTTP2_HEADER_PATH]: options.path,
|
|
289
|
-
}
|
|
484
|
+
const http2Headers = {
|
|
485
|
+
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
|
486
|
+
[HTTP2_HEADER_METHOD]: options.method,
|
|
487
|
+
[HTTP2_HEADER_PATH]: options.path,
|
|
488
|
+
};
|
|
290
489
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
490
|
+
utils.forEach(headers, (header, name) => {
|
|
491
|
+
name.charAt(0) !== ':' && (http2Headers[name] = header);
|
|
492
|
+
});
|
|
294
493
|
|
|
295
|
-
|
|
494
|
+
const req = session.request(http2Headers);
|
|
296
495
|
|
|
297
|
-
|
|
298
|
-
|
|
496
|
+
req.once('response', (responseHeaders) => {
|
|
497
|
+
const response = req; //duplex
|
|
299
498
|
|
|
300
|
-
|
|
499
|
+
responseHeaders = Object.assign({}, responseHeaders);
|
|
301
500
|
|
|
302
|
-
|
|
501
|
+
const status = responseHeaders[HTTP2_HEADER_STATUS];
|
|
303
502
|
|
|
304
|
-
|
|
503
|
+
delete responseHeaders[HTTP2_HEADER_STATUS];
|
|
305
504
|
|
|
306
|
-
|
|
505
|
+
response.headers = responseHeaders;
|
|
307
506
|
|
|
308
|
-
|
|
507
|
+
response.statusCode = +status;
|
|
309
508
|
|
|
310
|
-
|
|
311
|
-
|
|
509
|
+
cb(response);
|
|
510
|
+
});
|
|
312
511
|
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
}
|
|
512
|
+
return req;
|
|
513
|
+
},
|
|
514
|
+
};
|
|
316
515
|
|
|
317
516
|
/*eslint consistent-return:0*/
|
|
318
|
-
export default isHttpAdapterSupported &&
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
517
|
+
export default isHttpAdapterSupported &&
|
|
518
|
+
function httpAdapter(config) {
|
|
519
|
+
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
520
|
+
// Read config pollution-safely: own properties and members inherited from
|
|
521
|
+
// a non-Object.prototype source (e.g. an Object.create(defaults) template)
|
|
522
|
+
// are honored, but values injected onto a polluted Object.prototype are
|
|
523
|
+
// ignored. All behavior-affecting reads in this adapter go through own()
|
|
524
|
+
// so the protection boundary stays consistent.
|
|
525
|
+
const own = (key) => utils.getSafeProp(config, key);
|
|
526
|
+
const transitional = own('transitional') || transitionalDefaults;
|
|
527
|
+
let data = own('data');
|
|
528
|
+
let lookup = own('lookup');
|
|
529
|
+
let family = own('family');
|
|
530
|
+
let httpVersion = own('httpVersion');
|
|
531
|
+
if (httpVersion === undefined) httpVersion = 1;
|
|
532
|
+
let http2Options = own('http2Options');
|
|
533
|
+
const httpAgent = own('httpAgent');
|
|
534
|
+
const httpsAgent = own('httpsAgent');
|
|
535
|
+
const configProxy = own('proxy');
|
|
536
|
+
const responseType = own('responseType');
|
|
537
|
+
const responseEncoding = own('responseEncoding');
|
|
538
|
+
const socketPath = own('socketPath');
|
|
539
|
+
const method = own('method').toUpperCase();
|
|
540
|
+
const maxRedirects = own('maxRedirects');
|
|
541
|
+
const maxBodyLength = own('maxBodyLength');
|
|
542
|
+
const maxContentLength = own('maxContentLength');
|
|
543
|
+
const decompress = own('decompress');
|
|
544
|
+
let isDone;
|
|
545
|
+
let rejected = false;
|
|
546
|
+
let req;
|
|
547
|
+
let connectPhaseTimer;
|
|
548
|
+
|
|
549
|
+
httpVersion = +httpVersion;
|
|
550
|
+
|
|
551
|
+
if (Number.isNaN(httpVersion)) {
|
|
552
|
+
throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
|
|
553
|
+
}
|
|
332
554
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
555
|
+
if (httpVersion !== 1 && httpVersion !== 2) {
|
|
556
|
+
throw TypeError(`Unsupported protocol version '${httpVersion}'`);
|
|
557
|
+
}
|
|
336
558
|
|
|
337
|
-
|
|
559
|
+
const isHttp2 = httpVersion === 2;
|
|
338
560
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
561
|
+
if (lookup) {
|
|
562
|
+
const _lookup = callbackify(lookup, (value) => (utils.isArray(value) ? value : [value]));
|
|
563
|
+
// hotfix to support opt.all option which is required for node 20.x
|
|
564
|
+
lookup = (hostname, opt, cb) => {
|
|
565
|
+
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
566
|
+
if (err) {
|
|
567
|
+
return cb(err);
|
|
568
|
+
}
|
|
347
569
|
|
|
348
|
-
|
|
570
|
+
const addresses = utils.isArray(arg0)
|
|
571
|
+
? arg0.map((addr) => buildAddressEntry(addr))
|
|
572
|
+
: [buildAddressEntry(arg0, arg1)];
|
|
349
573
|
|
|
350
|
-
|
|
351
|
-
|
|
574
|
+
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
575
|
+
});
|
|
576
|
+
};
|
|
352
577
|
}
|
|
353
|
-
}
|
|
354
578
|
|
|
355
|
-
|
|
579
|
+
const abortEmitter = new EventEmitter();
|
|
356
580
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
581
|
+
function abort(reason) {
|
|
582
|
+
try {
|
|
583
|
+
abortEmitter.emit(
|
|
584
|
+
'abort',
|
|
585
|
+
!reason || reason.type ? new CanceledError(null, config, req) : reason
|
|
586
|
+
);
|
|
587
|
+
} catch (err) {
|
|
588
|
+
// ignore emit errors
|
|
589
|
+
}
|
|
362
590
|
}
|
|
363
|
-
}
|
|
364
591
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
592
|
+
function clearConnectPhaseTimer() {
|
|
593
|
+
if (connectPhaseTimer) {
|
|
594
|
+
clearTimeout(connectPhaseTimer);
|
|
595
|
+
connectPhaseTimer = null;
|
|
596
|
+
}
|
|
370
597
|
}
|
|
371
598
|
|
|
372
|
-
|
|
373
|
-
|
|
599
|
+
function createTimeoutError() {
|
|
600
|
+
const configTimeout = own('timeout');
|
|
601
|
+
let timeoutErrorMessage = configTimeout
|
|
602
|
+
? 'timeout of ' + configTimeout + 'ms exceeded'
|
|
603
|
+
: 'timeout exceeded';
|
|
604
|
+
const configTimeoutErrorMessage = own('timeoutErrorMessage');
|
|
605
|
+
if (configTimeoutErrorMessage) {
|
|
606
|
+
timeoutErrorMessage = configTimeoutErrorMessage;
|
|
607
|
+
}
|
|
608
|
+
return new AxiosError(
|
|
609
|
+
timeoutErrorMessage,
|
|
610
|
+
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
611
|
+
config,
|
|
612
|
+
req
|
|
613
|
+
);
|
|
374
614
|
}
|
|
375
615
|
|
|
376
|
-
abortEmitter.
|
|
377
|
-
}
|
|
616
|
+
abortEmitter.once('abort', reject);
|
|
378
617
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if (config.signal) {
|
|
382
|
-
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
618
|
+
const onFinished = () => {
|
|
619
|
+
clearConnectPhaseTimer();
|
|
385
620
|
|
|
386
|
-
|
|
387
|
-
|
|
621
|
+
if (config.cancelToken) {
|
|
622
|
+
config.cancelToken.unsubscribe(abort);
|
|
623
|
+
}
|
|
388
624
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
625
|
+
if (config.signal) {
|
|
626
|
+
config.signal.removeEventListener('abort', abort);
|
|
627
|
+
}
|
|
394
628
|
|
|
395
|
-
|
|
629
|
+
abortEmitter.removeAllListeners();
|
|
630
|
+
};
|
|
396
631
|
|
|
397
|
-
if (
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
} else {
|
|
403
|
-
onFinished();
|
|
632
|
+
if (config.cancelToken || config.signal) {
|
|
633
|
+
config.cancelToken && config.cancelToken.subscribe(abort);
|
|
634
|
+
if (config.signal) {
|
|
635
|
+
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
|
636
|
+
}
|
|
404
637
|
}
|
|
405
|
-
});
|
|
406
638
|
|
|
639
|
+
onDone((response, isRejected) => {
|
|
640
|
+
isDone = true;
|
|
641
|
+
clearConnectPhaseTimer();
|
|
407
642
|
|
|
643
|
+
if (isRejected) {
|
|
644
|
+
rejected = true;
|
|
645
|
+
onFinished();
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
408
648
|
|
|
649
|
+
const { data } = response;
|
|
409
650
|
|
|
651
|
+
if (data instanceof stream.Readable || data instanceof stream.Duplex) {
|
|
652
|
+
const offListeners = stream.finished(data, () => {
|
|
653
|
+
offListeners();
|
|
654
|
+
onFinished();
|
|
655
|
+
});
|
|
656
|
+
} else {
|
|
657
|
+
onFinished();
|
|
658
|
+
}
|
|
659
|
+
});
|
|
410
660
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
661
|
+
// Parse url
|
|
662
|
+
const fullPath = buildFullPath(own('baseURL'), own('url'), own('allowAbsoluteUrls'), config);
|
|
663
|
+
// Unix-socket requests (own socketPath) commonly pass a path-only url
|
|
664
|
+
// like '/foo'; supply a synthetic base so new URL() can still parse it.
|
|
665
|
+
// Use the own-property value (not config.socketPath) so a polluted
|
|
666
|
+
// prototype cannot influence URL base selection.
|
|
667
|
+
const urlBase = socketPath
|
|
668
|
+
? 'http://localhost'
|
|
669
|
+
: (platform.hasBrowserEnv ? platform.origin : undefined);
|
|
670
|
+
const parsed = new URL(fullPath, urlBase);
|
|
671
|
+
const protocol = parsed.protocol || supportedProtocols[0];
|
|
672
|
+
|
|
673
|
+
if (protocol === 'data:') {
|
|
674
|
+
// Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
|
|
675
|
+
if (maxContentLength > -1) {
|
|
676
|
+
// Use the exact string passed to fromDataURI (the configured url); fall back to fullPath if needed.
|
|
677
|
+
const dataUrl = String(own('url') || fullPath || '');
|
|
678
|
+
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
|
679
|
+
|
|
680
|
+
if (estimated > maxContentLength) {
|
|
681
|
+
return reject(
|
|
682
|
+
new AxiosError(
|
|
683
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
684
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
685
|
+
config
|
|
686
|
+
)
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
415
690
|
|
|
416
|
-
|
|
417
|
-
// Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
|
|
418
|
-
if (config.maxContentLength > -1) {
|
|
419
|
-
// Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
|
|
420
|
-
const dataUrl = String(config.url || fullPath || '');
|
|
421
|
-
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
|
691
|
+
let convertedData;
|
|
422
692
|
|
|
423
|
-
if (
|
|
424
|
-
return
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
693
|
+
if (method !== 'GET') {
|
|
694
|
+
return settle(resolve, reject, {
|
|
695
|
+
status: 405,
|
|
696
|
+
statusText: 'method not allowed',
|
|
697
|
+
headers: {},
|
|
698
|
+
config,
|
|
699
|
+
});
|
|
429
700
|
}
|
|
430
|
-
}
|
|
431
701
|
|
|
432
|
-
|
|
702
|
+
try {
|
|
703
|
+
convertedData = fromDataURI(own('url'), responseType === 'blob', {
|
|
704
|
+
Blob: config.env && config.env.Blob,
|
|
705
|
+
});
|
|
706
|
+
} catch (err) {
|
|
707
|
+
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (responseType === 'text') {
|
|
711
|
+
convertedData = convertedData.toString(responseEncoding);
|
|
712
|
+
|
|
713
|
+
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
714
|
+
convertedData = utils.stripBOM(convertedData);
|
|
715
|
+
}
|
|
716
|
+
} else if (responseType === 'stream') {
|
|
717
|
+
convertedData = stream.Readable.from(convertedData);
|
|
718
|
+
}
|
|
433
719
|
|
|
434
|
-
if (method !== 'GET') {
|
|
435
720
|
return settle(resolve, reject, {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
721
|
+
data: convertedData,
|
|
722
|
+
status: 200,
|
|
723
|
+
statusText: 'OK',
|
|
724
|
+
headers: new AxiosHeaders(),
|
|
725
|
+
config,
|
|
440
726
|
});
|
|
441
727
|
}
|
|
442
728
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
} catch (err) {
|
|
448
|
-
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
|
729
|
+
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
730
|
+
return reject(
|
|
731
|
+
new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config)
|
|
732
|
+
);
|
|
449
733
|
}
|
|
450
734
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
735
|
+
const headers = AxiosHeaders.from(config.headers).normalize();
|
|
736
|
+
|
|
737
|
+
// Set User-Agent (required by some servers)
|
|
738
|
+
// See https://github.com/axios/axios/issues/69
|
|
739
|
+
// User-Agent is specified; handle case where no UA header is desired
|
|
740
|
+
// Only set header if it hasn't been set in config
|
|
741
|
+
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
742
|
+
|
|
743
|
+
const { onUploadProgress, onDownloadProgress } = config;
|
|
744
|
+
const maxRate = config.maxRate;
|
|
745
|
+
let maxUploadRate = undefined;
|
|
746
|
+
let maxDownloadRate = undefined;
|
|
747
|
+
|
|
748
|
+
// support for spec compliant FormData objects
|
|
749
|
+
if (utils.isSpecCompliantForm(data)) {
|
|
750
|
+
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
751
|
+
|
|
752
|
+
data = formDataToStream(
|
|
753
|
+
data,
|
|
754
|
+
(formHeaders) => {
|
|
755
|
+
headers.set(formHeaders);
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
tag: `axios-${VERSION}-boundary`,
|
|
759
|
+
boundary: (userBoundary && userBoundary[1]) || undefined,
|
|
760
|
+
}
|
|
761
|
+
);
|
|
762
|
+
// support for https://www.npmjs.com/package/form-data api
|
|
763
|
+
} else if (
|
|
764
|
+
utils.isFormData(data) &&
|
|
765
|
+
utils.isFunction(data.getHeaders) &&
|
|
766
|
+
data.getHeaders !== Object.prototype.getHeaders
|
|
767
|
+
) {
|
|
768
|
+
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
769
|
+
|
|
770
|
+
if (!headers.hasContentLength()) {
|
|
771
|
+
try {
|
|
772
|
+
const knownLength = await util.promisify(data.getLength).call(data);
|
|
773
|
+
Number.isFinite(knownLength) &&
|
|
774
|
+
knownLength >= 0 &&
|
|
775
|
+
headers.setContentLength(knownLength);
|
|
776
|
+
/*eslint no-empty:0*/
|
|
777
|
+
} catch (e) {}
|
|
778
|
+
}
|
|
779
|
+
} else if (utils.isBlob(data) || utils.isFile(data)) {
|
|
780
|
+
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
|
781
|
+
headers.setContentLength(data.size || 0);
|
|
782
|
+
data = stream.Readable.from(readBlob(data));
|
|
783
|
+
} else if (data && !utils.isStream(data)) {
|
|
784
|
+
if (Buffer.isBuffer(data)) {
|
|
785
|
+
// Nothing to do...
|
|
786
|
+
} else if (utils.isArrayBuffer(data)) {
|
|
787
|
+
data = Buffer.from(new Uint8Array(data));
|
|
788
|
+
} else if (utils.isString(data)) {
|
|
789
|
+
data = Buffer.from(data, 'utf-8');
|
|
790
|
+
} else {
|
|
791
|
+
return reject(
|
|
792
|
+
new AxiosError(
|
|
793
|
+
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
|
794
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
795
|
+
config
|
|
796
|
+
)
|
|
797
|
+
);
|
|
456
798
|
}
|
|
457
|
-
} else if (responseType === 'stream') {
|
|
458
|
-
convertedData = stream.Readable.from(convertedData);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
return settle(resolve, reject, {
|
|
462
|
-
data: convertedData,
|
|
463
|
-
status: 200,
|
|
464
|
-
statusText: 'OK',
|
|
465
|
-
headers: new AxiosHeaders(),
|
|
466
|
-
config
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
471
|
-
return reject(new AxiosError(
|
|
472
|
-
'Unsupported protocol ' + protocol,
|
|
473
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
474
|
-
config
|
|
475
|
-
));
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
const headers = AxiosHeaders.from(config.headers).normalize();
|
|
479
|
-
|
|
480
|
-
// Set User-Agent (required by some servers)
|
|
481
|
-
// See https://github.com/axios/axios/issues/69
|
|
482
|
-
// User-Agent is specified; handle case where no UA header is desired
|
|
483
|
-
// Only set header if it hasn't been set in config
|
|
484
|
-
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
485
|
-
|
|
486
|
-
const {onUploadProgress, onDownloadProgress} = config;
|
|
487
|
-
const maxRate = config.maxRate;
|
|
488
|
-
let maxUploadRate = undefined;
|
|
489
|
-
let maxDownloadRate = undefined;
|
|
490
|
-
|
|
491
|
-
// support for spec compliant FormData objects
|
|
492
|
-
if (utils.isSpecCompliantForm(data)) {
|
|
493
|
-
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
494
799
|
|
|
495
|
-
|
|
496
|
-
headers.
|
|
497
|
-
}, {
|
|
498
|
-
tag: `axios-${VERSION}-boundary`,
|
|
499
|
-
boundary: userBoundary && userBoundary[1] || undefined
|
|
500
|
-
});
|
|
501
|
-
// support for https://www.npmjs.com/package/form-data api
|
|
502
|
-
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
|
503
|
-
headers.set(data.getHeaders());
|
|
800
|
+
// Add Content-Length header if data exists
|
|
801
|
+
headers.setContentLength(data.length, false);
|
|
504
802
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
803
|
+
if (maxBodyLength > -1 && data.length > maxBodyLength) {
|
|
804
|
+
return reject(
|
|
805
|
+
new AxiosError(
|
|
806
|
+
'Request body larger than maxBodyLength limit',
|
|
807
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
808
|
+
config
|
|
809
|
+
)
|
|
810
|
+
);
|
|
511
811
|
}
|
|
512
812
|
}
|
|
513
|
-
} else if (utils.isBlob(data) || utils.isFile(data)) {
|
|
514
|
-
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
|
515
|
-
headers.setContentLength(data.size || 0);
|
|
516
|
-
data = stream.Readable.from(readBlob(data));
|
|
517
|
-
} else if (data && !utils.isStream(data)) {
|
|
518
|
-
if (Buffer.isBuffer(data)) {
|
|
519
|
-
// Nothing to do...
|
|
520
|
-
} else if (utils.isArrayBuffer(data)) {
|
|
521
|
-
data = Buffer.from(new Uint8Array(data));
|
|
522
|
-
} else if (utils.isString(data)) {
|
|
523
|
-
data = Buffer.from(data, 'utf-8');
|
|
524
|
-
} else {
|
|
525
|
-
return reject(new AxiosError(
|
|
526
|
-
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
|
527
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
528
|
-
config
|
|
529
|
-
));
|
|
530
|
-
}
|
|
531
813
|
|
|
532
|
-
|
|
533
|
-
headers.setContentLength(data.length, false);
|
|
814
|
+
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
|
534
815
|
|
|
535
|
-
if (
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
));
|
|
816
|
+
if (utils.isArray(maxRate)) {
|
|
817
|
+
maxUploadRate = maxRate[0];
|
|
818
|
+
maxDownloadRate = maxRate[1];
|
|
819
|
+
} else {
|
|
820
|
+
maxUploadRate = maxDownloadRate = maxRate;
|
|
541
821
|
}
|
|
542
|
-
}
|
|
543
822
|
|
|
544
|
-
|
|
823
|
+
if (data && (onUploadProgress || maxUploadRate)) {
|
|
824
|
+
if (!utils.isStream(data)) {
|
|
825
|
+
data = stream.Readable.from(data, { objectMode: false });
|
|
826
|
+
}
|
|
545
827
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
828
|
+
data = stream.pipeline(
|
|
829
|
+
[
|
|
830
|
+
data,
|
|
831
|
+
new AxiosTransformStream({
|
|
832
|
+
maxRate: utils.toFiniteNumber(maxUploadRate),
|
|
833
|
+
}),
|
|
834
|
+
],
|
|
835
|
+
utils.noop
|
|
836
|
+
);
|
|
837
|
+
|
|
838
|
+
onUploadProgress &&
|
|
839
|
+
data.on(
|
|
840
|
+
'progress',
|
|
841
|
+
flushOnFinish(
|
|
842
|
+
data,
|
|
843
|
+
progressEventDecorator(
|
|
844
|
+
contentLength,
|
|
845
|
+
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
|
846
|
+
)
|
|
847
|
+
)
|
|
848
|
+
);
|
|
849
|
+
}
|
|
552
850
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
851
|
+
// HTTP basic authentication
|
|
852
|
+
let auth = undefined;
|
|
853
|
+
const configAuth = own('auth');
|
|
854
|
+
if (configAuth) {
|
|
855
|
+
const username = utils.getSafeProp(configAuth, 'username') || '';
|
|
856
|
+
const password = utils.getSafeProp(configAuth, 'password') || '';
|
|
857
|
+
auth = username + ':' + password;
|
|
556
858
|
}
|
|
557
859
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
data,
|
|
564
|
-
progressEventDecorator(
|
|
565
|
-
contentLength,
|
|
566
|
-
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
|
567
|
-
)
|
|
568
|
-
));
|
|
569
|
-
}
|
|
860
|
+
if (!auth && (parsed.username || parsed.password)) {
|
|
861
|
+
const urlUsername = decodeURIComponentSafe(parsed.username);
|
|
862
|
+
const urlPassword = decodeURIComponentSafe(parsed.password);
|
|
863
|
+
auth = urlUsername + ':' + urlPassword;
|
|
864
|
+
}
|
|
570
865
|
|
|
571
|
-
|
|
572
|
-
let auth = undefined;
|
|
573
|
-
if (config.auth) {
|
|
574
|
-
const username = config.auth.username || '';
|
|
575
|
-
const password = config.auth.password || '';
|
|
576
|
-
auth = username + ':' + password;
|
|
577
|
-
}
|
|
866
|
+
auth && headers.delete('authorization');
|
|
578
867
|
|
|
579
|
-
|
|
580
|
-
const urlUsername = parsed.username;
|
|
581
|
-
const urlPassword = parsed.password;
|
|
582
|
-
auth = urlUsername + ':' + urlPassword;
|
|
583
|
-
}
|
|
868
|
+
let path;
|
|
584
869
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
customErr.exists = true;
|
|
600
|
-
return reject(customErr);
|
|
601
|
-
}
|
|
870
|
+
try {
|
|
871
|
+
path = buildURL(
|
|
872
|
+
parsed.pathname + parsed.search,
|
|
873
|
+
own('params'),
|
|
874
|
+
own('paramsSerializer')
|
|
875
|
+
).replace(/^\?/, '');
|
|
876
|
+
} catch (err) {
|
|
877
|
+
return reject(
|
|
878
|
+
AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config, null, null, {
|
|
879
|
+
url: own('url'),
|
|
880
|
+
exists: true
|
|
881
|
+
})
|
|
882
|
+
);
|
|
883
|
+
}
|
|
602
884
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
885
|
+
headers.set(
|
|
886
|
+
'Accept-Encoding',
|
|
887
|
+
utils.hasOwnProp(transitional, 'advertiseZstdAcceptEncoding') &&
|
|
888
|
+
transitional.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
|
|
889
|
+
false
|
|
606
890
|
);
|
|
607
891
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
892
|
+
// Null-prototype to block prototype pollution gadgets on properties read
|
|
893
|
+
// directly by Node's http.request (e.g. insecureHTTPParser, lookup).
|
|
894
|
+
const options = Object.assign(Object.create(null), {
|
|
895
|
+
path,
|
|
896
|
+
method: method,
|
|
897
|
+
headers: toByteStringHeaderObject(headers),
|
|
898
|
+
agents: { http: httpAgent, https: httpsAgent },
|
|
899
|
+
auth,
|
|
900
|
+
protocol,
|
|
901
|
+
family,
|
|
902
|
+
beforeRedirect: dispatchBeforeRedirect,
|
|
903
|
+
beforeRedirects: Object.create(null),
|
|
904
|
+
http2Options,
|
|
905
|
+
});
|
|
620
906
|
|
|
621
|
-
|
|
622
|
-
|
|
907
|
+
// cacheable-lookup integration hotfix
|
|
908
|
+
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
|
623
909
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
910
|
+
if (socketPath) {
|
|
911
|
+
if (typeof socketPath !== 'string') {
|
|
912
|
+
return reject(
|
|
913
|
+
new AxiosError('socketPath must be a string', AxiosError.ERR_BAD_OPTION_VALUE, config)
|
|
914
|
+
);
|
|
915
|
+
}
|
|
631
916
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
917
|
+
const allowedSocketPaths = own('allowedSocketPaths');
|
|
918
|
+
if (allowedSocketPaths != null) {
|
|
919
|
+
const allowed = Array.isArray(allowedSocketPaths)
|
|
920
|
+
? allowedSocketPaths
|
|
921
|
+
: [allowedSocketPaths];
|
|
635
922
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
923
|
+
const resolvedSocket = resolvePath(socketPath);
|
|
924
|
+
const isAllowed = allowed.some(
|
|
925
|
+
(entry) => typeof entry === 'string' && resolvePath(entry) === resolvedSocket
|
|
926
|
+
);
|
|
927
|
+
|
|
928
|
+
if (!isAllowed) {
|
|
929
|
+
return reject(
|
|
930
|
+
new AxiosError(
|
|
931
|
+
`socketPath "${socketPath}" is not permitted by allowedSocketPaths`,
|
|
932
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
933
|
+
config
|
|
934
|
+
)
|
|
935
|
+
);
|
|
936
|
+
}
|
|
649
937
|
}
|
|
650
|
-
|
|
938
|
+
|
|
939
|
+
options.socketPath = socketPath;
|
|
940
|
+
} else {
|
|
941
|
+
options.hostname = parsed.hostname.startsWith('[')
|
|
942
|
+
? parsed.hostname.slice(1, -1)
|
|
943
|
+
: parsed.hostname;
|
|
944
|
+
options.port = parsed.port;
|
|
945
|
+
setProxy(
|
|
946
|
+
options,
|
|
947
|
+
configProxy,
|
|
948
|
+
protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path,
|
|
949
|
+
false,
|
|
950
|
+
httpsAgent,
|
|
951
|
+
httpAgent
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
let transport;
|
|
955
|
+
let isNativeTransport = false;
|
|
956
|
+
// True only for the follow-redirects transport, which applies
|
|
957
|
+
// options.maxBodyLength itself. Every other transport (http2, native
|
|
958
|
+
// http/https, a user-supplied custom transport) needs the explicit
|
|
959
|
+
// byte-counting pipeline below to enforce maxBodyLength on streamed uploads.
|
|
960
|
+
let transportEnforcesMaxBodyLength = false;
|
|
961
|
+
const isHttpsRequest = isHttps.test(options.protocol);
|
|
962
|
+
// Don't clobber a CONNECT-tunneling agent installed by setProxy() for an
|
|
963
|
+
// HTTPS target.
|
|
964
|
+
if (options.agent == null) {
|
|
965
|
+
options.agent = isHttpsRequest ? httpsAgent : httpAgent;
|
|
651
966
|
}
|
|
652
|
-
}
|
|
653
967
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
968
|
+
if (isHttp2) {
|
|
969
|
+
transport = http2Transport;
|
|
970
|
+
} else {
|
|
971
|
+
const configTransport = own('transport');
|
|
972
|
+
if (configTransport) {
|
|
973
|
+
transport = configTransport;
|
|
974
|
+
} else if (maxRedirects === 0) {
|
|
975
|
+
transport = isHttpsRequest ? https : http;
|
|
976
|
+
isNativeTransport = true;
|
|
977
|
+
} else {
|
|
978
|
+
transportEnforcesMaxBodyLength = true;
|
|
979
|
+
options.sensitiveHeaders = [];
|
|
980
|
+
if (maxRedirects) {
|
|
981
|
+
options.maxRedirects = maxRedirects;
|
|
982
|
+
}
|
|
983
|
+
const configBeforeRedirect = own('beforeRedirect');
|
|
984
|
+
if (configBeforeRedirect) {
|
|
985
|
+
options.beforeRedirects.config = configBeforeRedirect;
|
|
986
|
+
}
|
|
987
|
+
if (auth) {
|
|
988
|
+
// Restore HTTP Basic credentials on same-origin redirects only.
|
|
989
|
+
// follow-redirects >= 1.15.8 strips Authorization on every redirect (see #6929);
|
|
990
|
+
// cross-origin stripping is the documented mitigation for T-R2 in THREATMODEL.md
|
|
991
|
+
// and is preserved by deliberately not restoring on origin change.
|
|
992
|
+
const requestOrigin = parsed.origin;
|
|
993
|
+
const authToRestore = auth;
|
|
994
|
+
options.beforeRedirects.auth = function beforeRedirectAuth(redirectOptions) {
|
|
995
|
+
try {
|
|
996
|
+
if (new URL(redirectOptions.href).origin === requestOrigin) {
|
|
997
|
+
redirectOptions.auth = authToRestore;
|
|
998
|
+
}
|
|
999
|
+
} catch (e) {
|
|
1000
|
+
// ignore malformed URL: leaving auth stripped is fail-safe
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
const sensitiveHeaders = own('sensitiveHeaders');
|
|
1005
|
+
if (sensitiveHeaders != null) {
|
|
1006
|
+
if (!utils.isArray(sensitiveHeaders)) {
|
|
1007
|
+
return reject(
|
|
1008
|
+
new AxiosError(
|
|
1009
|
+
'sensitiveHeaders must be an array of strings',
|
|
1010
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
1011
|
+
config
|
|
1012
|
+
)
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
660
1015
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1016
|
+
const sensitiveSet = new Set();
|
|
1017
|
+
for (const header of sensitiveHeaders) {
|
|
1018
|
+
if (!utils.isString(header)) {
|
|
1019
|
+
return reject(
|
|
1020
|
+
new AxiosError(
|
|
1021
|
+
'sensitiveHeaders must be an array of strings',
|
|
1022
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
1023
|
+
config
|
|
1024
|
+
)
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
664
1027
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
if (req.destroyed) return;
|
|
1028
|
+
sensitiveSet.add(header.toLowerCase());
|
|
1029
|
+
}
|
|
668
1030
|
|
|
669
|
-
|
|
1031
|
+
if (sensitiveSet.size) {
|
|
1032
|
+
options.sensitiveHeaders = Array.from(sensitiveSet);
|
|
1033
|
+
options.beforeRedirects.sensitiveHeaders = function beforeRedirectSensitiveHeaders(
|
|
1034
|
+
redirectOptions,
|
|
1035
|
+
requestDetails
|
|
1036
|
+
) {
|
|
1037
|
+
if (!isSameOriginRedirect(redirectOptions, requestDetails)) {
|
|
1038
|
+
stripMatchingHeaders(redirectOptions.headers, sensitiveSet);
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
670
1046
|
|
|
671
|
-
|
|
1047
|
+
// Set an explicit maxBodyLength option for transports that inspect it.
|
|
1048
|
+
// When maxBodyLength is -1 (default/unlimited), use Infinity so
|
|
1049
|
+
// follow-redirects does not fall back to its own 10MB default.
|
|
1050
|
+
if (maxBodyLength > -1) {
|
|
1051
|
+
options.maxBodyLength = maxBodyLength;
|
|
1052
|
+
} else {
|
|
1053
|
+
options.maxBodyLength = Infinity;
|
|
1054
|
+
}
|
|
672
1055
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
1056
|
+
// Always set an explicit own value so a polluted
|
|
1057
|
+
// Object.prototype.insecureHTTPParser cannot enable the lenient parser
|
|
1058
|
+
// through Node's internal options copy
|
|
1059
|
+
options.insecureHTTPParser = Boolean(own('insecureHTTPParser'));
|
|
677
1060
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
responseLength,
|
|
682
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
|
683
|
-
)
|
|
684
|
-
));
|
|
1061
|
+
// Create the request
|
|
1062
|
+
req = transport.request(options, function handleResponse(res) {
|
|
1063
|
+
clearConnectPhaseTimer();
|
|
685
1064
|
|
|
686
|
-
|
|
687
|
-
}
|
|
1065
|
+
if (req.destroyed) return;
|
|
688
1066
|
|
|
689
|
-
|
|
690
|
-
let responseStream = res;
|
|
1067
|
+
const streams = [res];
|
|
691
1068
|
|
|
692
|
-
|
|
693
|
-
const lastRequest = res.req || req;
|
|
1069
|
+
const responseLength = utils.toFiniteNumber(res.headers['content-length']);
|
|
694
1070
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
if (method === 'HEAD' || res.statusCode === 204) {
|
|
700
|
-
delete res.headers['content-encoding'];
|
|
701
|
-
}
|
|
1071
|
+
if (onDownloadProgress || maxDownloadRate) {
|
|
1072
|
+
const transformStream = new AxiosTransformStream({
|
|
1073
|
+
maxRate: utils.toFiniteNumber(maxDownloadRate),
|
|
1074
|
+
});
|
|
702
1075
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
1076
|
+
onDownloadProgress &&
|
|
1077
|
+
transformStream.on(
|
|
1078
|
+
'progress',
|
|
1079
|
+
flushOnFinish(
|
|
1080
|
+
transformStream,
|
|
1081
|
+
progressEventDecorator(
|
|
1082
|
+
responseLength,
|
|
1083
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
|
1084
|
+
)
|
|
1085
|
+
)
|
|
1086
|
+
);
|
|
711
1087
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
break;
|
|
715
|
-
case 'deflate':
|
|
716
|
-
streams.push(new ZlibHeaderTransformStream());
|
|
1088
|
+
streams.push(transformStream);
|
|
1089
|
+
}
|
|
717
1090
|
|
|
718
|
-
|
|
719
|
-
|
|
1091
|
+
// decompress the response body transparently if required
|
|
1092
|
+
let responseStream = res;
|
|
720
1093
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1094
|
+
// return the last request in case of redirects
|
|
1095
|
+
const lastRequest = res.req || req;
|
|
1096
|
+
|
|
1097
|
+
// if decompress disabled we should not decompress
|
|
1098
|
+
if (decompress !== false && res.headers['content-encoding']) {
|
|
1099
|
+
// if no content, but headers still say that it is encoded,
|
|
1100
|
+
// remove the header not confuse downstream operations
|
|
1101
|
+
if (method === 'HEAD' || res.statusCode === 204) {
|
|
727
1102
|
delete res.headers['content-encoding'];
|
|
728
1103
|
}
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
733
1104
|
|
|
1105
|
+
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
|
|
1106
|
+
/*eslint default-case:0*/
|
|
1107
|
+
case 'gzip':
|
|
1108
|
+
case 'x-gzip':
|
|
1109
|
+
case 'compress':
|
|
1110
|
+
case 'x-compress':
|
|
1111
|
+
// add the unzipper to the body stream processing pipeline
|
|
1112
|
+
streams.push(zlib.createUnzip(zlibOptions));
|
|
1113
|
+
|
|
1114
|
+
// remove the content-encoding in order to not confuse downstream operations
|
|
1115
|
+
delete res.headers['content-encoding'];
|
|
1116
|
+
break;
|
|
1117
|
+
case 'deflate':
|
|
1118
|
+
streams.push(new ZlibHeaderTransformStream());
|
|
1119
|
+
|
|
1120
|
+
// add the unzipper to the body stream processing pipeline
|
|
1121
|
+
streams.push(zlib.createUnzip(zlibOptions));
|
|
1122
|
+
|
|
1123
|
+
// remove the content-encoding in order to not confuse downstream operations
|
|
1124
|
+
delete res.headers['content-encoding'];
|
|
1125
|
+
break;
|
|
1126
|
+
case 'br':
|
|
1127
|
+
if (isBrotliSupported) {
|
|
1128
|
+
streams.push(zlib.createBrotliDecompress(brotliOptions));
|
|
1129
|
+
delete res.headers['content-encoding'];
|
|
1130
|
+
}
|
|
1131
|
+
break;
|
|
1132
|
+
case 'zstd':
|
|
1133
|
+
if (isZstdSupported) {
|
|
1134
|
+
streams.push(zlib.createZstdDecompress(zstdOptions));
|
|
1135
|
+
delete res.headers['content-encoding'];
|
|
1136
|
+
}
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
734
1140
|
|
|
1141
|
+
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
735
1142
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
1143
|
+
const response = {
|
|
1144
|
+
status: res.statusCode,
|
|
1145
|
+
statusText: res.statusMessage,
|
|
1146
|
+
headers: new AxiosHeaders(res.headers),
|
|
1147
|
+
config,
|
|
1148
|
+
request: lastRequest,
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
if (responseType === 'stream') {
|
|
1152
|
+
// Enforce maxContentLength on streamed responses; previously this
|
|
1153
|
+
// was applied only to buffered responses.
|
|
1154
|
+
if (maxContentLength > -1) {
|
|
1155
|
+
const limit = maxContentLength;
|
|
1156
|
+
const source = responseStream;
|
|
1157
|
+
async function* enforceMaxContentLength() {
|
|
1158
|
+
let totalResponseBytes = 0;
|
|
1159
|
+
for await (const chunk of source) {
|
|
1160
|
+
totalResponseBytes += chunk.length;
|
|
1161
|
+
if (totalResponseBytes > limit) {
|
|
1162
|
+
throw new AxiosError(
|
|
1163
|
+
'maxContentLength size of ' + limit + ' exceeded',
|
|
1164
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
1165
|
+
config,
|
|
1166
|
+
lastRequest
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
yield chunk;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
responseStream = stream.Readable.from(enforceMaxContentLength(), {
|
|
1173
|
+
objectMode: false,
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
response.data = responseStream;
|
|
1177
|
+
settle(resolve, reject, response);
|
|
1178
|
+
} else {
|
|
1179
|
+
const responseBuffer = [];
|
|
1180
|
+
let totalResponseBytes = 0;
|
|
1181
|
+
|
|
1182
|
+
responseStream.on('data', function handleStreamData(chunk) {
|
|
1183
|
+
responseBuffer.push(chunk);
|
|
1184
|
+
totalResponseBytes += chunk.length;
|
|
1185
|
+
|
|
1186
|
+
// make sure the content length is not over the maxContentLength if specified
|
|
1187
|
+
if (maxContentLength > -1 && totalResponseBytes > maxContentLength) {
|
|
1188
|
+
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
|
1189
|
+
rejected = true;
|
|
1190
|
+
responseStream.destroy();
|
|
1191
|
+
abort(
|
|
1192
|
+
new AxiosError(
|
|
1193
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
1194
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
1195
|
+
config,
|
|
1196
|
+
lastRequest
|
|
1197
|
+
)
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
743
1201
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
const responseBuffer = [];
|
|
749
|
-
let totalResponseBytes = 0;
|
|
1202
|
+
responseStream.on('aborted', function handlerStreamAborted() {
|
|
1203
|
+
if (rejected) {
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
750
1206
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1207
|
+
const err = new AxiosError(
|
|
1208
|
+
'stream has been aborted',
|
|
1209
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
1210
|
+
config,
|
|
1211
|
+
lastRequest,
|
|
1212
|
+
response
|
|
1213
|
+
);
|
|
1214
|
+
responseStream.destroy(err);
|
|
1215
|
+
reject(err);
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
responseStream.on('error', function handleStreamError(err) {
|
|
1219
|
+
if (rejected) return;
|
|
1220
|
+
reject(AxiosError.from(err, null, config, lastRequest, response));
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
responseStream.on('end', function handleStreamEnd() {
|
|
1224
|
+
try {
|
|
1225
|
+
let responseData =
|
|
1226
|
+
responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
|
1227
|
+
if (responseType !== 'arraybuffer') {
|
|
1228
|
+
responseData = responseData.toString(responseEncoding);
|
|
1229
|
+
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
1230
|
+
responseData = utils.stripBOM(responseData);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
response.data = responseData;
|
|
1234
|
+
} catch (err) {
|
|
1235
|
+
return reject(AxiosError.from(err, null, config, response.request, response));
|
|
1236
|
+
}
|
|
1237
|
+
settle(resolve, reject, response);
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
754
1240
|
|
|
755
|
-
|
|
756
|
-
if (
|
|
757
|
-
|
|
758
|
-
rejected = true;
|
|
1241
|
+
abortEmitter.once('abort', (err) => {
|
|
1242
|
+
if (!responseStream.destroyed) {
|
|
1243
|
+
responseStream.emit('error', err);
|
|
759
1244
|
responseStream.destroy();
|
|
760
|
-
abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
761
|
-
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
|
762
1245
|
}
|
|
763
1246
|
});
|
|
1247
|
+
});
|
|
764
1248
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
1249
|
+
abortEmitter.once('abort', (err) => {
|
|
1250
|
+
if (req.close) {
|
|
1251
|
+
req.close();
|
|
1252
|
+
} else {
|
|
1253
|
+
req.destroy(err);
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
769
1256
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
lastRequest
|
|
775
|
-
);
|
|
776
|
-
responseStream.destroy(err);
|
|
777
|
-
reject(err);
|
|
778
|
-
});
|
|
1257
|
+
// Handle errors
|
|
1258
|
+
req.on('error', function handleRequestError(err) {
|
|
1259
|
+
reject(AxiosError.from(err, null, config, req));
|
|
1260
|
+
});
|
|
779
1261
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
1262
|
+
// set tcp keep alive to prevent drop connection by peer
|
|
1263
|
+
// Track every socket bound to this outer RedirectableRequest so a single
|
|
1264
|
+
// 'close' listener can release ownership on all of them. follow-redirects
|
|
1265
|
+
// re-emits the 'socket' event for each hop's native request onto the same
|
|
1266
|
+
// outer request, so attaching per-request listeners inside this handler
|
|
1267
|
+
// would accumulate across hops and trigger MaxListenersExceededWarning at
|
|
1268
|
+
// >= 11 redirects. Clearing only the last-bound socket would leave stale
|
|
1269
|
+
// kAxiosCurrentReq refs on earlier hop sockets returned to the keep-alive
|
|
1270
|
+
// pool, causing an idle-pool 'error' to be attributed to a closed req.
|
|
1271
|
+
const boundSockets = new Set();
|
|
1272
|
+
|
|
1273
|
+
req.on('socket', function handleRequestSocket(socket) {
|
|
1274
|
+
// default interval of sending ack packet is 1 minute
|
|
1275
|
+
// proxy agents (e.g. agent-base) may return a generic Duplex stream
|
|
1276
|
+
// that doesn't have setKeepAlive, so guard before calling
|
|
1277
|
+
if (typeof socket.setKeepAlive === 'function') {
|
|
1278
|
+
socket.setKeepAlive(true, 1000 * 60);
|
|
1279
|
+
}
|
|
784
1280
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1281
|
+
// Install a single 'error' listener per socket (not per request) to avoid
|
|
1282
|
+
// accumulating listeners on pooled keep-alive sockets that get reassigned
|
|
1283
|
+
// to new requests before the previous request's 'close' fires (issue #10780).
|
|
1284
|
+
// The listener is bound to the socket's currently-active request via a
|
|
1285
|
+
// symbol, which is swapped as the socket is reassigned.
|
|
1286
|
+
if (!socket[kAxiosSocketListener]) {
|
|
1287
|
+
socket.on('error', function handleSocketError(err) {
|
|
1288
|
+
const current = socket[kAxiosCurrentReq];
|
|
1289
|
+
if (current && !current.destroyed) {
|
|
1290
|
+
current.destroy(err);
|
|
793
1291
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return reject(AxiosError.from(err, null, config, response.request, response));
|
|
797
|
-
}
|
|
798
|
-
settle(resolve, reject, response);
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
abortEmitter.once('abort', err => {
|
|
803
|
-
if (!responseStream.destroyed) {
|
|
804
|
-
responseStream.emit('error', err);
|
|
805
|
-
responseStream.destroy();
|
|
1292
|
+
});
|
|
1293
|
+
socket[kAxiosSocketListener] = true;
|
|
806
1294
|
}
|
|
1295
|
+
|
|
1296
|
+
socket[kAxiosCurrentReq] = req;
|
|
1297
|
+
boundSockets.add(socket);
|
|
807
1298
|
});
|
|
808
|
-
});
|
|
809
1299
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
req.close();
|
|
813
|
-
} else {
|
|
814
|
-
req.destroy(err);
|
|
815
|
-
}
|
|
816
|
-
});
|
|
1300
|
+
req.once('close', function clearCurrentReq() {
|
|
1301
|
+
clearConnectPhaseTimer();
|
|
817
1302
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1303
|
+
for (const socket of boundSockets) {
|
|
1304
|
+
if (socket[kAxiosCurrentReq] === req) {
|
|
1305
|
+
socket[kAxiosCurrentReq] = null;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
boundSockets.clear();
|
|
1309
|
+
});
|
|
822
1310
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1311
|
+
// Handle request timeout
|
|
1312
|
+
if (own('timeout')) {
|
|
1313
|
+
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
1314
|
+
const timeout = parseInt(own('timeout'), 10);
|
|
1315
|
+
|
|
1316
|
+
if (Number.isNaN(timeout)) {
|
|
1317
|
+
abort(
|
|
1318
|
+
new AxiosError(
|
|
1319
|
+
'error trying to parse `config.timeout` to int',
|
|
1320
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
1321
|
+
config,
|
|
1322
|
+
req
|
|
1323
|
+
)
|
|
1324
|
+
);
|
|
828
1325
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
832
|
-
const timeout = parseInt(config.timeout, 10);
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
833
1328
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
config,
|
|
839
|
-
req
|
|
840
|
-
));
|
|
1329
|
+
const handleTimeout = function handleTimeout() {
|
|
1330
|
+
if (isDone) return;
|
|
1331
|
+
abort(createTimeoutError());
|
|
1332
|
+
};
|
|
841
1333
|
|
|
842
|
-
|
|
843
|
-
|
|
1334
|
+
if (isNativeTransport && timeout > 0) {
|
|
1335
|
+
// Native ClientRequest#setTimeout starts from the socket lifecycle and
|
|
1336
|
+
// may not fire while TCP connect is still pending. Mirror the
|
|
1337
|
+
// follow-redirects wall-clock timer for the maxRedirects === 0 path.
|
|
1338
|
+
connectPhaseTimer = setTimeout(handleTimeout, timeout);
|
|
1339
|
+
}
|
|
844
1340
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
856
|
-
}
|
|
857
|
-
abort(new AxiosError(
|
|
858
|
-
timeoutErrorMessage,
|
|
859
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
860
|
-
config,
|
|
861
|
-
req
|
|
862
|
-
));
|
|
863
|
-
});
|
|
864
|
-
} else {
|
|
865
|
-
// explicitly reset the socket timeout value for a possible `keep-alive` request
|
|
866
|
-
req.setTimeout(0);
|
|
867
|
-
}
|
|
1341
|
+
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
|
1342
|
+
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
|
1343
|
+
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
|
|
1344
|
+
// And then these socket which be hang up will devouring CPU little by little.
|
|
1345
|
+
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
|
1346
|
+
req.setTimeout(timeout, handleTimeout);
|
|
1347
|
+
} else {
|
|
1348
|
+
// explicitly reset the socket timeout value for a possible `keep-alive` request
|
|
1349
|
+
req.setTimeout(0);
|
|
1350
|
+
}
|
|
868
1351
|
|
|
1352
|
+
// Send the request
|
|
1353
|
+
if (utils.isStream(data)) {
|
|
1354
|
+
let ended = false;
|
|
1355
|
+
let errored = false;
|
|
869
1356
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
let errored = false;
|
|
1357
|
+
data.on('end', () => {
|
|
1358
|
+
ended = true;
|
|
1359
|
+
});
|
|
874
1360
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1361
|
+
data.once('error', (err) => {
|
|
1362
|
+
errored = true;
|
|
1363
|
+
req.destroy(err);
|
|
1364
|
+
});
|
|
878
1365
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1366
|
+
data.on('close', () => {
|
|
1367
|
+
if (!ended && !errored) {
|
|
1368
|
+
abort(new CanceledError('Request stream has been aborted', config, req));
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
883
1371
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1372
|
+
// Enforce maxBodyLength for streamed uploads on every transport that
|
|
1373
|
+
// does not apply options.maxBodyLength itself (native http/https, http2,
|
|
1374
|
+
// and user-supplied custom transports). The follow-redirects transport
|
|
1375
|
+
// enforces it on the redirected HTTP/1 path.
|
|
1376
|
+
let uploadStream = data;
|
|
1377
|
+
if (maxBodyLength > -1 && !transportEnforcesMaxBodyLength) {
|
|
1378
|
+
const limit = maxBodyLength;
|
|
1379
|
+
let bytesSent = 0;
|
|
1380
|
+
uploadStream = stream.pipeline(
|
|
1381
|
+
[
|
|
1382
|
+
data,
|
|
1383
|
+
new stream.Transform({
|
|
1384
|
+
transform(chunk, _enc, cb) {
|
|
1385
|
+
bytesSent += chunk.length;
|
|
1386
|
+
if (bytesSent > limit) {
|
|
1387
|
+
return cb(
|
|
1388
|
+
new AxiosError(
|
|
1389
|
+
'Request body larger than maxBodyLength limit',
|
|
1390
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
1391
|
+
config,
|
|
1392
|
+
req
|
|
1393
|
+
)
|
|
1394
|
+
);
|
|
1395
|
+
}
|
|
1396
|
+
cb(null, chunk);
|
|
1397
|
+
},
|
|
1398
|
+
}),
|
|
1399
|
+
],
|
|
1400
|
+
utils.noop
|
|
1401
|
+
);
|
|
1402
|
+
uploadStream.on('error', (err) => {
|
|
1403
|
+
if (!req.destroyed) req.destroy(err);
|
|
1404
|
+
});
|
|
887
1405
|
}
|
|
888
|
-
});
|
|
889
1406
|
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
1407
|
+
uploadStream.pipe(req);
|
|
1408
|
+
} else {
|
|
1409
|
+
data && req.write(data);
|
|
1410
|
+
req.end();
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
};
|
|
897
1414
|
|
|
898
1415
|
export const __setProxy = setProxy;
|
|
1416
|
+
export const __isNodeEnvProxyEnabled = isNodeEnvProxyEnabled;
|
|
1417
|
+
export const __isSameOriginRedirect = isSameOriginRedirect;
|