From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Cc: "Aníbal Limón" <limon.anibal@gmail.com>
Subject: [PATCHv4 5/7] fetch2/wget.py: checkstatus fix using proxy handler
Date: Wed, 8 Jul 2015 18:34:19 -0500 [thread overview]
Message-ID: <1436398461-26014-6-git-send-email-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <1436398461-26014-1-git-send-email-anibal.limon@linux.intel.com>
From: Aníbal Limón <limon.anibal@gmail.com>
Only use ProxyHandler opener when exists proxies in env.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
lib/bb/fetch2/wget.py | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 8cb5f2b..7e90efb 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -221,17 +221,29 @@ class Wget(FetchMethod):
def export_proxies(d):
variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY']
+ exported = False
for v in variables:
- if not v in os.environ.keys():
- os.environ[v] = d.getVar(v, True) or ''
+ if v in os.environ.keys():
+ exported = True
+ else:
+ v_proxy = d.getVar(v, True)
+ if v_proxy is not None:
+ os.environ[v] = v_proxy
+ exported = True
+
+ return exported
def head_method(self):
return "HEAD"
- export_proxies(d)
+ exported_proxies = export_proxies(d)
+ if exported_proxies == True:
+ opener = urllib2.build_opener(urllib2.ProxyHandler, CacheHTTPHandler)
+ else:
+ opener = urllib2.build_opener(CacheHTTPHandler)
+
urllib2.Request.get_method = head_method
- opener = urllib2.build_opener(urllib2.ProxyHandler, CacheHTTPHandler)
urllib2.install_opener(opener)
uri = ud.url.split(";")[0]
--
1.9.1
next 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 ` Aníbal Limón [this message]
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 ` [PATCHv4 7/7] fetch2/wget.py: checkstatus disable SSL cert validation Aníbal Limón
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-6-git-send-email-anibal.limon@linux.intel.com \
--to=anibal.limon@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=limon.anibal@gmail.com \
/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