@zowe/db2-for-zowe-cli 6.1.17 → 6.1.19
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/README.md +12 -10
- package/lib/Db2PluginLifeCycle.d.ts +11 -9
- package/lib/Db2PluginLifeCycle.js +18 -13
- package/lib/Db2PluginLifeCycle.js.map +1 -1
- package/node_modules/adm-zip/adm-zip.js +32 -6
- package/node_modules/adm-zip/headers/entryHeader.js +13 -1
- package/node_modules/adm-zip/methods/inflater.js +33 -3
- package/node_modules/adm-zip/package.json +2 -2
- package/node_modules/adm-zip/util/errors.js +3 -0
- package/node_modules/adm-zip/util/utils.js +102 -14
- package/node_modules/adm-zip/zipEntry.js +43 -18
- package/node_modules/adm-zip/zipFile.js +10 -0
- package/node_modules/axios/CHANGELOG.md +62 -0
- package/node_modules/axios/README.md +236 -73
- package/node_modules/axios/dist/axios.js +1308 -357
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +1443 -403
- package/node_modules/axios/dist/esm/axios.js +1443 -403
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +1483 -348
- package/node_modules/axios/index.d.cts +24 -1
- package/node_modules/axios/index.d.ts +22 -1
- package/node_modules/axios/lib/adapters/fetch.js +136 -30
- package/node_modules/axios/lib/adapters/http.js +277 -74
- package/node_modules/axios/lib/adapters/xhr.js +172 -16
- package/node_modules/axios/lib/core/Axios.js +87 -27
- package/node_modules/axios/lib/core/AxiosError.js +59 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
- package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/buildFullPath.js +1 -13
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +28 -2
- package/node_modules/axios/lib/core/mergeConfig.js +183 -120
- package/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/axios/lib/defaults/index.js +2 -1
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
- package/node_modules/axios/lib/helpers/cookies.js +30 -6
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +11 -4
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
- package/node_modules/axios/lib/helpers/resolveConfig.js +20 -5
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +197 -6
- package/node_modules/axios/lib/helpers/throttle.js +3 -2
- package/node_modules/axios/lib/helpers/toFormData.js +14 -21
- package/node_modules/axios/lib/utils.js +192 -20
- package/node_modules/axios/package.json +1 -2
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +11 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/fs-extra/README.md +0 -1
- package/node_modules/fs-extra/lib/empty/index.js +4 -2
- package/node_modules/fs-extra/lib/util/stat.js +12 -2
- package/node_modules/fs-extra/package.json +1 -1
- package/node_modules/ibm_db/APIDocumentation.md +2883 -2024
- package/node_modules/ibm_db/LICENSE +23 -23
- package/node_modules/ibm_db/README.md +735 -735
- package/node_modules/ibm_db/binding.gyp +99 -98
- package/node_modules/ibm_db/installer/driverInstall.js +984 -958
- package/node_modules/ibm_db/installer/ifx.sh +38 -38
- package/node_modules/ibm_db/installer/setenv.sh +23 -23
- package/node_modules/ibm_db/installer/testODBCConnection.bat +51 -51
- package/node_modules/ibm_db/installer/testODBCConnection.sh +61 -61
- package/node_modules/ibm_db/lib/climacros.js +431 -431
- package/node_modules/ibm_db/lib/odbc.js +4293 -3487
- package/node_modules/ibm_db/lib/simple-queue.js +41 -41
- package/node_modules/ibm_db/package.json +70 -70
- package/node_modules/ibm_db/src/odbc.cpp +1495 -1396
- package/node_modules/ibm_db/src/odbc.h +477 -473
- package/node_modules/ibm_db/src/odbc_connection.cpp +1762 -1612
- package/node_modules/ibm_db/src/odbc_connection.h +228 -215
- package/node_modules/ibm_db/src/odbc_result.cpp +1547 -1547
- package/node_modules/ibm_db/src/odbc_result.h +152 -152
- package/node_modules/ibm_db/src/odbc_statement.cpp +2047 -861
- package/node_modules/ibm_db/src/odbc_statement.h +257 -135
- package/node_modules/ibm_db/src/strptime.c +389 -389
- package/node_modules/ibm_db/src/strptime.h +46 -46
- package/node_modules/ibm_db/test/README +23 -23
- package/node_modules/ibm_db/test/bench-insert.js +62 -62
- package/node_modules/ibm_db/test/bench-insertBatch10.js +74 -74
- package/node_modules/ibm_db/test/bench-insertBatch100.js +75 -75
- package/node_modules/ibm_db/test/bench-insertBatch1000.js +75 -75
- package/node_modules/ibm_db/test/bench-insertBatch10000.js +75 -75
- package/node_modules/ibm_db/test/bench-prepare-bind-execute-closeSync.js +60 -60
- package/node_modules/ibm_db/test/bench-prepare-bind-executeNonQuery.js +53 -53
- package/node_modules/ibm_db/test/bench-prepare-bindSync-execute-closeSync.js +50 -50
- package/node_modules/ibm_db/test/bench-prepare-bindSync-executeNonQuery.js +48 -48
- package/node_modules/ibm_db/test/bench-prepare-execute-closeSync.js +51 -51
- package/node_modules/ibm_db/test/bench-prepare-executeNonQuery.js +47 -47
- package/node_modules/ibm_db/test/bench-prepare-not.js +43 -43
- package/node_modules/ibm_db/test/bench-query-fetch.js +59 -59
- package/node_modules/ibm_db/test/bench-query-fetchAll.js +49 -49
- package/node_modules/ibm_db/test/bench-query-fetchAllSync.js +43 -43
- package/node_modules/ibm_db/test/bench-query.js +40 -40
- package/node_modules/ibm_db/test/bench-querySync-fetchArray.js +28 -28
- package/node_modules/ibm_db/test/bench-querySync.js +29 -29
- package/node_modules/ibm_db/test/common.d.ts +10 -10
- package/node_modules/ibm_db/test/common.js +127 -127
- package/node_modules/ibm_db/test/config.json +7 -7
- package/node_modules/ibm_db/test/config.zos.json +4 -4
- package/node_modules/ibm_db/test/data/sample1.txt +9 -9
- package/node_modules/ibm_db/test/data/trc.fmt +30114 -30114
- package/node_modules/ibm_db/test/nodeEE-leak-huge-query.js +152 -152
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-multiple-connections.js +148 -148
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-pool-connections.js +154 -154
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query.js +133 -133
- package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall-multiple-connections.js +174 -174
- package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall.js +169 -169
- package/node_modules/ibm_db/test/nodeEE-stress-mixed-query-multiple-connections.js +159 -159
- package/node_modules/ibm_db/test/nodeEE-stress-mixed-query.js +148 -148
- package/node_modules/ibm_db/test/odbc-bench.c +123 -123
- package/node_modules/ibm_db/test/perfTest.js +53 -53
- package/node_modules/ibm_db/test/quick-example.sh +30 -30
- package/node_modules/ibm_db/test/quick-example.ts +80 -80
- package/node_modules/ibm_db/test/run-bench.js +96 -96
- package/node_modules/ibm_db/test/run-nodeEE.js +132 -132
- package/node_modules/ibm_db/test/run-tests.js +132 -138
- package/node_modules/ibm_db/test/sql-cli.js +28 -28
- package/node_modules/ibm_db/test/test-all-data-types.js +109 -109
- package/node_modules/ibm_db/test/test-array-insert.js +178 -178
- package/node_modules/ibm_db/test/test-async-await.js +105 -105
- package/node_modules/ibm_db/test/test-attributes.js +34 -34
- package/node_modules/ibm_db/test/test-bad-pool-connection-prepare-execute.js +57 -57
- package/node_modules/ibm_db/test/test-basic-test.js +138 -138
- package/node_modules/ibm_db/test/test-binary-array-insert.js +73 -73
- package/node_modules/ibm_db/test/test-blob-from-file.js +90 -90
- package/node_modules/ibm_db/test/test-blob-insert.js +144 -144
- package/node_modules/ibm_db/test/test-blob-stream-insert.js +321 -299
- package/node_modules/ibm_db/test/test-blob-to-file.js +370 -370
- package/node_modules/ibm_db/test/test-block-fetch.js +364 -364
- package/node_modules/ibm_db/test/test-blocking-issue210.js +123 -123
- package/node_modules/ibm_db/test/test-call-async.js +64 -64
- package/node_modules/ibm_db/test/test-call-stmt.js +53 -53
- package/node_modules/ibm_db/test/test-cancel.js +703 -0
- package/node_modules/ibm_db/test/test-chinese-char.js +59 -59
- package/node_modules/ibm_db/test/test-connection.js +306 -0
- package/node_modules/ibm_db/test/test-date.js +32 -32
- package/node_modules/ibm_db/test/test-dbclob.js +93 -93
- package/node_modules/ibm_db/test/test-decimals.js +135 -135
- package/node_modules/ibm_db/test/test-describe-metadata.js +148 -0
- package/node_modules/ibm_db/test/test-executeFile.js +167 -167
- package/node_modules/ibm_db/test/test-executeFileSync.js +85 -85
- package/node_modules/ibm_db/test/test-fetch-apis.js +146 -146
- package/node_modules/ibm_db/test/test-fetchN.js +130 -130
- package/node_modules/ibm_db/test/test-getinfo.js +197 -197
- package/node_modules/ibm_db/test/test-ibm-db-issue14.js +58 -58
- package/node_modules/ibm_db/test/test-ibm-db-issue17.js +54 -54
- package/node_modules/ibm_db/test/test-ibm-db-issue18.js +54 -54
- package/node_modules/ibm_db/test/test-issue-1059-fetchAll-undefined.js +67 -67
- package/node_modules/ibm_db/test/test-issue-1080-array-blob-insert.js +40 -0
- package/node_modules/ibm_db/test/test-issue-54.js +39 -39
- package/node_modules/ibm_db/test/test-issue-get-column-value-2.js +44 -44
- package/node_modules/ibm_db/test/test-issue211.js +80 -80
- package/node_modules/ibm_db/test/test-issue253.js +39 -39
- package/node_modules/ibm_db/test/test-max-pool-size.js +96 -96
- package/node_modules/ibm_db/test/test-memory-leaks-new-objects.js +32 -32
- package/node_modules/ibm_db/test/test-multi-open-query-close.js +75 -75
- package/node_modules/ibm_db/test/test-param-put-data.js +713 -0
- package/node_modules/ibm_db/test/test-pool-idle-connection.js +72 -72
- package/node_modules/ibm_db/test/test-pool-operations.js +325 -0
- package/node_modules/ibm_db/test/test-pool-stale-connections.js +111 -111
- package/node_modules/ibm_db/test/test-pool-uncommited.js +33 -33
- package/node_modules/ibm_db/test/test-prepare-execute.js +339 -0
- package/node_modules/ibm_db/test/test-prepareSync-multiple-execution.js +93 -93
- package/node_modules/ibm_db/test/test-primary-foreign-keys.js +246 -0
- package/node_modules/ibm_db/test/test-procedures.js +243 -0
- package/node_modules/ibm_db/test/test-promise-all-data-types.js +42 -42
- package/node_modules/ibm_db/test/test-query-operations.js +405 -0
- package/node_modules/ibm_db/test/test-quick-example.js +25 -25
- package/node_modules/ibm_db/test/test-row-array-insert.js +167 -167
- package/node_modules/ibm_db/test/test-sp-array.js +54 -54
- package/node_modules/ibm_db/test/test-sp-dbc-6000.js +88 -88
- package/node_modules/ibm_db/test/test-sp-memleak.js +136 -136
- package/node_modules/ibm_db/test/test-sp-resultset-execute.js +269 -269
- package/node_modules/ibm_db/test/test-sp-resultset.js +228 -228
- package/node_modules/ibm_db/test/test-transactions.js +261 -0
- package/node_modules/ibm_db/test/test-typescript.js +48 -48
- package/node_modules/ibm_db/test/test-xml-datatype.js +70 -70
- package/node_modules/ibm_db/test/testWebApp.js +56 -56
- package/node_modules/ibm_db/test/trace +51 -51
- package/node_modules/ibm_db/test/typescript-apis-test.js +978 -978
- package/node_modules/ibm_db/test/webapp.html +17 -17
- package/node_modules/ibm_db/test/webapp.js +79 -79
- package/node_modules/ibm_db/typescript/README.md +28 -28
- package/node_modules/ibm_db/typescript/dist/Database.d.ts +26 -0
- package/node_modules/ibm_db/typescript/dist/ODBCStatement.d.ts +93 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/README.md +0 -2
- package/node_modules/which-typed-array/index.d.ts +288 -11
- package/node_modules/which-typed-array/index.js +6 -7
- package/node_modules/which-typed-array/package.json +12 -11
- package/package.json +10 -11
- package/node_modules/ibm_db/test/disabled/test-binding-statement-rebinding.js +0 -59
- package/node_modules/ibm_db/test/disabled/test-open-dont-close.js +0 -12
- package/node_modules/ibm_db/test/disabled/test-param-select-with-booleans-only.js +0 -21
- package/node_modules/ibm_db/test/disabled/test-param-select-with-decimals-only.js +0 -20
- package/node_modules/ibm_db/test/disabled/test-param-select-with-null.js +0 -21
- package/node_modules/ibm_db/test/disabled/test-param-select-with-nulls-mixed.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-mixed.js +0 -22
- package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-only.js +0 -24
- package/node_modules/ibm_db/test/disabled/test-param-select-with-strings-only.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-param-select-with-unicode.js +0 -15
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-closeSync.js +0 -62
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-error.js +0 -49
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-long-string.js +0 -63
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-executeNonQuery.js +0 -63
- package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-execute-closeSync.js +0 -46
- package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-executeNonQuery.js +0 -50
- package/node_modules/ibm_db/test/disabled/test-prepare.js +0 -34
- package/node_modules/ibm_db/test/disabled/test-prepareSync.js +0 -29
- package/node_modules/ibm_db/test/disabled/test-query-select-fetchAll.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-query-select-fetchAllSync.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-query-select-unicode.js +0 -15
- package/node_modules/ibm_db/test/disabled/test-querySync-select-unicode.js +0 -20
- package/node_modules/ibm_db/test/test-affected-rows.js +0 -55
- package/node_modules/ibm_db/test/test-bad-connection-string.js +0 -30
- package/node_modules/ibm_db/test/test-binding-connection-timeOut.js +0 -31
- package/node_modules/ibm_db/test/test-binding-statement-executeSync.js +0 -84
- package/node_modules/ibm_db/test/test-binding-transaction-commit.js +0 -79
- package/node_modules/ibm_db/test/test-binding-transaction-commitSync.js +0 -53
- package/node_modules/ibm_db/test/test-closed.js +0 -14
- package/node_modules/ibm_db/test/test-connection-object.js +0 -16
- package/node_modules/ibm_db/test/test-describe-column.js +0 -92
- package/node_modules/ibm_db/test/test-describe-database.js +0 -18
- package/node_modules/ibm_db/test/test-describe-table.js +0 -31
- package/node_modules/ibm_db/test/test-domains-open.js +0 -19
- package/node_modules/ibm_db/test/test-global-open-close.js +0 -11
- package/node_modules/ibm_db/test/test-instantiate-one-and-end.js +0 -9
- package/node_modules/ibm_db/test/test-multi-open-close.js +0 -45
- package/node_modules/ibm_db/test/test-multi-openSync-closeSync.js +0 -52
- package/node_modules/ibm_db/test/test-open-close.js +0 -29
- package/node_modules/ibm_db/test/test-open-connectTimeout.js +0 -33
- package/node_modules/ibm_db/test/test-openSync.js +0 -31
- package/node_modules/ibm_db/test/test-pool-close.js +0 -120
- package/node_modules/ibm_db/test/test-pool-connect.js +0 -36
- package/node_modules/ibm_db/test/test-pool-rollbackTransaction.js +0 -35
- package/node_modules/ibm_db/test/test-prepareSync-bad-sql.js +0 -34
- package/node_modules/ibm_db/test/test-promise-open-close.js +0 -33
- package/node_modules/ibm_db/test/test-query-create-table-fetchSync.js +0 -23
- package/node_modules/ibm_db/test/test-query-create-table.js +0 -12
- package/node_modules/ibm_db/test/test-query-drop-table.js +0 -13
- package/node_modules/ibm_db/test/test-query-insert.js +0 -38
- package/node_modules/ibm_db/test/test-query-select-fetch.js +0 -21
- package/node_modules/ibm_db/test/test-query-select-fetchMode-array.js +0 -17
- package/node_modules/ibm_db/test/test-query-select.js +0 -64
- package/node_modules/ibm_db/test/test-queryResult.js +0 -35
- package/node_modules/ibm_db/test/test-queryStream.js +0 -43
- package/node_modules/ibm_db/test/test-querySync-select-with-exception.js +0 -25
- package/node_modules/ibm_db/test/test-querySync-select.js +0 -28
- package/node_modules/ibm_db/test/test-require-and-end.js +0 -8
- package/node_modules/ibm_db/test/test-statement-close.js +0 -118
- package/node_modules/ibm_db/test/test-transaction-commit-sync.js +0 -54
- package/node_modules/ibm_db/test/test-transaction-commit.js +0 -79
- package/node_modules/which-typed-array/eslint.config.mjs +0 -12
- package/node_modules/which-typed-array/test/index.js +0 -105
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/LICENSE +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/README.md +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/chownr.js +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/package.json +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/.travis.yml +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/LICENSE +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/README.md +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/lib/string_decoder.js +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/package.json +0 -0
|
@@ -28,6 +28,7 @@ import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
|
|
28
28
|
import Http2Sessions from '../helpers/Http2Sessions.js';
|
|
29
29
|
import callbackify from '../helpers/callbackify.js';
|
|
30
30
|
import shouldBypassProxy from '../helpers/shouldBypassProxy.js';
|
|
31
|
+
import bind from '../helpers/bind.js';
|
|
31
32
|
import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
|
|
32
33
|
import {
|
|
33
34
|
progressEventReducer,
|
|
@@ -67,6 +68,15 @@ const isHttps = /https:?/;
|
|
|
67
68
|
const kAxiosSocketListener = Symbol('axios.http.socketListener');
|
|
68
69
|
const kAxiosCurrentReq = Symbol('axios.http.currentReq');
|
|
69
70
|
|
|
71
|
+
// A shared listener avoids retaining an adapter context for the lifetime of a
|
|
72
|
+
// pooled socket. EventEmitter invokes listeners with `this` set to the emitter.
|
|
73
|
+
function handleSocketError(err) {
|
|
74
|
+
const current = this[kAxiosCurrentReq];
|
|
75
|
+
if (current && !current.destroyed) {
|
|
76
|
+
current.destroy(err);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
70
80
|
// Tags HttpsProxyAgent instances installed by setProxy() so the redirect path
|
|
71
81
|
// can strip them without clobbering a user-supplied agent that happens to be
|
|
72
82
|
// an HttpsProxyAgent.
|
|
@@ -78,6 +88,18 @@ const kAxiosInstalledTunnel = Symbol('axios.http.installedTunnel');
|
|
|
78
88
|
// so unbounded growth is not a concern in practice.
|
|
79
89
|
const tunnelingAgentCache = new Map();
|
|
80
90
|
const tunnelingAgentCacheUser = new WeakMap();
|
|
91
|
+
const directAgents = new WeakMap();
|
|
92
|
+
const directAgentHooks = ['createConnection', 'getName'];
|
|
93
|
+
const nativeAgentPoolHooks = [
|
|
94
|
+
'addRequest',
|
|
95
|
+
'createSocket',
|
|
96
|
+
'removeSocket',
|
|
97
|
+
'keepSocketAlive',
|
|
98
|
+
'reuseSocket',
|
|
99
|
+
'_getSession',
|
|
100
|
+
'_cacheSession',
|
|
101
|
+
'_evictSession',
|
|
102
|
+
];
|
|
81
103
|
// Minimum minor versions where Node's HTTP Agent supports native proxyEnv
|
|
82
104
|
// handling. Checking the selected agent below also covers startup modes such
|
|
83
105
|
// as NODE_OPTIONS=--use-env-proxy and --no-use-env-proxy precedence.
|
|
@@ -114,16 +136,91 @@ function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.
|
|
|
114
136
|
const agentOptions = agent && agent.options;
|
|
115
137
|
|
|
116
138
|
return Boolean(
|
|
117
|
-
agentOptions &&
|
|
118
|
-
utils.hasOwnProp(agentOptions, 'proxyEnv') &&
|
|
119
|
-
agentOptions.proxyEnv != null
|
|
139
|
+
agentOptions && utils.hasOwnProp(agentOptions, 'proxyEnv') && agentOptions.proxyEnv != null
|
|
120
140
|
);
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
function getProxyEnvAgent(options, configHttpAgent, configHttpsAgent) {
|
|
124
144
|
return isHttps.test(options.protocol)
|
|
125
|
-
?
|
|
126
|
-
:
|
|
145
|
+
? configHttpsAgent || https.globalAgent
|
|
146
|
+
: configHttpAgent || http.globalAgent;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getDirectAgent(configuredAgent, transport) {
|
|
150
|
+
if (
|
|
151
|
+
!process.allowedNodeEnvironmentFlags ||
|
|
152
|
+
!process.allowedNodeEnvironmentFlags.has('--use-env-proxy')
|
|
153
|
+
) {
|
|
154
|
+
return configuredAgent;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const agent = configuredAgent || transport.globalAgent;
|
|
158
|
+
const options = agent && agent.options;
|
|
159
|
+
if (
|
|
160
|
+
!(agent instanceof transport.Agent) ||
|
|
161
|
+
agent.protocol !== transport.globalAgent.protocol ||
|
|
162
|
+
!options ||
|
|
163
|
+
!utils.hasOwnProp(options, 'proxyEnv') ||
|
|
164
|
+
typeof options.proxyEnv !== 'object' ||
|
|
165
|
+
options.proxyEnv === null
|
|
166
|
+
) {
|
|
167
|
+
return configuredAgent;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// These hooks own pool queues or TLS session state. Neither binding them to
|
|
171
|
+
// the source agent nor copying them without subclass state preserves their
|
|
172
|
+
// behavior on a separate direct pool.
|
|
173
|
+
for (const hook of nativeAgentPoolHooks) {
|
|
174
|
+
if (
|
|
175
|
+
utils.isFunction(transport.Agent.prototype[hook]) &&
|
|
176
|
+
agent[hook] !== transport.Agent.prototype[hook]
|
|
177
|
+
) {
|
|
178
|
+
throw new AxiosError(
|
|
179
|
+
'proxy: false cannot adapt an agent overriding ' +
|
|
180
|
+
hook +
|
|
181
|
+
'; use an agent constructed without proxyEnv',
|
|
182
|
+
AxiosError.ERR_BAD_OPTION_VALUE
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Node snapshots proxyEnv when constructing the agent. Keep this check
|
|
188
|
+
// conservative even when the caller later removes protocol-specific entries.
|
|
189
|
+
let direct = directAgents.get(agent);
|
|
190
|
+
if (!direct) {
|
|
191
|
+
direct = new transport.Agent({ ...options, proxyEnv: undefined });
|
|
192
|
+
|
|
193
|
+
// Agent.destroy() does not emit an event. Keep the associated pool under
|
|
194
|
+
// the configured agent's lifetime, including agents reused after destroy().
|
|
195
|
+
const destroy = agent.destroy;
|
|
196
|
+
agent.destroy = function destroyWithDirectAgent() {
|
|
197
|
+
try {
|
|
198
|
+
return destroy.apply(this, arguments);
|
|
199
|
+
} finally {
|
|
200
|
+
direct.destroy();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
directAgents.set(agent, direct);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Connections and pool keys do not own the direct pool's queues. Preserve
|
|
207
|
+
// their configured receiver and refresh hooks that change between requests.
|
|
208
|
+
for (const hook of directAgentHooks) {
|
|
209
|
+
direct[hook] =
|
|
210
|
+
agent[hook] === transport.Agent.prototype[hook]
|
|
211
|
+
? transport.Agent.prototype[hook]
|
|
212
|
+
: bind(agent[hook], agent);
|
|
213
|
+
}
|
|
214
|
+
return direct;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function setDirectAgent(options, configHttpAgent, configHttpsAgent) {
|
|
218
|
+
const secure = isHttps.test(options.protocol);
|
|
219
|
+
const agent = getDirectAgent(secure ? configHttpsAgent : configHttpAgent, secure ? https : http);
|
|
220
|
+
options.agent = agent;
|
|
221
|
+
if (options.agents) {
|
|
222
|
+
options.agents[secure ? 'https' : 'http'] = agent;
|
|
223
|
+
}
|
|
127
224
|
}
|
|
128
225
|
|
|
129
226
|
function getTunnelingAgent(agentOptions, userHttpsAgent) {
|
|
@@ -136,26 +233,29 @@ function getTunnelingAgent(agentOptions, userHttpsAgent) {
|
|
|
136
233
|
'#' +
|
|
137
234
|
(agentOptions.auth || '');
|
|
138
235
|
const cache = userHttpsAgent
|
|
139
|
-
?
|
|
140
|
-
|
|
236
|
+
? tunnelingAgentCacheUser.get(userHttpsAgent) ||
|
|
237
|
+
tunnelingAgentCacheUser.set(userHttpsAgent, new Map()).get(userHttpsAgent)
|
|
141
238
|
: tunnelingAgentCache;
|
|
142
239
|
let agent = cache.get(key);
|
|
143
240
|
if (agent) return agent;
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
const merged =
|
|
148
|
-
|
|
149
|
-
|
|
241
|
+
// Preserve per-request TLS options for the proxy connection, with our proxy
|
|
242
|
+
// fields taking precedence. Global-agent options belong only to the origin
|
|
243
|
+
// TLS upgrade in the callback below.
|
|
244
|
+
const merged =
|
|
245
|
+
userHttpsAgent && userHttpsAgent.options
|
|
246
|
+
? { ...userHttpsAgent.options, ...agentOptions }
|
|
247
|
+
: agentOptions;
|
|
150
248
|
agent = new HttpsProxyAgent(merged);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
249
|
+
const callback = agent.callback;
|
|
250
|
+
agent.callback = function axiosTunnelingAgentCallback(req, opts) {
|
|
251
|
+
// Without a proxy the origin TLS connection would be made by https.globalAgent,
|
|
252
|
+
// so its options have to reach the tunneled origin too. Resolved per request
|
|
253
|
+
// because the tunneling agent outlives any one of them.
|
|
254
|
+
const originTLSAgent = userHttpsAgent || https.globalAgent;
|
|
255
|
+
const originTLSOptions = originTLSAgent && originTLSAgent.options;
|
|
256
|
+
// HttpsProxyAgent v5 reads callback opts for the post-CONNECT origin TLS upgrade.
|
|
257
|
+
return callback.call(this, req, { ...originTLSOptions, ...opts });
|
|
258
|
+
};
|
|
159
259
|
agent[kAxiosInstalledTunnel] = true;
|
|
160
260
|
cache.set(key, agent);
|
|
161
261
|
return agent;
|
|
@@ -198,6 +298,10 @@ const http2Sessions = new Http2Sessions();
|
|
|
198
298
|
* @returns {Object<string, any>}
|
|
199
299
|
*/
|
|
200
300
|
function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
301
|
+
if (!isSameOriginRedirect(options, requestDetails)) {
|
|
302
|
+
stripMatchingHeaders(options.headers, new Set(['authorization', 'cookie']));
|
|
303
|
+
delete options.auth;
|
|
304
|
+
}
|
|
201
305
|
if (options.beforeRedirects.proxy) {
|
|
202
306
|
options.beforeRedirects.proxy(options);
|
|
203
307
|
}
|
|
@@ -207,6 +311,9 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
|
207
311
|
if (options.beforeRedirects.sensitiveHeaders) {
|
|
208
312
|
options.beforeRedirects.sensitiveHeaders(options, requestDetails);
|
|
209
313
|
}
|
|
314
|
+
if (options.beforeRedirects.direct) {
|
|
315
|
+
options.beforeRedirects.direct(options);
|
|
316
|
+
}
|
|
210
317
|
if (options.beforeRedirects.config) {
|
|
211
318
|
options.beforeRedirects.config(options, responseDetails, requestDetails);
|
|
212
319
|
}
|
|
@@ -243,13 +350,22 @@ function isSameOriginRedirect(redirectOptions, requestDetails) {
|
|
|
243
350
|
* @param {http.ClientRequestArgs} options
|
|
244
351
|
* @param {AxiosProxyConfig} configProxy configuration from Axios options object
|
|
245
352
|
* @param {string} location
|
|
353
|
+
* @param {boolean} [allowEnvProxy=true] whether environment proxy configuration can be used
|
|
246
354
|
*
|
|
247
|
-
* @returns {
|
|
355
|
+
* @returns {boolean} whether a proxy applies to the selected transport
|
|
248
356
|
*/
|
|
249
|
-
function setProxy(
|
|
357
|
+
function setProxy(
|
|
358
|
+
options,
|
|
359
|
+
configProxy,
|
|
360
|
+
location,
|
|
361
|
+
isRedirect,
|
|
362
|
+
configHttpsAgent,
|
|
363
|
+
configHttpAgent,
|
|
364
|
+
allowEnvProxy = true
|
|
365
|
+
) {
|
|
250
366
|
let proxy = configProxy;
|
|
251
367
|
const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
|
|
252
|
-
if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
368
|
+
if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
253
369
|
const proxyUrl = getProxyForUrl(location);
|
|
254
370
|
if (proxyUrl) {
|
|
255
371
|
if (!shouldBypassProxy(location)) {
|
|
@@ -275,6 +391,14 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
|
|
|
275
391
|
if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
|
|
276
392
|
options.agent = undefined;
|
|
277
393
|
}
|
|
394
|
+
if (
|
|
395
|
+
isRedirect &&
|
|
396
|
+
options.agents &&
|
|
397
|
+
options.agents.https &&
|
|
398
|
+
options.agents.https[kAxiosInstalledTunnel]
|
|
399
|
+
) {
|
|
400
|
+
options.agents.https = configHttpsAgent;
|
|
401
|
+
}
|
|
278
402
|
if (proxy) {
|
|
279
403
|
// Read proxy fields without traversing the prototype chain. URL instances expose
|
|
280
404
|
// username/password/hostname/host/port/protocol via getters on URL.prototype (so
|
|
@@ -406,9 +530,14 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
|
|
|
406
530
|
redirectOptions.href,
|
|
407
531
|
true,
|
|
408
532
|
configHttpsAgent,
|
|
409
|
-
configHttpAgent
|
|
533
|
+
configHttpAgent,
|
|
534
|
+
allowEnvProxy
|
|
410
535
|
);
|
|
411
536
|
};
|
|
537
|
+
|
|
538
|
+
return Boolean(
|
|
539
|
+
proxy || (configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent))
|
|
540
|
+
);
|
|
412
541
|
}
|
|
413
542
|
|
|
414
543
|
const isHttpAdapterSupported =
|
|
@@ -443,7 +572,7 @@ const wrapAsync = (asyncExecutor) => {
|
|
|
443
572
|
|
|
444
573
|
const resolveFamily = ({ address, family }) => {
|
|
445
574
|
if (!utils.isString(address)) {
|
|
446
|
-
throw
|
|
575
|
+
throw new AxiosError('address must be a string', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
447
576
|
}
|
|
448
577
|
return {
|
|
449
578
|
address,
|
|
@@ -454,6 +583,43 @@ const resolveFamily = ({ address, family }) => {
|
|
|
454
583
|
const buildAddressEntry = (address, family) =>
|
|
455
584
|
resolveFamily(utils.isObject(address) ? address : { address, family });
|
|
456
585
|
|
|
586
|
+
const normalizedLookupCache = new WeakMap();
|
|
587
|
+
|
|
588
|
+
const normalizeLookup = (lookup) => {
|
|
589
|
+
let normalized = normalizedLookupCache.get(lookup);
|
|
590
|
+
|
|
591
|
+
if (normalized) {
|
|
592
|
+
return normalized;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const callbackLookup = callbackify(lookup, (value) => (utils.isArray(value) ? value : [value]));
|
|
596
|
+
|
|
597
|
+
// Support opt.all, which is required by current Node.js releases.
|
|
598
|
+
normalized = (hostname, opt, cb) => {
|
|
599
|
+
callbackLookup(hostname, opt, (err, arg0, arg1) => {
|
|
600
|
+
if (err) {
|
|
601
|
+
return cb(err);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
let addresses;
|
|
605
|
+
|
|
606
|
+
try {
|
|
607
|
+
addresses = utils.isArray(arg0)
|
|
608
|
+
? arg0.map((addr) => buildAddressEntry(addr))
|
|
609
|
+
: [buildAddressEntry(arg0, arg1)];
|
|
610
|
+
} catch (error) {
|
|
611
|
+
return cb(error);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
615
|
+
});
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
normalizedLookupCache.set(lookup, normalized);
|
|
619
|
+
|
|
620
|
+
return normalized;
|
|
621
|
+
};
|
|
622
|
+
|
|
457
623
|
const http2Transport = {
|
|
458
624
|
request(options, cb) {
|
|
459
625
|
const authority =
|
|
@@ -518,10 +684,11 @@ export default isHttpAdapterSupported &&
|
|
|
518
684
|
let family = own('family');
|
|
519
685
|
let httpVersion = own('httpVersion');
|
|
520
686
|
if (httpVersion === undefined) httpVersion = 1;
|
|
687
|
+
const rawHttpVersion = httpVersion;
|
|
521
688
|
let http2Options = own('http2Options');
|
|
689
|
+
const configProxy = own('proxy');
|
|
522
690
|
const httpAgent = own('httpAgent');
|
|
523
691
|
const httpsAgent = own('httpsAgent');
|
|
524
|
-
const configProxy = own('proxy');
|
|
525
692
|
const responseType = own('responseType');
|
|
526
693
|
const responseEncoding = own('responseEncoding');
|
|
527
694
|
const socketPath = own('socketPath');
|
|
@@ -535,34 +702,36 @@ export default isHttpAdapterSupported &&
|
|
|
535
702
|
let req;
|
|
536
703
|
let connectPhaseTimer;
|
|
537
704
|
|
|
538
|
-
|
|
705
|
+
try {
|
|
706
|
+
httpVersion = +httpVersion;
|
|
707
|
+
} catch (err) {
|
|
708
|
+
throw new AxiosError(
|
|
709
|
+
'Invalid protocol version: value is not a number',
|
|
710
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
711
|
+
config
|
|
712
|
+
);
|
|
713
|
+
}
|
|
539
714
|
|
|
540
715
|
if (Number.isNaN(httpVersion)) {
|
|
541
|
-
throw
|
|
716
|
+
throw new AxiosError(
|
|
717
|
+
`Invalid protocol version: '${rawHttpVersion}' is not a number`,
|
|
718
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
719
|
+
config
|
|
720
|
+
);
|
|
542
721
|
}
|
|
543
722
|
|
|
544
723
|
if (httpVersion !== 1 && httpVersion !== 2) {
|
|
545
|
-
throw
|
|
724
|
+
throw new AxiosError(
|
|
725
|
+
`Unsupported protocol version '${httpVersion}'`,
|
|
726
|
+
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
727
|
+
config
|
|
728
|
+
);
|
|
546
729
|
}
|
|
547
730
|
|
|
548
731
|
const isHttp2 = httpVersion === 2;
|
|
549
732
|
|
|
550
733
|
if (lookup) {
|
|
551
|
-
|
|
552
|
-
// hotfix to support opt.all option which is required for node 20.x
|
|
553
|
-
lookup = (hostname, opt, cb) => {
|
|
554
|
-
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
555
|
-
if (err) {
|
|
556
|
-
return cb(err);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
const addresses = utils.isArray(arg0)
|
|
560
|
-
? arg0.map((addr) => buildAddressEntry(addr))
|
|
561
|
-
: [buildAddressEntry(arg0, arg1)];
|
|
562
|
-
|
|
563
|
-
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
564
|
-
});
|
|
565
|
-
};
|
|
734
|
+
lookup = normalizeLookup(lookup);
|
|
566
735
|
}
|
|
567
736
|
|
|
568
737
|
const abortEmitter = new EventEmitter();
|
|
@@ -655,7 +824,9 @@ export default isHttpAdapterSupported &&
|
|
|
655
824
|
// prototype cannot influence URL base selection.
|
|
656
825
|
const urlBase = socketPath
|
|
657
826
|
? 'http://localhost'
|
|
658
|
-
:
|
|
827
|
+
: platform.hasBrowserEnv
|
|
828
|
+
? platform.origin
|
|
829
|
+
: undefined;
|
|
659
830
|
const parsed = new URL(fullPath, urlBase);
|
|
660
831
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
661
832
|
|
|
@@ -696,6 +867,20 @@ export default isHttpAdapterSupported &&
|
|
|
696
867
|
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
|
697
868
|
}
|
|
698
869
|
|
|
870
|
+
// Check bytes before converting the result to text or a stream.
|
|
871
|
+
if (
|
|
872
|
+
maxContentLength > -1 &&
|
|
873
|
+
(responseType === 'blob' ? convertedData.size : convertedData.length) > maxContentLength
|
|
874
|
+
) {
|
|
875
|
+
return reject(
|
|
876
|
+
new AxiosError(
|
|
877
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
878
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
879
|
+
config
|
|
880
|
+
)
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
|
|
699
884
|
if (responseType === 'text') {
|
|
700
885
|
convertedData = convertedData.toString(responseEncoding);
|
|
701
886
|
|
|
@@ -866,7 +1051,7 @@ export default isHttpAdapterSupported &&
|
|
|
866
1051
|
return reject(
|
|
867
1052
|
AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config, null, null, {
|
|
868
1053
|
url: own('url'),
|
|
869
|
-
exists: true
|
|
1054
|
+
exists: true,
|
|
870
1055
|
})
|
|
871
1056
|
);
|
|
872
1057
|
}
|
|
@@ -874,10 +1059,16 @@ export default isHttpAdapterSupported &&
|
|
|
874
1059
|
headers.set(
|
|
875
1060
|
'Accept-Encoding',
|
|
876
1061
|
utils.hasOwnProp(transitional, 'advertiseZstdAcceptEncoding') &&
|
|
877
|
-
|
|
1062
|
+
transitional.advertiseZstdAcceptEncoding === true
|
|
1063
|
+
? ACCEPT_ENCODING_WITH_ZSTD
|
|
1064
|
+
: ACCEPT_ENCODING,
|
|
878
1065
|
false
|
|
879
1066
|
);
|
|
880
1067
|
|
|
1068
|
+
if (isHttp2 && lookup) {
|
|
1069
|
+
http2Options = Object.assign(Object.create(null), http2Options, { lookup });
|
|
1070
|
+
}
|
|
1071
|
+
|
|
881
1072
|
// Null-prototype to block prototype pollution gadgets on properties read
|
|
882
1073
|
// directly by Node's http.request (e.g. insecureHTTPParser, lookup).
|
|
883
1074
|
const options = Object.assign(Object.create(null), {
|
|
@@ -891,11 +1082,14 @@ export default isHttpAdapterSupported &&
|
|
|
891
1082
|
beforeRedirect: dispatchBeforeRedirect,
|
|
892
1083
|
beforeRedirects: Object.create(null),
|
|
893
1084
|
http2Options,
|
|
1085
|
+
createConnection: undefined,
|
|
894
1086
|
});
|
|
895
1087
|
|
|
896
1088
|
// cacheable-lookup integration hotfix
|
|
897
1089
|
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
|
898
1090
|
|
|
1091
|
+
let proxyApplied = false;
|
|
1092
|
+
|
|
899
1093
|
if (socketPath) {
|
|
900
1094
|
if (typeof socketPath !== 'string') {
|
|
901
1095
|
return reject(
|
|
@@ -931,30 +1125,44 @@ export default isHttpAdapterSupported &&
|
|
|
931
1125
|
? parsed.hostname.slice(1, -1)
|
|
932
1126
|
: parsed.hostname;
|
|
933
1127
|
options.port = parsed.port;
|
|
934
|
-
setProxy(
|
|
1128
|
+
proxyApplied = setProxy(
|
|
935
1129
|
options,
|
|
936
1130
|
configProxy,
|
|
937
1131
|
protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path,
|
|
938
1132
|
false,
|
|
939
1133
|
httpsAgent,
|
|
940
|
-
httpAgent
|
|
1134
|
+
httpAgent,
|
|
1135
|
+
// The HTTP/2 transport connects independently of HTTP/1 agents, so it
|
|
1136
|
+
// cannot apply either axios-resolved or agent-local environment proxies.
|
|
1137
|
+
// Explicit proxy config is still processed and rejected below.
|
|
1138
|
+
!isHttp2
|
|
941
1139
|
);
|
|
942
1140
|
}
|
|
943
1141
|
let transport;
|
|
944
1142
|
let isNativeTransport = false;
|
|
945
|
-
// True only for the follow-redirects transport, which applies
|
|
946
|
-
// options.maxBodyLength itself. Every other transport (http2, native
|
|
947
|
-
// http/https, a user-supplied custom transport) needs the explicit
|
|
948
|
-
// byte-counting pipeline below to enforce maxBodyLength on streamed uploads.
|
|
949
|
-
let transportEnforcesMaxBodyLength = false;
|
|
950
1143
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
951
1144
|
// Don't clobber a CONNECT-tunneling agent installed by setProxy() for an
|
|
952
1145
|
// HTTPS target.
|
|
953
|
-
if (
|
|
1146
|
+
if (!isHttp2 && configProxy === false) {
|
|
1147
|
+
setDirectAgent(options, httpAgent, httpsAgent);
|
|
1148
|
+
options.beforeRedirects.direct = (redirectOptions) => {
|
|
1149
|
+
setDirectAgent(redirectOptions, httpAgent, httpsAgent);
|
|
1150
|
+
};
|
|
1151
|
+
} else if (options.agent == null) {
|
|
954
1152
|
options.agent = isHttpsRequest ? httpsAgent : httpAgent;
|
|
955
1153
|
}
|
|
956
1154
|
|
|
957
1155
|
if (isHttp2) {
|
|
1156
|
+
if (proxyApplied) {
|
|
1157
|
+
return reject(
|
|
1158
|
+
new AxiosError(
|
|
1159
|
+
'HTTP/2 requests with a proxy are not supported',
|
|
1160
|
+
AxiosError.ERR_NOT_SUPPORT,
|
|
1161
|
+
config
|
|
1162
|
+
)
|
|
1163
|
+
);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
958
1166
|
transport = http2Transport;
|
|
959
1167
|
} else {
|
|
960
1168
|
const configTransport = own('transport');
|
|
@@ -964,7 +1172,6 @@ export default isHttpAdapterSupported &&
|
|
|
964
1172
|
transport = isHttpsRequest ? https : http;
|
|
965
1173
|
isNativeTransport = true;
|
|
966
1174
|
} else {
|
|
967
|
-
transportEnforcesMaxBodyLength = true;
|
|
968
1175
|
options.sensitiveHeaders = [];
|
|
969
1176
|
if (maxRedirects) {
|
|
970
1177
|
options.maxRedirects = maxRedirects;
|
|
@@ -1069,7 +1276,11 @@ export default isHttpAdapterSupported &&
|
|
|
1069
1276
|
transformStream,
|
|
1070
1277
|
progressEventDecorator(
|
|
1071
1278
|
responseLength,
|
|
1072
|
-
progressEventReducer(
|
|
1279
|
+
progressEventReducer(
|
|
1280
|
+
asyncDecorator(onDownloadProgress, scheduleProgress),
|
|
1281
|
+
true,
|
|
1282
|
+
3
|
|
1283
|
+
)
|
|
1073
1284
|
)
|
|
1074
1285
|
)
|
|
1075
1286
|
);
|
|
@@ -1267,18 +1478,10 @@ export default isHttpAdapterSupported &&
|
|
|
1267
1478
|
socket.setKeepAlive(true, 1000 * 60);
|
|
1268
1479
|
}
|
|
1269
1480
|
|
|
1270
|
-
// Install
|
|
1271
|
-
//
|
|
1272
|
-
// to new requests before the previous request's 'close' fires (issue #10780).
|
|
1273
|
-
// The listener is bound to the socket's currently-active request via a
|
|
1274
|
-
// symbol, which is swapped as the socket is reassigned.
|
|
1481
|
+
// Install one shared 'error' listener per socket. The symbol follows the
|
|
1482
|
+
// currently-active request as pooled sockets are reassigned (issue #10780).
|
|
1275
1483
|
if (!socket[kAxiosSocketListener]) {
|
|
1276
|
-
socket.on('error',
|
|
1277
|
-
const current = socket[kAxiosCurrentReq];
|
|
1278
|
-
if (current && !current.destroyed) {
|
|
1279
|
-
current.destroy(err);
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1484
|
+
socket.on('error', handleSocketError);
|
|
1282
1485
|
socket[kAxiosSocketListener] = true;
|
|
1283
1486
|
}
|
|
1284
1487
|
|
|
@@ -1358,12 +1561,10 @@ export default isHttpAdapterSupported &&
|
|
|
1358
1561
|
}
|
|
1359
1562
|
});
|
|
1360
1563
|
|
|
1361
|
-
//
|
|
1362
|
-
//
|
|
1363
|
-
// and user-supplied custom transports). The follow-redirects transport
|
|
1364
|
-
// enforces it on the redirected HTTP/1 path.
|
|
1564
|
+
// Transform decodes string chunks to Buffers before counting, so every
|
|
1565
|
+
// transport receives at most maxBodyLength encoded bytes.
|
|
1365
1566
|
let uploadStream = data;
|
|
1366
|
-
if (maxBodyLength > -1
|
|
1567
|
+
if (maxBodyLength > -1) {
|
|
1367
1568
|
const limit = maxBodyLength;
|
|
1368
1569
|
let bytesSent = 0;
|
|
1369
1570
|
uploadStream = stream.pipeline(
|
|
@@ -1402,5 +1603,7 @@ export default isHttpAdapterSupported &&
|
|
|
1402
1603
|
};
|
|
1403
1604
|
|
|
1404
1605
|
export const __setProxy = setProxy;
|
|
1606
|
+
export const __getDirectAgent = getDirectAgent;
|
|
1607
|
+
export const __isNodeNativeEnvProxySupported = isNodeNativeEnvProxySupported;
|
|
1405
1608
|
export const __isNodeEnvProxyEnabled = isNodeEnvProxyEnabled;
|
|
1406
1609
|
export const __isSameOriginRedirect = isSameOriginRedirect;
|