Commit b60bdf6f authored by Alexandre's avatar Alexandre
Browse files

[DoT]Pass SNI choice to the Connection object

parent 2433b84f
......@@ -427,12 +427,13 @@ class Connection:
class ConnectionDoT(Connection):
def __init__(self, server, servername=None, connect=None, forceIPv4=False, forceIPv6=False,
pipelining=False, verbose=False, debug=False, insecure=False):
sni=True, pipelining=False, verbose=False, debug=False, insecure=False):
Connection.__init__(self, server, servername=servername, connect_to=connect,
forceIPv4=forceIPv4, forceIPv6=forceIPv6, dot=True,
verbose=verbose, debug=debug, insecure=insecure)
self.sni = sni
self.pipelining = pipelining
if self.pipelining:
self.all_requests = [] # Currently, we load everything in memory
......@@ -515,7 +516,7 @@ class ConnectionDoT(Connection):
OpenSSL.SSL.VERIFY_CLIENT_ONCE,
lambda conn, cert, errno, depth, preverify_ok: preverify_ok)
self.session = OpenSSL.SSL.Connection(self.context, self.sock)
if opts.sni: # remove global variable call
if self.sni:
self.session.set_tlsext_host_name(canonicalize(self.check_name_cert).encode())
try:
......@@ -1341,7 +1342,7 @@ for opts.connectTo in ip_set:
if opts.dot:
conn = ConnectionDoT(url, servername=extracheck, connect=opts.connectTo, verbose=opts.verbose,
debug=opts.debug, forceIPv4=opts.forceIPv4, forceIPv6=opts.forceIPv6,
pipelining=opts.pipelining, insecure=opts.insecure)
sni=opts.sni, pipelining=opts.pipelining, insecure=opts.insecure)
else:
conn = ConnectionDoH(url, servername=extracheck, connect=opts.connectTo, verbose=opts.verbose,
debug=opts.debug, forceIPv4=opts.forceIPv4, forceIPv6=opts.forceIPv6,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment