From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCHv4 7/7] fetch2/wget.py: checkstatus disable SSL cert validation.
Date: Wed, 8 Jul 2015 18:34:21 -0500 [thread overview]
Message-ID: <1436398461-26014-8-git-send-email-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <1436398461-26014-1-git-send-email-anibal.limon@linux.intel.com>
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>
---
lib/bb/fetch2/wget.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 7e90efb..545f02d 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
--
1.9.1
prev parent reply other threads:[~2015-07-08 23:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 23:34 [PATCHv4 0/7] Add connection cache support in wget checkstatus Aníbal Limón
2015-07-08 23:34 ` [PATCHv4 1/7] fetch2/__init__.py: Add FetchConnectionCache class Aníbal Limón
2015-07-08 23:34 ` [PATCHv4 2/7] fetch2: Add fetch parameter to checkstatus Aníbal Limón
2015-07-08 23:34 ` [PATCHv4 3/7] fetch2/wget.py: Add support of connection cache in checkstatus Aníbal Limón
2015-07-08 23:34 ` [PATCHv4 4/7] tests/fetch.py: Add FetchCheckStatusTest tests Aníbal Limón
2015-07-08 23:34 ` [PATCHv4 5/7] fetch2/wget.py: checkstatus fix using proxy handler Aníbal Limón
2015-07-08 23:34 ` [PATCHv4 6/7] tests/fetch.py: FetchCheckStatusTest add cases for ftp and https Aníbal Limón
2015-07-08 23:34 ` Aníbal Limón [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436398461-26014-8-git-send-email-anibal.limon@linux.intel.com \
--to=anibal.limon@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox