Reviewers: Jakob,

Description:
Stop using urllib.urlretrieve() directly.

Using urllib for SSL connections when behind a proxy is known to be
broken, so apply the same fix from depot_tools r149742 and use a wrapper
around urllib2 instead.

[email protected]
TEST=run test262 behind corporate proxy

Please review this at https://codereview.chromium.org/297663003/

SVN Base: git://github.com/v8/v8.git@master

Affected files (+13, -5 lines):
  M test/promises-aplus/testcfg.py
  M test/test262/testcfg.py
  M tools/testrunner/local/utils.py


Index: test/promises-aplus/testcfg.py
diff --git a/test/promises-aplus/testcfg.py b/test/promises-aplus/testcfg.py
index a5995a361d612f57fff79a98b1090e86d5c77f2a..bd033791871fcb9f518b393141aebee088faa119 100644
--- a/test/promises-aplus/testcfg.py
+++ b/test/promises-aplus/testcfg.py
@@ -31,9 +31,9 @@ import os
 import shutil
 import sys
 import tarfile
-import urllib

 from testrunner.local import testsuite
+from testrunner.local import utils
 from testrunner.objects import testcase


@@ -102,7 +102,7 @@ class PromiseAplusTestSuite(testsuite.TestSuite):
     directory = os.path.join(self.root, TEST_NAME)
     if not os.path.exists(archive):
       print('Downloading {0} from {1} ...'.format(TEST_NAME, TEST_URL))
-      urllib.urlretrieve(TEST_URL, archive)
+      utils.URLRetrieve(TEST_URL, archive)
       if os.path.exists(directory):
         shutil.rmtree(directory)

@@ -129,7 +129,7 @@ class PromiseAplusTestSuite(testsuite.TestSuite):
       os.mkdir(directory)
     path = os.path.join(directory, SINON_FILENAME)
     if not os.path.exists(path):
-      urllib.urlretrieve(SINON_URL, path)
+      utils.URLRetrieve(SINON_URL, path)
     hash = hashlib.sha256()
     with open(path, 'rb') as f:
       for chunk in iter(lambda: f.read(8192), ''):
Index: test/test262/testcfg.py
diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py
index 8e129d3144b4a57b6e21a76f8b6220c7d94c2d89..de3c9ad7b9f3645b7081806e137f133884ef3c31 100644
--- a/test/test262/testcfg.py
+++ b/test/test262/testcfg.py
@@ -31,9 +31,9 @@ import os
 import shutil
 import sys
 import tarfile
-import urllib

 from testrunner.local import testsuite
+from testrunner.local import utils
 from testrunner.objects import testcase


@@ -97,7 +97,7 @@ class Test262TestSuite(testsuite.TestSuite):
     directory_old_name = os.path.join(self.root, "data.old")
     if not os.path.exists(archive_name):
       print "Downloading test data from %s ..." % archive_url
-      urllib.urlretrieve(archive_url, archive_name)
+      utils.URLRetrieve(archive_url, archive_name)
       if os.path.exists(directory_name):
         if os.path.exists(directory_old_name):
           shutil.rmtree(directory_old_name)
Index: tools/testrunner/local/utils.py
diff --git a/tools/testrunner/local/utils.py b/tools/testrunner/local/utils.py index a5252b06a8ad08d2741e6d9a326e14777af51216..707fa24fbf1267ccf6b8ad32fd09cd621f266a11 100644
--- a/tools/testrunner/local/utils.py
+++ b/tools/testrunner/local/utils.py
@@ -32,6 +32,7 @@ from os.path import isdir
 from os.path import join
 import platform
 import re
+import urllib2


 def GetSuitePaths(test_root):
@@ -113,3 +114,10 @@ def GuessWordsize():

 def IsWindows():
   return GuessOS() == 'windows'
+
+
+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())


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to