@st-gr/sail-proxy 0.9.2 → 0.9.4
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/bundled/gateway/node_modules/.package-lock.json +142 -93
- package/bundled/gateway/node_modules/axios/CHANGELOG.md +0 -42
- package/bundled/gateway/node_modules/axios/README.md +237 -237
- package/bundled/gateway/node_modules/axios/dist/axios.js +21 -113
- package/bundled/gateway/node_modules/axios/dist/axios.js.map +1 -0
- package/bundled/gateway/node_modules/axios/dist/axios.min.js +2 -2
- package/bundled/gateway/node_modules/axios/dist/axios.min.js.map +1 -1
- package/bundled/gateway/node_modules/axios/dist/browser/axios.cjs +15 -121
- package/bundled/gateway/node_modules/axios/dist/browser/axios.cjs.map +1 -0
- package/bundled/gateway/node_modules/axios/dist/esm/axios.js +15 -121
- package/bundled/gateway/node_modules/axios/dist/esm/axios.js.map +1 -0
- package/bundled/gateway/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/bundled/gateway/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/bundled/gateway/node_modules/axios/dist/node/axios.cjs +107 -249
- package/bundled/gateway/node_modules/axios/dist/node/axios.cjs.map +1 -0
- package/bundled/gateway/node_modules/axios/index.d.cts +3 -8
- package/bundled/gateway/node_modules/axios/index.d.ts +1 -4
- package/bundled/gateway/node_modules/axios/lib/adapters/fetch.js +0 -79
- package/bundled/gateway/node_modules/axios/lib/adapters/http.js +118 -62
- package/bundled/gateway/node_modules/axios/lib/core/Axios.js +0 -1
- package/bundled/gateway/node_modules/axios/lib/core/AxiosHeaders.js +2 -2
- package/bundled/gateway/node_modules/axios/lib/defaults/transitional.js +0 -1
- package/bundled/gateway/node_modules/axios/lib/env/data.js +1 -1
- package/bundled/gateway/node_modules/axios/lib/helpers/buildURL.js +1 -1
- package/bundled/gateway/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/bundled/gateway/node_modules/axios/lib/helpers/resolveConfig.js +6 -12
- package/bundled/gateway/node_modules/axios/lib/helpers/toFormData.js +1 -1
- package/bundled/gateway/node_modules/axios/lib/utils.js +2 -23
- package/bundled/gateway/node_modules/axios/package.json +13 -29
- package/bundled/gateway/node_modules/body-parser/HISTORY.md +0 -14
- package/bundled/gateway/node_modules/body-parser/SECURITY.md +25 -0
- package/bundled/gateway/node_modules/body-parser/lib/types/json.js +5 -1
- package/bundled/gateway/node_modules/body-parser/lib/types/urlencoded.js +15 -7
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/.editorconfig +46 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/.eslintrc +38 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/.github/FUNDING.yml +12 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/.nycrc +13 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/CHANGELOG.md +600 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/LICENSE.md +29 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/README.md +709 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/dist/qs.js +90 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/lib/formats.js +23 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/lib/index.js +11 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/lib/parse.js +296 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/lib/stringify.js +351 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/lib/utils.js +265 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/package.json +91 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/test/empty-keys-cases.js +267 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/test/parse.js +1170 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/test/stringify.js +1298 -0
- package/bundled/gateway/node_modules/body-parser/node_modules/qs/test/utils.js +136 -0
- package/bundled/gateway/node_modules/body-parser/package.json +10 -9
- package/bundled/gateway/node_modules/cookie/index.js +35 -24
- package/bundled/gateway/node_modules/cookie/package.json +1 -1
- package/bundled/gateway/node_modules/cookie-signature/History.md +1 -5
- package/bundled/gateway/node_modules/cookie-signature/index.js +6 -6
- package/bundled/gateway/node_modules/cookie-signature/package.json +2 -2
- package/bundled/gateway/node_modules/express/History.md +0 -43
- package/bundled/gateway/node_modules/express/lib/response.js +0 -1
- package/bundled/gateway/node_modules/express/lib/utils.js +1 -2
- package/bundled/gateway/node_modules/express/node_modules/qs/.editorconfig +43 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/.eslintrc +38 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/.github/FUNDING.yml +12 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/.nycrc +13 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/CHANGELOG.md +546 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/LICENSE.md +29 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/README.md +625 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/dist/qs.js +2054 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/lib/formats.js +23 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/lib/index.js +11 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/lib/parse.js +263 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/lib/stringify.js +326 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/lib/utils.js +252 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/package.json +77 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/test/parse.js +855 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/test/stringify.js +909 -0
- package/bundled/gateway/node_modules/express/node_modules/qs/test/utils.js +136 -0
- package/bundled/gateway/node_modules/express/package.json +17 -21
- package/bundled/gateway/node_modules/finalhandler/HISTORY.md +0 -21
- package/bundled/gateway/node_modules/finalhandler/README.md +2 -2
- package/bundled/gateway/node_modules/finalhandler/index.js +2 -7
- package/bundled/gateway/node_modules/finalhandler/node_modules/encodeurl/HISTORY.md +14 -0
- package/bundled/gateway/node_modules/finalhandler/node_modules/encodeurl/LICENSE +22 -0
- package/bundled/gateway/node_modules/finalhandler/node_modules/encodeurl/README.md +128 -0
- package/bundled/gateway/node_modules/finalhandler/node_modules/encodeurl/index.js +60 -0
- package/bundled/gateway/node_modules/finalhandler/node_modules/encodeurl/package.json +40 -0
- package/bundled/gateway/node_modules/finalhandler/package.json +9 -10
- package/bundled/gateway/node_modules/form-data/CHANGELOG.md +29 -2
- package/bundled/gateway/node_modules/form-data/README.md +4 -4
- package/bundled/gateway/node_modules/form-data/lib/form_data.js +14 -2
- package/bundled/gateway/node_modules/form-data/package.json +7 -7
- package/bundled/gateway/node_modules/http-errors/HISTORY.md +0 -6
- package/bundled/gateway/node_modules/http-errors/index.js +3 -4
- package/bundled/gateway/node_modules/http-errors/package.json +8 -12
- package/bundled/gateway/node_modules/raw-body/HISTORY.md +308 -0
- package/bundled/gateway/node_modules/raw-body/SECURITY.md +24 -0
- package/bundled/gateway/node_modules/raw-body/package.json +7 -5
- package/bundled/gateway/node_modules/semver/classes/range.js +17 -4
- package/bundled/gateway/node_modules/semver/package.json +2 -2
- package/bundled/gateway/node_modules/send/HISTORY.md +7 -19
- package/bundled/gateway/node_modules/send/node_modules/encodeurl/HISTORY.md +14 -0
- package/bundled/gateway/node_modules/send/node_modules/encodeurl/LICENSE +22 -0
- package/bundled/gateway/node_modules/send/node_modules/encodeurl/README.md +128 -0
- package/bundled/gateway/node_modules/send/node_modules/encodeurl/index.js +60 -0
- package/bundled/gateway/node_modules/send/node_modules/encodeurl/package.json +40 -0
- package/bundled/gateway/node_modules/send/package.json +6 -6
- package/bundled/gateway/node_modules/serve-static/HISTORY.md +0 -16
- package/bundled/gateway/node_modules/serve-static/node_modules/encodeurl/HISTORY.md +14 -0
- package/bundled/gateway/node_modules/serve-static/node_modules/encodeurl/LICENSE +22 -0
- package/bundled/gateway/node_modules/serve-static/node_modules/encodeurl/README.md +128 -0
- package/bundled/gateway/node_modules/serve-static/node_modules/encodeurl/index.js +60 -0
- package/bundled/gateway/node_modules/serve-static/node_modules/encodeurl/package.json +40 -0
- package/bundled/gateway/node_modules/serve-static/package.json +3 -3
- package/bundled/gateway/node_modules/side-channel/CHANGELOG.md +10 -0
- package/bundled/gateway/node_modules/side-channel/README.md +1 -1
- package/bundled/gateway/node_modules/side-channel/index.js +5 -2
- package/bundled/gateway/node_modules/side-channel/package.json +10 -10
- package/bundled/gateway/node_modules/side-channel/test/index.js +16 -0
- package/bundled/gateway/node_modules/statuses/HISTORY.md +0 -5
- package/bundled/gateway/node_modules/statuses/README.md +0 -3
- package/bundled/gateway/node_modules/statuses/package.json +7 -7
- package/bundled/gateway/package-lock.json +150 -101
- package/bundled/gateway/package.json +31 -5
- package/bundled/gateway/services/gateway/src/controllers/anthropicController.js +1 -1
- package/bundled/gateway/services/gateway/src/controllers/awsBedrockController.js +5 -1
- package/bundled/gateway/services/gateway/src/index.js +14 -0
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/detectors/index.js +23 -1
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/detectors/regexDetectors.js +149 -10
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/entityToggles.d.ts +24 -0
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/entityToggles.js +54 -0
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/index.d.ts +2 -1
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/index.js +441 -92
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/replacementMap.d.ts +24 -0
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/replacementMap.js +93 -4
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/replacer.d.ts +22 -0
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/replacer.js +77 -0
- package/bundled/gateway/services/gateway/src/plugins/pseudonymization/streamBuffer.js +26 -8
- package/bundled/gateway/services/gateway/src/services/awsBedrockService.js +118 -46
- package/bundled/gateway/services/gateway/src/services/betaFlagQuarantine.d.ts +18 -0
- package/bundled/gateway/services/gateway/src/services/betaFlagQuarantine.js +111 -0
- package/bundled/gateway/services/gateway/src/services/configService.d.ts +8 -0
- package/bundled/gateway/services/gateway/src/services/configService.js +61 -53
- package/bundled/gateway/services/gateway/src/utils/bedrockStreamParser.d.ts +9 -0
- package/bundled/gateway/services/gateway/src/utils/bedrockStreamParser.js +69 -3
- package/bundled/gateway/services/gateway/src/utils/betaFeatureFilter.d.ts +31 -0
- package/bundled/gateway/services/gateway/src/utils/betaFeatureFilter.js +58 -0
- package/bundled/gateway/services/gateway/src/utils/payloadLogger.d.ts +6 -0
- package/bundled/gateway/services/gateway/src/utils/payloadLogger.js +11 -7
- package/bundled/gateway/services/gateway/src/utils/pluginCacheSelector.d.ts +15 -0
- package/bundled/gateway/services/gateway/src/utils/pluginCacheSelector.js +24 -0
- package/bundled/gateway/services/gateway/src/utils/sseWriter.js +4 -2
- package/bundled/gateway/services/gateway/src/utils/upstreamErrorBody.d.ts +10 -0
- package/bundled/gateway/services/gateway/src/utils/upstreamErrorBody.js +71 -0
- package/bundled/ollama/node_modules/.package-lock.json +111 -92
- package/bundled/ollama/node_modules/axios/CHANGELOG.md +0 -42
- package/bundled/ollama/node_modules/axios/README.md +237 -237
- package/bundled/ollama/node_modules/axios/dist/axios.js +21 -113
- package/bundled/ollama/node_modules/axios/dist/axios.js.map +1 -0
- package/bundled/ollama/node_modules/axios/dist/axios.min.js +2 -2
- package/bundled/ollama/node_modules/axios/dist/axios.min.js.map +1 -1
- package/bundled/ollama/node_modules/axios/dist/browser/axios.cjs +15 -121
- package/bundled/ollama/node_modules/axios/dist/browser/axios.cjs.map +1 -0
- package/bundled/ollama/node_modules/axios/dist/esm/axios.js +15 -121
- package/bundled/ollama/node_modules/axios/dist/esm/axios.js.map +1 -0
- package/bundled/ollama/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/bundled/ollama/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/bundled/ollama/node_modules/axios/dist/node/axios.cjs +107 -249
- package/bundled/ollama/node_modules/axios/dist/node/axios.cjs.map +1 -0
- package/bundled/ollama/node_modules/axios/index.d.cts +3 -8
- package/bundled/ollama/node_modules/axios/index.d.ts +1 -4
- package/bundled/ollama/node_modules/axios/lib/adapters/fetch.js +0 -79
- package/bundled/ollama/node_modules/axios/lib/adapters/http.js +118 -62
- package/bundled/ollama/node_modules/axios/lib/core/Axios.js +0 -1
- package/bundled/ollama/node_modules/axios/lib/core/AxiosHeaders.js +2 -2
- package/bundled/ollama/node_modules/axios/lib/defaults/transitional.js +0 -1
- package/bundled/ollama/node_modules/axios/lib/env/data.js +1 -1
- package/bundled/ollama/node_modules/axios/lib/helpers/buildURL.js +1 -1
- package/bundled/ollama/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/bundled/ollama/node_modules/axios/lib/helpers/resolveConfig.js +6 -12
- package/bundled/ollama/node_modules/axios/lib/helpers/toFormData.js +1 -1
- package/bundled/ollama/node_modules/axios/lib/utils.js +2 -23
- package/bundled/ollama/node_modules/axios/package.json +13 -29
- package/bundled/ollama/node_modules/body-parser/HISTORY.md +0 -14
- package/bundled/ollama/node_modules/body-parser/SECURITY.md +25 -0
- package/bundled/ollama/node_modules/body-parser/lib/types/json.js +5 -1
- package/bundled/ollama/node_modules/body-parser/lib/types/urlencoded.js +15 -7
- package/bundled/ollama/node_modules/body-parser/package.json +10 -9
- package/bundled/ollama/node_modules/cookie/index.js +35 -24
- package/bundled/ollama/node_modules/cookie/package.json +1 -1
- package/bundled/ollama/node_modules/cookie-signature/History.md +1 -5
- package/bundled/ollama/node_modules/cookie-signature/index.js +6 -6
- package/bundled/ollama/node_modules/cookie-signature/package.json +2 -2
- package/bundled/ollama/node_modules/express/History.md +0 -43
- package/bundled/ollama/node_modules/express/lib/response.js +0 -1
- package/bundled/ollama/node_modules/express/lib/utils.js +1 -2
- package/bundled/ollama/node_modules/express/package.json +17 -21
- package/bundled/ollama/node_modules/finalhandler/HISTORY.md +0 -21
- package/bundled/ollama/node_modules/finalhandler/README.md +2 -2
- package/bundled/ollama/node_modules/finalhandler/index.js +2 -7
- package/bundled/ollama/node_modules/finalhandler/node_modules/encodeurl/HISTORY.md +14 -0
- package/bundled/ollama/node_modules/finalhandler/node_modules/encodeurl/LICENSE +22 -0
- package/bundled/ollama/node_modules/finalhandler/node_modules/encodeurl/README.md +128 -0
- package/bundled/ollama/node_modules/finalhandler/node_modules/encodeurl/index.js +60 -0
- package/bundled/ollama/node_modules/finalhandler/node_modules/encodeurl/package.json +40 -0
- package/bundled/ollama/node_modules/finalhandler/package.json +9 -10
- package/bundled/ollama/node_modules/form-data/CHANGELOG.md +29 -2
- package/bundled/ollama/node_modules/form-data/README.md +4 -4
- package/bundled/ollama/node_modules/form-data/lib/form_data.js +14 -2
- package/bundled/ollama/node_modules/form-data/package.json +7 -7
- package/bundled/ollama/node_modules/http-errors/HISTORY.md +0 -6
- package/bundled/ollama/node_modules/http-errors/index.js +3 -4
- package/bundled/ollama/node_modules/http-errors/package.json +8 -12
- package/bundled/ollama/node_modules/raw-body/HISTORY.md +308 -0
- package/bundled/ollama/node_modules/raw-body/SECURITY.md +24 -0
- package/bundled/ollama/node_modules/raw-body/package.json +7 -5
- package/bundled/ollama/node_modules/send/HISTORY.md +7 -19
- package/bundled/ollama/node_modules/send/node_modules/encodeurl/HISTORY.md +14 -0
- package/bundled/ollama/node_modules/send/node_modules/encodeurl/LICENSE +22 -0
- package/bundled/ollama/node_modules/send/node_modules/encodeurl/README.md +128 -0
- package/bundled/ollama/node_modules/send/node_modules/encodeurl/index.js +60 -0
- package/bundled/ollama/node_modules/send/node_modules/encodeurl/package.json +40 -0
- package/bundled/ollama/node_modules/send/package.json +6 -6
- package/bundled/ollama/node_modules/serve-static/HISTORY.md +0 -16
- package/bundled/ollama/node_modules/serve-static/node_modules/encodeurl/HISTORY.md +14 -0
- package/bundled/ollama/node_modules/serve-static/node_modules/encodeurl/LICENSE +22 -0
- package/bundled/ollama/node_modules/serve-static/node_modules/encodeurl/README.md +128 -0
- package/bundled/ollama/node_modules/serve-static/node_modules/encodeurl/index.js +60 -0
- package/bundled/ollama/node_modules/serve-static/node_modules/encodeurl/package.json +40 -0
- package/bundled/ollama/node_modules/serve-static/package.json +3 -3
- package/bundled/ollama/node_modules/side-channel/CHANGELOG.md +10 -0
- package/bundled/ollama/node_modules/side-channel/README.md +1 -1
- package/bundled/ollama/node_modules/side-channel/index.js +5 -2
- package/bundled/ollama/node_modules/side-channel/package.json +10 -10
- package/bundled/ollama/node_modules/side-channel/test/index.js +16 -0
- package/bundled/ollama/node_modules/statuses/HISTORY.md +0 -5
- package/bundled/ollama/node_modules/statuses/README.md +0 -3
- package/bundled/ollama/node_modules/statuses/package.json +7 -7
- package/bundled/ollama/package-lock.json +114 -95
- package/bundled/ollama/package.json +32 -4
- package/dist/templates/api_config.template.json +266 -18
- package/node_modules/@sap-llm-gateway/service-key-parser/package.json +1 -1
- package/package.json +2 -2
- package/bundled/gateway/node_modules/axios/lib/helpers/Http2Sessions.js +0 -119
- package/bundled/ollama/node_modules/axios/lib/helpers/Http2Sessions.js +0 -119
|
@@ -143,5 +143,5 @@ function logerror (err) {
|
|
|
143
143
|
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master
|
|
144
144
|
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg
|
|
145
145
|
[downloads-url]: https://npmjs.org/package/finalhandler
|
|
146
|
-
[github-actions-ci-image]: https://
|
|
147
|
-
[github-actions-ci-url]: https://github.com/pillarjs/finalhandler
|
|
146
|
+
[github-actions-ci-image]: https://img.shields.io/github/workflow/status/pillarjs/finalhandler/ci/master?label=ci
|
|
147
|
+
[github-actions-ci-url]: https://github.com/jshttp/pillarjs/finalhandler?query=workflow%3Aci
|
|
@@ -125,9 +125,7 @@ function finalhandler (req, res, options) {
|
|
|
125
125
|
// cannot actually respond
|
|
126
126
|
if (headersSent(res)) {
|
|
127
127
|
debug('cannot %d after headers sent', status)
|
|
128
|
-
|
|
129
|
-
req.socket.destroy()
|
|
130
|
-
}
|
|
128
|
+
req.socket.destroy()
|
|
131
129
|
return
|
|
132
130
|
}
|
|
133
131
|
|
|
@@ -278,10 +276,7 @@ function send (req, res, status, headers, message) {
|
|
|
278
276
|
|
|
279
277
|
// response status
|
|
280
278
|
res.statusCode = status
|
|
281
|
-
|
|
282
|
-
if (req.httpVersionMajor < 2) {
|
|
283
|
-
res.statusMessage = statuses.message[status]
|
|
284
|
-
}
|
|
279
|
+
res.statusMessage = statuses.message[status]
|
|
285
280
|
|
|
286
281
|
// remove any content headers
|
|
287
282
|
res.removeHeader('Content-Encoding')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
1.0.2 / 2018-01-21
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
* Fix encoding `%` as last character
|
|
5
|
+
|
|
6
|
+
1.0.1 / 2016-06-09
|
|
7
|
+
==================
|
|
8
|
+
|
|
9
|
+
* Fix encoding unpaired surrogates at start/end of string
|
|
10
|
+
|
|
11
|
+
1.0.0 / 2016-06-08
|
|
12
|
+
==================
|
|
13
|
+
|
|
14
|
+
* Initial release
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Douglas Christopher Wilson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# encodeurl
|
|
2
|
+
|
|
3
|
+
[![NPM Version][npm-image]][npm-url]
|
|
4
|
+
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
|
+
[![Node.js Version][node-version-image]][node-version-url]
|
|
6
|
+
[![Build Status][travis-image]][travis-url]
|
|
7
|
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
8
|
+
|
|
9
|
+
Encode a URL to a percent-encoded form, excluding already-encoded sequences
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
14
|
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
15
|
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
$ npm install encodeurl
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## API
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
var encodeUrl = require('encodeurl')
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### encodeUrl(url)
|
|
28
|
+
|
|
29
|
+
Encode a URL to a percent-encoded form, excluding already-encoded sequences.
|
|
30
|
+
|
|
31
|
+
This function will take an already-encoded URL and encode all the non-URL
|
|
32
|
+
code points (as UTF-8 byte sequences). This function will not encode the
|
|
33
|
+
"%" character unless it is not part of a valid sequence (`%20` will be
|
|
34
|
+
left as-is, but `%foo` will be encoded as `%25foo`).
|
|
35
|
+
|
|
36
|
+
This encode is meant to be "safe" and does not throw errors. It will try as
|
|
37
|
+
hard as it can to properly encode the given URL, including replacing any raw,
|
|
38
|
+
unpaired surrogate pairs with the Unicode replacement character prior to
|
|
39
|
+
encoding.
|
|
40
|
+
|
|
41
|
+
This function is _similar_ to the intrinsic function `encodeURI`, except it
|
|
42
|
+
will not encode the `%` character if that is part of a valid sequence, will
|
|
43
|
+
not encode `[` and `]` (for IPv6 hostnames) and will replace raw, unpaired
|
|
44
|
+
surrogate pairs with the Unicode replacement character (instead of throwing).
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
### Encode a URL containing user-controled data
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
var encodeUrl = require('encodeurl')
|
|
52
|
+
var escapeHtml = require('escape-html')
|
|
53
|
+
|
|
54
|
+
http.createServer(function onRequest (req, res) {
|
|
55
|
+
// get encoded form of inbound url
|
|
56
|
+
var url = encodeUrl(req.url)
|
|
57
|
+
|
|
58
|
+
// create html message
|
|
59
|
+
var body = '<p>Location ' + escapeHtml(url) + ' not found</p>'
|
|
60
|
+
|
|
61
|
+
// send a 404
|
|
62
|
+
res.statusCode = 404
|
|
63
|
+
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
|
64
|
+
res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
|
|
65
|
+
res.end(body, 'utf-8')
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Encode a URL for use in a header field
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
var encodeUrl = require('encodeurl')
|
|
73
|
+
var escapeHtml = require('escape-html')
|
|
74
|
+
var url = require('url')
|
|
75
|
+
|
|
76
|
+
http.createServer(function onRequest (req, res) {
|
|
77
|
+
// parse inbound url
|
|
78
|
+
var href = url.parse(req)
|
|
79
|
+
|
|
80
|
+
// set new host for redirect
|
|
81
|
+
href.host = 'localhost'
|
|
82
|
+
href.protocol = 'https:'
|
|
83
|
+
href.slashes = true
|
|
84
|
+
|
|
85
|
+
// create location header
|
|
86
|
+
var location = encodeUrl(url.format(href))
|
|
87
|
+
|
|
88
|
+
// create html message
|
|
89
|
+
var body = '<p>Redirecting to new site: ' + escapeHtml(location) + '</p>'
|
|
90
|
+
|
|
91
|
+
// send a 301
|
|
92
|
+
res.statusCode = 301
|
|
93
|
+
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
|
94
|
+
res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
|
|
95
|
+
res.setHeader('Location', location)
|
|
96
|
+
res.end(body, 'utf-8')
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Testing
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
$ npm test
|
|
104
|
+
$ npm run lint
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## References
|
|
108
|
+
|
|
109
|
+
- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax][rfc-3986]
|
|
110
|
+
- [WHATWG URL Living Standard][whatwg-url]
|
|
111
|
+
|
|
112
|
+
[rfc-3986]: https://tools.ietf.org/html/rfc3986
|
|
113
|
+
[whatwg-url]: https://url.spec.whatwg.org/
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
[MIT](LICENSE)
|
|
118
|
+
|
|
119
|
+
[npm-image]: https://img.shields.io/npm/v/encodeurl.svg
|
|
120
|
+
[npm-url]: https://npmjs.org/package/encodeurl
|
|
121
|
+
[node-version-image]: https://img.shields.io/node/v/encodeurl.svg
|
|
122
|
+
[node-version-url]: https://nodejs.org/en/download
|
|
123
|
+
[travis-image]: https://img.shields.io/travis/pillarjs/encodeurl.svg
|
|
124
|
+
[travis-url]: https://travis-ci.org/pillarjs/encodeurl
|
|
125
|
+
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/encodeurl.svg
|
|
126
|
+
[coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master
|
|
127
|
+
[downloads-image]: https://img.shields.io/npm/dm/encodeurl.svg
|
|
128
|
+
[downloads-url]: https://npmjs.org/package/encodeurl
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* encodeurl
|
|
3
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Module exports.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
module.exports = encodeUrl
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
|
|
18
|
+
* and including invalid escape sequences.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* RegExp to match unmatched surrogate pair.
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* String to replace unmatched surrogate pair with.
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Encode a URL to a percent-encoded form, excluding already-encoded sequences.
|
|
40
|
+
*
|
|
41
|
+
* This function will take an already-encoded URL and encode all the non-URL
|
|
42
|
+
* code points. This function will not encode the "%" character unless it is
|
|
43
|
+
* not part of a valid sequence (`%20` will be left as-is, but `%foo` will
|
|
44
|
+
* be encoded as `%25foo`).
|
|
45
|
+
*
|
|
46
|
+
* This encode is meant to be "safe" and does not throw errors. It will try as
|
|
47
|
+
* hard as it can to properly encode the given URL, including replacing any raw,
|
|
48
|
+
* unpaired surrogate pairs with the Unicode replacement character prior to
|
|
49
|
+
* encoding.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} url
|
|
52
|
+
* @return {string}
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
function encodeUrl (url) {
|
|
57
|
+
return String(url)
|
|
58
|
+
.replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
|
|
59
|
+
.replace(ENCODE_CHARS_REGEXP, encodeURI)
|
|
60
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "encodeurl",
|
|
3
|
+
"description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences",
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"contributors": [
|
|
6
|
+
"Douglas Christopher Wilson <doug@somethingdoug.com>"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"encode",
|
|
11
|
+
"encodeurl",
|
|
12
|
+
"url"
|
|
13
|
+
],
|
|
14
|
+
"repository": "pillarjs/encodeurl",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"eslint": "3.19.0",
|
|
17
|
+
"eslint-config-standard": "10.2.1",
|
|
18
|
+
"eslint-plugin-import": "2.8.0",
|
|
19
|
+
"eslint-plugin-node": "5.2.1",
|
|
20
|
+
"eslint-plugin-promise": "3.6.0",
|
|
21
|
+
"eslint-plugin-standard": "3.0.1",
|
|
22
|
+
"istanbul": "0.4.5",
|
|
23
|
+
"mocha": "2.5.3"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"HISTORY.md",
|
|
28
|
+
"README.md",
|
|
29
|
+
"index.js"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">= 0.8"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
37
|
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
|
38
|
+
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "finalhandler",
|
|
3
3
|
"description": "Node.js final http responder",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "pillarjs/finalhandler",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"debug": "2.6.9",
|
|
10
|
-
"encodeurl": "~
|
|
10
|
+
"encodeurl": "~1.0.2",
|
|
11
11
|
"escape-html": "~1.0.3",
|
|
12
|
-
"on-finished": "
|
|
12
|
+
"on-finished": "2.4.1",
|
|
13
13
|
"parseurl": "~1.3.3",
|
|
14
|
-
"statuses": "
|
|
14
|
+
"statuses": "2.0.1",
|
|
15
15
|
"unpipe": "~1.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"eslint": "7.32.0",
|
|
19
19
|
"eslint-config-standard": "14.1.1",
|
|
20
|
-
"eslint-plugin-import": "2.
|
|
20
|
+
"eslint-plugin-import": "2.25.4",
|
|
21
21
|
"eslint-plugin-markdown": "2.2.1",
|
|
22
22
|
"eslint-plugin-node": "11.1.0",
|
|
23
23
|
"eslint-plugin-promise": "5.2.0",
|
|
24
24
|
"eslint-plugin-standard": "4.1.0",
|
|
25
|
-
"mocha": "
|
|
25
|
+
"mocha": "9.2.2",
|
|
26
26
|
"nyc": "15.1.0",
|
|
27
27
|
"readable-stream": "2.3.6",
|
|
28
28
|
"safe-buffer": "5.2.1",
|
|
29
|
-
"supertest": "6.2.
|
|
29
|
+
"supertest": "6.2.2"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"LICENSE",
|
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"lint": "eslint .",
|
|
42
|
-
"test": "mocha --reporter spec --check-leaks test/",
|
|
42
|
+
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
43
43
|
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
|
|
44
|
-
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
45
|
-
"test-inspect": "mocha --reporter spec --inspect --inspect-brk test/"
|
|
44
|
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v4.0.6](https://github.com/form-data/form-data/compare/v4.0.5...v4.0.6) - 2026-06-12
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [Fix] escape CR, LF, and `"` in field names and filenames [`8dff42c`](https://github.com/form-data/form-data/commit/8dff42c6da654ed4e7ad4acb7f8ccd3831217c99)
|
|
13
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `tape` [`f31d21e`](https://github.com/form-data/form-data/commit/f31d21ef10bf46e46344c3ee4f99acbef6be43e1)
|
|
14
|
+
- [Deps] update `hasown`, `mime-types` [`92ae0eb`](https://github.com/form-data/form-data/commit/92ae0eb5da94d6f01925d5f4fcffb2a1e50ed7cd)
|
|
15
|
+
- [Dev Deps] update `js-randomness-predictor` [`67b0f65`](https://github.com/form-data/form-data/commit/67b0f65c2e0b065a511d42227d35e4d367644e97)
|
|
16
|
+
|
|
8
17
|
## [v4.0.5](https://github.com/form-data/form-data/compare/v4.0.4...v4.0.5) - 2025-11-17
|
|
9
18
|
|
|
10
19
|
### Commits
|
|
@@ -94,7 +103,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
94
103
|
- fix (npmignore): ignore temporary build files [`335ad19`](https://github.com/form-data/form-data/commit/335ad19c6e17dc2d7298ffe0e9b37ba63600e94b)
|
|
95
104
|
- fix: move util.isArray to Array.isArray [`440d3be`](https://github.com/form-data/form-data/commit/440d3bed752ac2f9213b4c2229dbccefe140e5fa)
|
|
96
105
|
|
|
97
|
-
## [v4.0.0](https://github.com/form-data/form-data/compare/v3.0.
|
|
106
|
+
## [v4.0.0](https://github.com/form-data/form-data/compare/v3.0.5...v4.0.0) - 2021-02-15
|
|
98
107
|
|
|
99
108
|
### Merged
|
|
100
109
|
|
|
@@ -105,6 +114,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
105
114
|
- Fix typo [`e705c0a`](https://github.com/form-data/form-data/commit/e705c0a1fdaf90d21501f56460b93e43a18bd435)
|
|
106
115
|
- Update README for custom stream behavior [`6dd8624`](https://github.com/form-data/form-data/commit/6dd8624b2999e32768d62752c9aae5845a803b0d)
|
|
107
116
|
|
|
117
|
+
## [v3.0.5](https://github.com/form-data/form-data/compare/v3.0.4...v3.0.5) - 2026-06-12
|
|
118
|
+
|
|
119
|
+
### Commits
|
|
120
|
+
|
|
121
|
+
- [Fix] escape CR, LF, and `"` in field names and filenames [`8777e67`](https://github.com/form-data/form-data/commit/8777e67fbd0282d3dcba81f974fbdd91062c5b23)
|
|
122
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `eslint`, `tape` [`27c61a5`](https://github.com/form-data/form-data/commit/27c61a5deed84798be105c96605cb8bd00502dcd)
|
|
123
|
+
- [Deps] update `hasown` [`6a8a1c6`](https://github.com/form-data/form-data/commit/6a8a1c6d04da36e15c80b16ecc4c0265082b3213)
|
|
124
|
+
|
|
108
125
|
## [v3.0.4](https://github.com/form-data/form-data/compare/v3.0.3...v3.0.4) - 2025-07-16
|
|
109
126
|
|
|
110
127
|
### Fixed
|
|
@@ -166,7 +183,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
166
183
|
|
|
167
184
|
- feat: add setBoundary method [`55d90ce`](https://github.com/form-data/form-data/commit/55d90ce4a4c22b0ea0647991d85cb946dfb7395b)
|
|
168
185
|
|
|
169
|
-
## [v3.0.0](https://github.com/form-data/form-data/compare/v2.5.
|
|
186
|
+
## [v3.0.0](https://github.com/form-data/form-data/compare/v2.5.6...v3.0.0) - 2019-11-05
|
|
170
187
|
|
|
171
188
|
### Merged
|
|
172
189
|
|
|
@@ -190,6 +207,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
190
207
|
- Pass options to constructor if not used with new [`4bde68e`](https://github.com/form-data/form-data/commit/4bde68e12de1ba90fefad2e7e643f6375b902763)
|
|
191
208
|
- Make userHeaders optional [`2b4e478`](https://github.com/form-data/form-data/commit/2b4e4787031490942f2d1ee55c56b85a250875a7)
|
|
192
209
|
|
|
210
|
+
## [v2.5.6](https://github.com/form-data/form-data/compare/v2.5.5...v2.5.6) - 2026-06-12
|
|
211
|
+
|
|
212
|
+
### Commits
|
|
213
|
+
|
|
214
|
+
- [Fix] escape CR, LF, and `"` in field names and filenames [`b620316`](https://github.com/form-data/form-data/commit/b62031603c2d7c329b2a369b49466790f0ba6314)
|
|
215
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `eslint`, `tape` [`12be578`](https://github.com/form-data/form-data/commit/12be578e936fd77eee75e2e656955f5343c4b80f)
|
|
216
|
+
- [Dev Deps] update `js-randomness-predictor` [`46cfd23`](https://github.com/form-data/form-data/commit/46cfd23bd40be14cfa0391e1c5357c4d74098f23)
|
|
217
|
+
- [Tests] use `safe-buffer` so the header-injection test runs on node < 4 [`633044a`](https://github.com/form-data/form-data/commit/633044a57a7b19f41cec2271ffd24afa2f6280af)
|
|
218
|
+
- [Deps] update `hasown` [`e3b96ee`](https://github.com/form-data/form-data/commit/e3b96eef1661bca8ea4297de057b78bf2734e900)
|
|
219
|
+
|
|
193
220
|
## [v2.5.5](https://github.com/form-data/form-data/compare/v2.5.4...v2.5.5) - 2025-07-18
|
|
194
221
|
|
|
195
222
|
### Commits
|
|
@@ -6,11 +6,11 @@ The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface]
|
|
|
6
6
|
|
|
7
7
|
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
|
|
8
8
|
|
|
9
|
-
[](https://travis-ci.org/form-data/form-data)
|
|
10
|
+
[](https://travis-ci.org/form-data/form-data)
|
|
11
|
+
[](https://travis-ci.org/form-data/form-data)
|
|
12
12
|
|
|
13
|
-
[](https://coveralls.io/github/form-data/form-data?branch=master)
|
|
14
14
|
[](https://david-dm.org/form-data/form-data)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
@@ -15,6 +15,18 @@ var setToStringTag = require('es-set-tostringtag');
|
|
|
15
15
|
var hasOwn = require('hasown');
|
|
16
16
|
var populate = require('./populate.js');
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Escape CR, LF, and `"` in a multipart `name`/`filename` parameter, so a field
|
|
20
|
+
* name or filename can not break out of its header line to inject headers or
|
|
21
|
+
* smuggle additional parts. Matches the WHATWG HTML multipart/form-data encoding.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} str - the parameter value to escape
|
|
24
|
+
* @returns {string} the escaped value
|
|
25
|
+
*/
|
|
26
|
+
function escapeHeaderParam(str) {
|
|
27
|
+
return String(str).replace(/\r/g, '%0D').replace(/\n/g, '%0A').replace(/"/g, '%22');
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
/**
|
|
19
31
|
* Create readable "multipart/form-data" streams.
|
|
20
32
|
* Can be used to submit forms
|
|
@@ -180,7 +192,7 @@ FormData.prototype._multiPartHeader = function (field, value, options) {
|
|
|
180
192
|
var contents = '';
|
|
181
193
|
var headers = {
|
|
182
194
|
// add custom disposition as third element or keep it two elements if not
|
|
183
|
-
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
195
|
+
'Content-Disposition': ['form-data', 'name="' + escapeHeaderParam(field) + '"'].concat(contentDisposition || []),
|
|
184
196
|
// if no content type. allow it to be empty array
|
|
185
197
|
'Content-Type': [].concat(contentType || [])
|
|
186
198
|
};
|
|
@@ -234,7 +246,7 @@ FormData.prototype._getContentDisposition = function (value, options) { // eslin
|
|
|
234
246
|
}
|
|
235
247
|
|
|
236
248
|
if (filename) {
|
|
237
|
-
return 'filename="' + filename + '"';
|
|
249
|
+
return 'filename="' + escapeHeaderParam(filename) + '"';
|
|
238
250
|
}
|
|
239
251
|
};
|
|
240
252
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
|
|
3
3
|
"name": "form-data",
|
|
4
4
|
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
|
|
5
|
-
"version": "4.0.
|
|
5
|
+
"version": "4.0.6",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git://github.com/form-data/form-data.git"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"asynckit": "^0.4.0",
|
|
44
44
|
"combined-stream": "^1.0.8",
|
|
45
45
|
"es-set-tostringtag": "^2.1.0",
|
|
46
|
-
"hasown": "^2.0.
|
|
47
|
-
"mime-types": "^2.1.
|
|
46
|
+
"hasown": "^2.0.4",
|
|
47
|
+
"mime-types": "^2.1.35"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@ljharb/eslint-config": "^
|
|
51
|
-
"auto-changelog": "^2.
|
|
50
|
+
"@ljharb/eslint-config": "^22.2.3",
|
|
51
|
+
"auto-changelog": "^2.6.0",
|
|
52
52
|
"browserify": "^13.3.0",
|
|
53
53
|
"browserify-istanbul": "^2.0.0",
|
|
54
54
|
"coveralls": "^3.1.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"in-publish": "^2.0.1",
|
|
61
61
|
"is-node-modern": "^1.0.0",
|
|
62
62
|
"istanbul": "^0.4.5",
|
|
63
|
-
"js-randomness-predictor": "^
|
|
63
|
+
"js-randomness-predictor": "^3.6.0",
|
|
64
64
|
"obake": "^0.1.2",
|
|
65
65
|
"pkgfiles": "^2.3.2",
|
|
66
66
|
"pre-commit": "^1.2.2",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"request": "~2.87.0",
|
|
69
69
|
"rimraf": "^2.7.1",
|
|
70
70
|
"semver": "^6.3.1",
|
|
71
|
-
"tape": "^5.
|
|
71
|
+
"tape": "^5.10.1"
|
|
72
72
|
},
|
|
73
73
|
"license": "MIT",
|
|
74
74
|
"auto-changelog": {
|
|
@@ -279,12 +279,11 @@ function populateConstructorExports (exports, codes, HttpError) {
|
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* Get a class name from a name identifier.
|
|
282
|
-
*
|
|
283
|
-
* @param {string} name
|
|
284
|
-
* @returns {string}
|
|
285
282
|
* @private
|
|
286
283
|
*/
|
|
287
284
|
|
|
288
285
|
function toClassName (name) {
|
|
289
|
-
return name.
|
|
286
|
+
return name.substr(-5) !== 'Error'
|
|
287
|
+
? name + 'Error'
|
|
288
|
+
: name
|
|
290
289
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "http-errors",
|
|
3
3
|
"description": "Create HTTP error objects",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Alan Plum <me@pluma.io>",
|
|
@@ -9,21 +9,17 @@
|
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": "jshttp/http-errors",
|
|
12
|
-
"funding": {
|
|
13
|
-
"type": "opencollective",
|
|
14
|
-
"url": "https://opencollective.com/express"
|
|
15
|
-
},
|
|
16
12
|
"dependencies": {
|
|
17
|
-
"depd": "
|
|
18
|
-
"inherits": "
|
|
19
|
-
"setprototypeof": "
|
|
20
|
-
"statuses": "
|
|
21
|
-
"toidentifier": "
|
|
13
|
+
"depd": "2.0.0",
|
|
14
|
+
"inherits": "2.0.4",
|
|
15
|
+
"setprototypeof": "1.2.0",
|
|
16
|
+
"statuses": "2.0.1",
|
|
17
|
+
"toidentifier": "1.0.1"
|
|
22
18
|
},
|
|
23
19
|
"devDependencies": {
|
|
24
20
|
"eslint": "7.32.0",
|
|
25
21
|
"eslint-config-standard": "14.1.1",
|
|
26
|
-
"eslint-plugin-import": "2.
|
|
22
|
+
"eslint-plugin-import": "2.25.3",
|
|
27
23
|
"eslint-plugin-markdown": "2.2.1",
|
|
28
24
|
"eslint-plugin-node": "11.1.0",
|
|
29
25
|
"eslint-plugin-promise": "5.2.0",
|
|
@@ -36,7 +32,7 @@
|
|
|
36
32
|
},
|
|
37
33
|
"scripts": {
|
|
38
34
|
"lint": "eslint . && node ./scripts/lint-readme-list.js",
|
|
39
|
-
"test": "mocha --reporter spec",
|
|
35
|
+
"test": "mocha --reporter spec --bail",
|
|
40
36
|
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
|
41
37
|
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
|
42
38
|
"version": "node scripts/version-history.js && git add HISTORY.md"
|