Get full url for https and http separately.

This commit is contained in:
Nate 2015-09-01 11:08:41 +08:00
parent 6a2803b7c1
commit 6b89a0b9d7

View File

@ -21,7 +21,7 @@ function userRequestHandler(req,userRes){
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 + '://' + host + req.url, fullUrl = protocol === "http" ? req.url : (protocol + '://' + host + req.url),
urlPattern = url.parse(fullUrl), urlPattern = url.parse(fullUrl),
path = urlPattern.path, path = urlPattern.path,
resourceInfo, resourceInfo,