Remove requiresPort dependency

location.host is directly parsed from the full URL, so the
"concatenate host and port" branch was never taken.
This commit is contained in:
Rob Wu
2016-02-26 12:58:11 +01:00
parent f9af03e762
commit 24db52500f
2 changed files with 2 additions and 6 deletions

View File

@@ -8,7 +8,6 @@ var net = require('net');
var url = require('url');
var regexp_tld = require('./regexp-top-level-domain');
var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
var requiresPort = require('requires-port');
var help_file = __dirname + '/help.txt';
var help_text;
@@ -83,9 +82,7 @@ function proxyRequest(req, res, proxy) {
prependPath: false,
target: location,
headers: {
host: requiresPort(location.port, location.protocol) && !/:\d*$/.test(location.host) ?
location.host + ':' + location.port :
location.host,
host: location.host,
},
};
var proxyThroughUrl = req.corsAnywhereRequestState.getProxyForUrl(location.href);

View File

@@ -22,8 +22,7 @@
"main": "./lib/cors-anywhere.js",
"dependencies": {
"http-proxy": "1.11.1",
"proxy-from-env": "0.0.1",
"requires-port": "1.0.0"
"proxy-from-env": "0.0.1"
},
"devDependencies": {
"coveralls": "^2.11.6",