mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 16:01:26 +00:00
Merge branch 'supnate-master'
bugfix for proxy https server with a port other than 443
This commit is contained in:
commit
6146b23988
@ -18,11 +18,17 @@ 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,
|
||||||
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 === "http" ? req.url : (protocol + '://' + host + req.url),
|
||||||
|
urlPattern = url.parse(fullUrl),
|
||||||
|
path = urlPattern.path,
|
||||||
resourceInfo,
|
resourceInfo,
|
||||||
resourceInfoId = -1,
|
resourceInfoId = -1,
|
||||||
reqData;
|
reqData;
|
||||||
@ -417,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
|
|
||||||
*/
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user