fix single ip ignored in no proxy setting
authorGui Chen <gui.chen@intel.com>
Tue, 14 Jan 2014 05:44:04 +0000 (00:44 -0500)
committerGui Chen <gui.chen@intel.com>
Tue, 14 Jan 2014 11:16:04 +0000 (06:16 -0500)
Fixes: #1569

Change-Id: Ic40c32ceaed78e59947af7f185e00e84ccbb30b8
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/utils/proxy.py

index 91451a2..c1fb94f 100644 (file)
@@ -16,6 +16,7 @@
 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 import os
+import re
 import urlparse
 
 _my_proxies = {}
@@ -145,7 +146,7 @@ def _isnoproxy(url):
 
     hostisip = _isip(host)
     for item in _my_noproxy_list:
-        if hostisip and item["match"] <= 1:
+        if hostisip and item["match"] == 1:
             continue
 
         if item["match"] == 2 and hostisip:
@@ -157,7 +158,7 @@ def _isnoproxy(url):
                 return True
 
         if item["match"] == 1:
-            if host.rfind(item["needle"]) > 0:
+            if re.match(r".*%s$" % item["needle"], host):
                 return True
 
     return False