From 6a2803b7c18a161d4b69a0340c5fb3201aac5a78 Mon Sep 17 00:00:00 2001
From: Nate <nate.wang@sap.com>
Date: Mon, 31 Aug 2015 18:30:27 +0800
Subject: [PATCH 1/3] Correctly parse url for https if port is not 443.

---
 lib/requestHandler.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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

From 6b89a0b9d7acf4ab27faa1efda251ce1d01145c8 Mon Sep 17 00:00:00 2001
From: Nate <nate.wang@sap.com>
Date: Tue, 1 Sep 2015 11:08:41 +0800
Subject: [PATCH 2/3] Get full url for https and http separately.

---
 lib/requestHandler.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/requestHandler.js b/lib/requestHandler.js
index 4940782..be501a7 100644
--- a/lib/requestHandler.js
+++ b/lib/requestHandler.js
@@ -21,7 +21,7 @@ function userRequestHandler(req,userRes){
 
     var host               = req.headers.host,
         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),
         path               = urlPattern.path,
         resourceInfo,

From 9fc48d5e363aafbd5c4fec86d12f325b18c090e1 Mon Sep 17 00:00:00 2001
From: OttoMao <ottomao@gmail.com>
Date: Thu, 3 Sep 2015 10:51:17 +0800
Subject: [PATCH 3/3] update some comment for req.url

---
 lib/requestHandler.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/requestHandler.js b/lib/requestHandler.js
index be501a7..4c5340a 100644
--- a/lib/requestHandler.js
+++ b/lib/requestHandler.js
@@ -18,7 +18,12 @@ var defaultRule = require("./rule_default.js"),
     userRule    = defaultRule; //init
 
 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,
         protocol           = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http",
         fullUrl            = protocol === "http" ? req.url : (protocol + '://' + host + req.url),
@@ -418,10 +423,3 @@ module.exports.userRequestHandler = userRequestHandler;
 module.exports.connectReqHandler  = connectReqHandler;
 module.exports.setRules           = setRules;
 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
-*/