aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/wget.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-07-08 18:34:21 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-12 22:50:27 +0100
commite177170200ece76b36e3f7d5597651fdef67736f (patch)
tree905efbef5e75dde3f8f05e9f747ada46622a2ab1 /lib/bb/fetch2/wget.py
parent36f2577d075f87090766877473f9030e44a941a2 (diff)
downloadbitbake-contrib-e177170200ece76b36e3f7d5597651fdef67736f.tar.gz
fetch2/wget.py: checkstatus disable SSL cert validation.
Since Python 2.7.9 ssl cert validation is enabled by default see PEP-0476, this causes verification errors on some https servers so disable by default. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/wget.py')
-rw-r--r--lib/bb/fetch2/wget.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 7e90efb4d..545f02dcf 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -238,7 +238,22 @@ class Wget(FetchMethod):
return "HEAD"
exported_proxies = export_proxies(d)
- if exported_proxies == True:
+
+ # XXX: Since Python 2.7.9 ssl cert validation is enabled by default
+ # see PEP-0476, this causes verification errors on some https servers
+ # so disable by default.
+ import ssl
+ ssl_context = None
+ if hasattr(ssl, '_create_unverified_context'):
+ ssl_context = ssl._create_unverified_context()
+
+ if exported_proxies == True and ssl_context is not None:
+ opener = urllib2.build_opener(urllib2.ProxyHandler, CacheHTTPHandler,
+ urllib2.HTTPSHandler(context=ssl_context))
+ elif exported_proxies == False and ssl_context is not None:
+ opener = urllib2.build_opener(CacheHTTPHandler,
+ urllib2.HTTPSHandler(context=ssl_context))
+ elif exported_proxies == True and ssl_context is None:
opener = urllib2.build_opener(urllib2.ProxyHandler, CacheHTTPHandler)
else:
opener = urllib2.build_opener(CacheHTTPHandler)
@@ -247,8 +262,9 @@ class Wget(FetchMethod):
urllib2.install_opener(opener)
uri = ud.url.split(";")[0]
+
try:
- f = urllib2.urlopen(uri)
+ urllib2.urlopen(uri)
except:
return False
return True