diff options
| author | Egor Tensin <egor@tensin.name> | 2026-03-14 12:19:48 +0100 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-03-14 12:19:48 +0100 |
| commit | 5736345440e43ac7f8d72c748c6b959bee5f8aa8 (patch) | |
| tree | 367b7d90a8d2e199b70a196a1a91c2aa267c5633 /node_modules/undici/lib/core/request.js | |
| parent | Merge pull request #8 from egor-tensin/dependabot/npm_and_yarn/undici-6.24.1 (diff) | |
| download | cleanup-path-5736345440e43ac7f8d72c748c6b959bee5f8aa8.tar.gz cleanup-path-5736345440e43ac7f8d72c748c6b959bee5f8aa8.zip | |
wait, what the hell? doesn't Dependabot update node_modules as well?
Diffstat (limited to 'node_modules/undici/lib/core/request.js')
| -rw-r--r-- | node_modules/undici/lib/core/request.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/node_modules/undici/lib/core/request.js b/node_modules/undici/lib/core/request.js index 7800303..4da6066 100644 --- a/node_modules/undici/lib/core/request.js +++ b/node_modules/undici/lib/core/request.js @@ -66,6 +66,10 @@ class Request { throw new InvalidArgumentError('upgrade must be a string') } + if (upgrade && !isValidHeaderValue(upgrade)) { + throw new InvalidArgumentError('invalid upgrade header') + } + if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) { throw new InvalidArgumentError('invalid headersTimeout') } @@ -360,13 +364,19 @@ function processHeader (request, key, val) { val = `${val}` } - if (request.host === null && headerName === 'host') { + if (headerName === 'host') { + if (request.host !== null) { + throw new InvalidArgumentError('duplicate host header') + } if (typeof val !== 'string') { throw new InvalidArgumentError('invalid host header') } // Consumed by Client request.host = val - } else if (request.contentLength === null && headerName === 'content-length') { + } else if (headerName === 'content-length') { + if (request.contentLength !== null) { + throw new InvalidArgumentError('duplicate content-length header') + } request.contentLength = parseInt(val, 10) if (!Number.isFinite(request.contentLength)) { throw new InvalidArgumentError('invalid content-length header') |
