proxy-chain
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-beta.3
@@ -6,8 +6,2 @@ 'use strict'; | ||
}); | ||
exports.nodeify = exports.maybeAddProxyAuthorizationHeader = exports.PORT_SELECTION_CONFIG = exports.addHeader = exports.parseProxyAuthorizationHeader = exports.redactParsedUrl = exports.redactUrl = exports.parseUrl = exports.isInvalidHeader = exports.isHopByHopHeader = exports.parseHostHeader = undefined; | ||
var _http_common = require('_http_common'); | ||
// eslint-disable-line | ||
var HOST_HEADER_REGEX = /^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]))(:([0-9]+))?$/; | ||
@@ -48,2 +42,26 @@ | ||
var TOKEN_REGEX = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; | ||
/** | ||
* Verifies that the given val is a valid HTTP token per the rules defined in RFC 7230 | ||
* @see https://tools.ietf.org/html/rfc7230#section-3.2.6 | ||
* @see https://github.com/nodejs/node/blob/8cf5ae07e9e80747c19e0fc04fad48423707f62c/lib/_http_common.js#L222 | ||
*/ | ||
var isHttpToken = function isHttpToken(val) { | ||
return TOKEN_REGEX.test(val); | ||
}; | ||
var HEADER_CHAR_REGEX = /[^\t\x20-\x7e\x80-\xff]/; | ||
/** | ||
* True if val contains an invalid field-vchar | ||
* field-value = *( field-content / obs-fold ) | ||
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] | ||
* field-vchar = VCHAR / obs-text | ||
* @see https://github.com/nodejs/node/blob/8cf5ae07e9e80747c19e0fc04fad48423707f62c/lib/_http_common.js#L233 | ||
*/ | ||
var isInvalidHeaderChar = function isInvalidHeaderChar(val) { | ||
return HEADER_CHAR_REGEX.test(val); | ||
}; | ||
// This code is based on Node.js' validateHeader() function from _http_outgoing.js module | ||
@@ -53,3 +71,3 @@ // (see https://github.com/nodejs/node/blob/189d29f39e6de9ccf10682bfd1341819b4a2291f/lib/_http_outgoing.js#L485) | ||
// NOTE: These are internal Node.js functions, they might stop working in the future! | ||
return typeof name !== 'string' || !name || !(0, _http_common._checkIsHttpToken)(name) || value === undefined || (0, _http_common._checkInvalidHeaderChar)(value); | ||
return typeof name !== 'string' || !name || !isHttpToken(name) || value === undefined || isInvalidHeaderChar(value); | ||
}; | ||
@@ -56,0 +74,0 @@ |
{ | ||
"name": "proxy-chain", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-beta.3", | ||
"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
138340
1984