#2765: Add support for TLS SNI in httpdownloader
--------------------+--------------------
  Reporter:  Cas    |      Owner:
      Type:  bug    |     Status:  new
  Priority:  minor  |  Milestone:  1.3.13
 Component:  Core   |    Version:  1.3.11
Resolution:         |   Keywords:
--------------------+--------------------

Comment (by Cas):

 For reference here is the current working code:
 {{{#!diff
 diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py
 index 14dcdc3..0b8d1af 100644
 --- a/deluge/httpdownloader.py
 +++ b/deluge/httpdownloader.py
 @@ -211,7 +211,15 @@ def download_file(url, filename, callback=None,
 headers=None, force_filename=Fal
      factory = HTTPDownloader(url, filename, callback, headers,
 force_filename, allow_compression)
      if scheme == "https":
          from twisted.internet import ssl
 -        reactor.connectSSL(host, port, factory,
 ssl.ClientContextFactory())
 +        from twisted.internet._sslverify import ClientTLSOptions
 +
 +        class TLSSNIContextFactory(ssl.ClientContextFactory):
 +            def getContext(self, hostname=None, port=None):
 +                ctx = ssl.ClientContextFactory.getContext(self)
 +                ClientTLSOptions(host, ctx)
 +                return ctx
 +
 +        reactor.connectSSL(host, port, factory, TLSSNIContextFactory())
      else:
          reactor.connectTCP(host, port, factory)

 }}}

-- 
Ticket URL: <http://dev.deluge-torrent.org/ticket/2765#comment:1>
Deluge <http://deluge-torrent.org/>
Deluge Project

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

Reply via email to