From b513f1a5d7d4b5772d5d9c8dca189d71622777f6 Mon Sep 17 00:00:00 2001
From: OttoMao <ottomao@gmail.com>
Date: Wed, 19 Aug 2015 11:03:33 +0800
Subject: [PATCH] bugfix for intercepting some https url

---
 CHANGELOG             | 4 ++++
 lib/requestHandler.js | 2 +-
 package.json          | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 7778bf9..f710b7a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+19 Aug: AnyProxy 3.7.4:
+
+    * bugfix for intercepting urls like http://a.com?url=http://b.com
+
 31 July: AnyProxy 3.7.3:
 
     * show lastest 100 records when visit the web ui
diff --git a/lib/requestHandler.js b/lib/requestHandler.js
index e24ee69..482d737 100644
--- a/lib/requestHandler.js
+++ b/lib/requestHandler.js
@@ -22,7 +22,7 @@ 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",
+        protocol           = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http",
         resourceInfo,
         resourceInfoId     = -1,
         reqData;
diff --git a/package.json b/package.json
index a68fb90..cef0ac1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "anyproxy",
-  "version": "3.7.3",
+  "version": "3.7.4",
   "description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
   "main": "proxy.js",
   "bin": {