Socket
Socket
Sign inDemoInstall

fast-proxy

Package Overview
Dependencies
7
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.3 to 1.7.0

14

index.js

@@ -12,3 +12,4 @@ 'use strict'

copyHeaders,
stripHttp1ConnectionHeaders
stripHttp1ConnectionHeaders,
filterHeaders
} = require('./lib/utils')

@@ -44,3 +45,3 @@

const sourceHttp2 = req.httpVersionMajor === 2
const headers = { ...sourceHttp2 ? filterPseudoHeaders(req.headers) : req.headers }
let headers = { ...sourceHttp2 ? filterPseudoHeaders(req.headers) : req.headers }
headers['x-forwarded-host'] = req.headers.host

@@ -59,3 +60,5 @@ headers.host = url.hostname

if (req.method === 'GET' || req.method === 'HEAD') {
headers['content-length'] = 0
if (headers['content-length']) {
headers = filterHeaders(headers, 'content-length')
}
} else {

@@ -68,2 +71,5 @@ if (req.body) {

populateHeaders(headers, body, 'text/plain')
} else if (headers['content-type'] === 'application/x-www-form-urlencoded') {
body = querystring.stringify(req.body)
populateHeaders(headers, body, 'application/x-www-form-urlencoded')
} else {

@@ -92,3 +98,3 @@ body = JSON.stringify(req.body)

res.end('Service Unavailable')
} else if (err.code === 'ECONNRESET') {
} else if (err.code === 'ECONNRESET' || err.code === 'UND_ERR_REQUEST_TIMEOUT') {
res.statusCode = 504

@@ -95,0 +101,0 @@ res.end(err.message)

@@ -58,6 +58,22 @@ 'use strict'

function filterHeaders (headers, filter) {
const headersKeys = Object.keys(headers)
const dest = {}
let header
let i
for (i = 0; i < headersKeys.length; i++) {
header = headersKeys[i].toLowerCase()
if (header !== filter) {
dest[header] = headers[header]
}
}
return dest
}
module.exports = {
copyHeaders,
stripHttp1ConnectionHeaders,
filterPseudoHeaders
filterPseudoHeaders,
filterHeaders
}
{
"name": "fast-proxy",
"version": "1.6.3",
"version": "1.7.0",
"description": "Forward your HTTP request to another server.",

@@ -40,12 +40,12 @@ "main": "index.js",

"chai": "^4.2.0",
"fastify": "^2.15.1",
"fastify-reply-from": "^2.1.0",
"follow-redirects": "^1.11.0",
"fastify": "^3.0.3",
"fastify-reply-from": "^3.1.2",
"follow-redirects": "^1.12.1",
"h2url": "^0.2.0",
"http-proxy": "^1.18.1",
"mocha": "^7.2.0",
"nock": "^12.0.3",
"mocha": "^8.0.1",
"nock": "^13.0.2",
"nyc": "^15.1.0",
"pem": "^1.14.4",
"restana": "^4.6.1",
"restana": "^4.6.2",
"standard": "^14.3.4",

@@ -59,4 +59,4 @@ "supertest": "^4.0.2"

"tiny-lru": "^7.0.6",
"undici": "^1.0.3"
"undici": "^1.2.2"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc