proxy-chain
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -56,2 +56,6 @@ 'use strict'; | ||
var hostHeaderFound = false; | ||
// TODO: We should probably use a raw HTTP message via socket instead of http.request(), | ||
// since Node transforms the headers to lower case and thus makes it easy to detect the proxy | ||
for (var i = 0; i < this.srcRequest.rawHeaders.length; i += 2) { | ||
@@ -61,3 +65,3 @@ var headerName = this.srcRequest.rawHeaders[i]; | ||
if (headerName === 'Connection' && headerValue === 'keep-alive') { | ||
if (/^connection$/i.test(headerName) && /^keep-alive$/i.test(headerValue)) { | ||
// Keep the "Connection: keep-alive" header, to reduce the chance that the server | ||
@@ -69,6 +73,11 @@ // will detect we're not a browser and also to improve performance | ||
continue; | ||
} else if (/^host$/i.test(headerName)) { | ||
// If Host header was used multiple times, only consider the first one. | ||
// This is to prevent "TypeError: hostHeader.startsWith is not a function at calculateServerName (_http_agent.js:240:20)" | ||
if (hostHeaderFound) continue; | ||
hostHeaderFound = true; | ||
} | ||
/* | ||
if (!hasXForwardedFor && 'x-forwarded-for' === keyLower) { | ||
if (!hasXForwardedFor && 'x-forwarded-for' === keyLower) { | ||
// append to existing "X-Forwarded-For" header | ||
@@ -75,0 +84,0 @@ // http://en.wikipedia.org/wiki/X-Forwarded-For |
@@ -0,1 +1,6 @@ | ||
0.3.2 / 2019-09-17 | ||
=================== | ||
- Bugfix: Prevent the `"TypeError: hostHeader.startsWith is not a function` error | ||
in `HandlerForward` by not forwarding duplicate `Host` headers | ||
0.3.1 / 2019-09-07 | ||
@@ -2,0 +7,0 @@ =================== |
{ | ||
"name": "proxy-chain", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Node.js implementation of a proxy server (think Squid) with support for SSL, authentication, upstream proxy chaining, and protocol tunneling.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
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
123061
1856