update some comment for req.url

This commit is contained in:
OttoMao 2015-09-03 10:51:17 +08:00
parent 6b89a0b9d7
commit 9fc48d5e36

View File

@ -18,7 +18,12 @@ var defaultRule = require("./rule_default.js"),
userRule = defaultRule; //init userRule = defaultRule; //init
function userRequestHandler(req,userRes){ function userRequestHandler(req,userRes){
/*
note
req.url is wired
in http server : http://www.example.com/a/b/c
in https server : /a/b/c
*/
var host = req.headers.host, var host = req.headers.host,
protocol = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http", protocol = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http",
fullUrl = protocol === "http" ? req.url : (protocol + '://' + host + req.url), fullUrl = protocol === "http" ? req.url : (protocol + '://' + host + req.url),
@ -418,10 +423,3 @@ module.exports.userRequestHandler = userRequestHandler;
module.exports.connectReqHandler = connectReqHandler; module.exports.connectReqHandler = connectReqHandler;
module.exports.setRules = setRules; module.exports.setRules = setRules;
module.exports.getRuleSummary = getRuleSummary; module.exports.getRuleSummary = getRuleSummary;
/*
note
req.url is wired
in http server : http://www.example.com/a/b/c
in https server : /a/b/c
*/