]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Merge branch 'master' into opener-to-ydl
authorPhilipp Hagemeister <phihag@phihag.de>
Sun, 24 Nov 2013 14:18:44 +0000 (15:18 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Sun, 24 Nov 2013 14:18:44 +0000 (15:18 +0100)
1  2 
youtube_dl/YoutubeDL.py
youtube_dl/__init__.py
youtube_dl/extractor/common.py
youtube_dl/utils.py

Simple merge
Simple merge
Simple merge
index 0d2b7bd10e1f385bf6515c0faae6588a1c7f31ec,34b3d19e05dcc23cc69930e54ddd9ddf41af1142..317aee2b572f31effd654bfefc95601f77b6482b
@@@ -535,13 -536,31 +536,30 @@@ def formatSeconds(secs)
      else:
          return '%d' % secs
  
 -
 -def make_HTTPS_handler(opts):
 +def make_HTTPS_handler(opts_no_check_certificate):
-     if sys.version_info < (3,2):
-         # Python's 2.x handler is very simplistic
-         return compat_urllib_request.HTTPSHandler()
+     if sys.version_info < (3, 2):
+         import httplib
+         class HTTPSConnectionV3(httplib.HTTPSConnection):
+             def __init__(self, *args, **kwargs):
+                 httplib.HTTPSConnection.__init__(self, *args, **kwargs)
+             def connect(self):
+                 sock = socket.create_connection((self.host, self.port), self.timeout)
+                 if self._tunnel_host:
+                     self.sock = sock
+                     self._tunnel()
+                 try:
+                     self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3)
+                 except ssl.SSLError as e:
+                     self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23)
+         class HTTPSHandlerV3(compat_urllib_request.HTTPSHandler):
+             def https_open(self, req):
+                 return self.do_open(HTTPSConnectionV3, req)
+         return HTTPSHandlerV3()
      else:
-         import ssl
-         context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+         context = ssl.SSLContext(ssl.PROTOCOL_SSLv3)
          context.set_default_verify_paths()
          
          context.verify_mode = (ssl.CERT_NONE