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

@fastify/reply-from

Package Overview
Dependencies
Maintainers
19
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/reply-from - npm Package Compare versions

Comparing version 8.4.0 to 8.4.1

test/undici-chaining.js

4

lib/request.js

@@ -8,3 +8,3 @@ 'use strict'

const undici = require('undici')
const { stripHttp1ConnectionHeaders } = require('./utils')
const { patchUndiciHeaders, stripHttp1ConnectionHeaders } = require('./utils')
const http2 = require('http2')

@@ -162,3 +162,3 @@

done(null, { statusCode: res.statusCode, headers: res.headers, stream: res.body })
done(null, { statusCode: res.statusCode, headers: patchUndiciHeaders(res.headers), stream: res.body })
})

@@ -165,0 +165,0 @@ }

@@ -15,2 +15,27 @@ function filterPseudoHeaders (headers) {

// http requires the header to be encoded with latin1
// undici will convert the latin1 buffer to utf8
// https://github.com/nodejs/undici/blob/2b260c997ad4efe4ed2064b264b4b546a59e7a67/lib/core/util.js#L216-L229
// after chaining, the header will be serialised using wrong encoding
// Buffer.from('', 'latin1').toString('utf8') applied
//
// in order to persist the encoding, always encode it
// back to latin1
function patchUndiciHeaders (headers) {
const headersKeys = Object.keys(headers)
const dist = {}
let header
let i
for (i = 0; i < headersKeys.length; i++) {
header = headersKeys[i]
if (header.charCodeAt(0) !== 58) { // fast path for indexOf(':') === 0
dist[header] = Buffer.from(headers[header]).toString('latin1')
}
}
return dist
}
function copyHeaders (headers, reply) {

@@ -78,2 +103,3 @@ const headersKeys = Object.keys(headers)

module.exports = {
patchUndiciHeaders,
copyHeaders,

@@ -80,0 +106,0 @@ stripHttp1ConnectionHeaders,

{
"name": "@fastify/reply-from",
"version": "8.4.0",
"version": "8.4.1",
"description": "forward your HTTP request to another server, for fastify",

@@ -5,0 +5,0 @@ "main": "index.js",

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