@fastify/reply-from
Advanced tools
Comparing version 8.4.1 to 8.4.2
@@ -8,3 +8,3 @@ 'use strict' | ||
const undici = require('undici') | ||
const { patchUndiciHeaders, stripHttp1ConnectionHeaders } = require('./utils') | ||
const { stripHttp1ConnectionHeaders } = require('./utils') | ||
const http2 = require('http2') | ||
@@ -162,3 +162,3 @@ | ||
done(null, { statusCode: res.statusCode, headers: patchUndiciHeaders(res.headers), stream: res.body }) | ||
done(null, { statusCode: res.statusCode, headers: res.headers, stream: res.body }) | ||
}) | ||
@@ -165,0 +165,0 @@ } |
@@ -15,27 +15,2 @@ 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) { | ||
@@ -103,3 +78,2 @@ const headersKeys = Object.keys(headers) | ||
module.exports = { | ||
patchUndiciHeaders, | ||
copyHeaders, | ||
@@ -106,0 +80,0 @@ stripHttp1ConnectionHeaders, |
{ | ||
"name": "@fastify/reply-from", | ||
"version": "8.4.1", | ||
"version": "8.4.2", | ||
"description": "forward your HTTP request to another server, for fastify", | ||
@@ -58,3 +58,3 @@ "main": "index.js", | ||
"tiny-lru": "^10.0.0", | ||
"undici": "^5.5.1" | ||
"undici": "^5.19.1" | ||
}, | ||
@@ -61,0 +61,0 @@ "pre-commit": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165468
4908
Updatedundici@^5.19.1