Revision: 21402
Author:   [email protected]
Date:     Wed May 21 09:25:05 2014 UTC
Log:      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

Review URL: https://codereview.chromium.org/297663003

Patch from Raphael Kubo da Costa <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21402

Modified:
 /branches/bleeding_edge/test/promises-aplus/testcfg.py
 /branches/bleeding_edge/test/test262/testcfg.py
 /branches/bleeding_edge/tools/testrunner/local/utils.py

=======================================
--- /branches/bleeding_edge/test/promises-aplus/testcfg.py Mon Apr 28 15:20:39 2014 UTC +++ /branches/bleeding_edge/test/promises-aplus/testcfg.py Wed May 21 09:25:05 2014 UTC
@@ -31,9 +31,9 @@
 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 @@
     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 @@
       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), ''):
=======================================
--- /branches/bleeding_edge/test/test262/testcfg.py Fri Feb 28 12:34:12 2014 UTC +++ /branches/bleeding_edge/test/test262/testcfg.py Wed May 21 09:25:05 2014 UTC
@@ -31,9 +31,9 @@
 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 @@
     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)
=======================================
--- /branches/bleeding_edge/tools/testrunner/local/utils.py Fri Mar 21 09:28:26 2014 UTC +++ /branches/bleeding_edge/tools/testrunner/local/utils.py Wed May 21 09:25:05 2014 UTC
@@ -32,6 +32,7 @@
 from os.path import join
 import platform
 import re
+import urllib2


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

 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