Permalink
Browse files

Rename header vars

  • Loading branch information...
1 parent d7508d5 commit 35063618eca82107f6aaaa7c935a84e95bc7ee5b @camshaft committed Mar 22, 2013
Showing with 8 additions and 8 deletions.
  1. +8 −8 index.js
View
@@ -2,17 +2,17 @@ module.exports = function(options) {
options = options || {};
// Header names
- var host = options.host || 'x-forwarded-host'
- , path = options.path || 'x-forwarded-path'
- , port = options.port || 'x-forwarded-port'
- , proto = options.proto || 'x-forwarded-proto';
+ var hostHeader = options.host || 'x-forwarded-host'
+ , pathHeader = options.path || 'x-forwarded-path'
+ , portHeader = options.port || 'x-forwarded-port'
+ , protoHeader = options.proto || 'x-forwarded-proto';
return function base(req, res, next) {
var hostParts = req.headers.host.split(":")
- , host = req.headers[host] || hostParts[0] || ""
- , path = req.headers[path] || ""
- , protocol = req.headers[proto] || req.protocol || "http"
- , port = req.headers[port] || hostParts[1] || "";
+ , host = req.headers[hostHeader] || hostParts[0] || ""
+ , path = req.headers[pathHeader] || ""
+ , protocol = req.headers[protoHeader] || req.protocol || "http"
+ , port = req.headers[portHeader] || hostParts[1] || "";
if((port == 80 && protocol === "http") || (port == 443 && protocol === "https")) port = "";
if(port) port = ":"+port;

0 comments on commit 3506361

Please sign in to comment.