Fix for proxy crash if `HOST` header is not defined bug https://github.com/nodejitsu/node-http-proxy/issues/591.
This commit is contained in:
Alexander 2014-02-26 15:12:38 +02:00
parent 10670540ac
commit 99f757251b

View File

@ -75,7 +75,7 @@ common.setupSocket = function(socket) {
};
common.getPort = function(req) {
var res = req.headers.host.match(/:(\d+)/);
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : "";
return res ?
res[1] :
req.connection.pair ? '443' : '80' ;