Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

undici

Package Overview
Dependencies
Maintainers
3
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undici - npm Package Compare versions

Comparing version 5.21.1 to 5.21.2

37

lib/core/util.js

@@ -225,6 +225,2 @@ 'use strict'

const encoding = key.length === 19 && key === 'content-disposition'
? 'latin1'
: 'utf8'
if (!val) {

@@ -234,3 +230,3 @@ if (Array.isArray(headers[i + 1])) {

} else {
obj[key] = headers[i + 1].toString(encoding)
obj[key] = headers[i + 1].toString('utf8')
}

@@ -242,5 +238,11 @@ } else {

}
val.push(headers[i + 1].toString(encoding))
val.push(headers[i + 1].toString('utf8'))
}
}
// See https://github.com/nodejs/node/pull/46528
if ('content-length' in obj && 'content-disposition' in obj) {
obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1')
}
return obj

@@ -251,13 +253,24 @@ }

const ret = []
let hasContentLength = false
let contentDispositionIdx = -1
for (let n = 0; n < headers.length; n += 2) {
const key = headers[n + 0].toString()
const val = headers[n + 1].toString('utf8')
const encoding = key.length === 19 && key.toLowerCase() === 'content-disposition'
? 'latin1'
: 'utf8'
if (key.length === 14 && (key === 'content-length' || key.toLowerCase() === 'content-length')) {
ret.push(key, val)
hasContentLength = true
} else if (key.length === 19 && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) {
contentDispositionIdx = ret.push(key, val) - 1
} else {
ret.push(key, val)
}
}
const val = headers[n + 1].toString(encoding)
// See https://github.com/nodejs/node/pull/46528
if (hasContentLength && contentDispositionIdx !== -1) {
ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1')
}
ret.push(key, val)
}
return ret

@@ -264,0 +277,0 @@ }

@@ -98,2 +98,3 @@ // https://github.com/Ethan-Arrowood/undici-fetch

this[kHeadersSortedMap] = null
this.cookies = null
}

@@ -100,0 +101,0 @@

{
"name": "undici",
"version": "5.21.1",
"version": "5.21.2",
"description": "An HTTP/1.1 client, written from scratch for Node.js",

@@ -5,0 +5,0 @@ "homepage": "https://undici.nodejs.org",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc