Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: git_cl.py

Issue 10825107: Remove the use of urllib for SSL connections (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: Update to add docstring and fix mode on open() call Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 143ad2854d00072877a7d42dd30908983f1d0145..9716ef1258a786ffd163ac69c013b8d1d94765a8 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -16,7 +16,6 @@ import stat
import sys
import textwrap
import urlparse
-import urllib
import urllib2
try:
@@ -756,6 +755,13 @@ def LoadCodereviewSettingsFromFile(fileobj):
keyvals['ORIGIN_URL_CONFIG']])
+def urlretrieve(source, destination):
+ """urllib is broken for SSL connections via a proxy therefore we
+ can't use urllib.urlretrieve()."""
+ with open(destination, 'w') as f:
+ f.write(urllib2.urlopen(source).read())
+
+
def DownloadHooks(force):
"""downloads hooks
@@ -773,7 +779,7 @@ def DownloadHooks(force):
return
os.remove(dst)
try:
- urllib.urlretrieve(src, dst)
+ urlretrieve(src, dst)
os.chmod(dst, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
except Exception:
if os.path.exists(dst):
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698