Correctly parse url for https if port is not 443.

This commit is contained in:
Nate 2015-08-31 18:30:27 +08:00
parent 9e36136075
commit 6a2803b7c1

View File

@ -20,9 +20,10 @@ var defaultRule = require("./rule_default.js"),
function userRequestHandler(req,userRes){ function userRequestHandler(req,userRes){
var host = req.headers.host, var host = req.headers.host,
urlPattern = url.parse(req.url),
path = urlPattern.path,
protocol = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http", protocol = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http",
fullUrl = protocol + '://' + host + req.url,
urlPattern = url.parse(fullUrl),
path = urlPattern.path,
resourceInfo, resourceInfo,
resourceInfoId = -1, resourceInfoId = -1,
reqData; reqData;