http-proxy
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -7,5 +7,5 @@ var http = require('http'), | ||
/** | ||
* Export the the proxy "Server" as the main export | ||
* Export the proxy "Server" as the main export. | ||
*/ | ||
module.exports = httpProxy.Server; | ||
module.exports = httpProxy.Server; | ||
@@ -12,0 +12,0 @@ /** |
@@ -74,5 +74,3 @@ var common = exports, | ||
outgoing.path = targetPath | ||
? targetPath + '/' + outgoingPath | ||
: outgoingPath; | ||
outgoing.path = common.urlJoin(targetPath, outgoingPath); | ||
@@ -108,7 +106,34 @@ return outgoing; | ||
/** | ||
* Get the port number from the host. Or guess it based on the connection type. | ||
* | ||
* @param {Request} req Incoming HTTP request. | ||
* | ||
* @return {String} The port number. | ||
* | ||
* @api private | ||
*/ | ||
common.getPort = function(req) { | ||
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : ""; | ||
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : ''; | ||
return res ? | ||
res[1] : | ||
req.connection.pair ? '443' : '80' ; | ||
} | ||
req.connection.pair ? '443' : '80'; | ||
}; | ||
/** | ||
* OS-agnostic join (doesn't break on URLs like path.join does on Windows)> | ||
* | ||
* @return {String} The generated path. | ||
* | ||
* @api private | ||
*/ | ||
common.urlJoin = function() { | ||
var args = Array.prototype.slice.call(arguments); | ||
// Join all strings, but remove empty strings so we don't get extra slashes from | ||
// joining e.g. ['', 'am'] | ||
return args.filter(function filter(a) { | ||
return !!a; | ||
}).join('/').replace(/\/+/g, '/'); | ||
}; |
{ | ||
"name" : "http-proxy", | ||
"version" : "1.4.2", | ||
"version" : "1.4.3", | ||
@@ -5,0 +5,0 @@ "repository" : { |
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
122640
12
640