Skip to content

Commit b5b3411

Browse files
committed
1 parent d5e6be4 commit b5b3411

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
18971897
kb.safeReq = AttribDict()
18981898
kb.singleLogFlags = set()
18991899
kb.reduceTests = None
1900-
kb.tlsSNI = None
1900+
kb.tlsSNI = {}
19011901
kb.stickyDBMS = False
19021902
kb.stickyLevel = None
19031903
kb.storeCrawlingChoice = None

lib/request/httpshandler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ def create_sock():
4545

4646
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
4747
# https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni
48-
if kb.tlsSNI != False and hasattr(ssl, "SSLContext"):
48+
if kb.tlsSNI.get(self.host) != False and hasattr(ssl, "SSLContext"):
4949
for protocol in filter(lambda _: _ >= ssl.PROTOCOL_TLSv1, _protocols):
5050
try:
5151
sock = create_sock()
5252
context = ssl.SSLContext(protocol)
53-
_ = context.wrap_socket(sock, do_handshake_on_connect=False, server_hostname=self.host)
53+
_ = context.wrap_socket(sock, do_handshake_on_connect=True, server_hostname=self.host)
5454
if _:
5555
success = True
5656
self.sock = _
@@ -63,8 +63,8 @@ def create_sock():
6363
self._tunnel_host = None
6464
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
6565

66-
if kb.tlsSNI is None:
67-
kb.tlsSNI = success
66+
if kb.tlsSNI.get(self.host) is None:
67+
kb.tlsSNI[self.host] = success
6868

6969
if not success:
7070
for protocol in _protocols:

0 commit comments

Comments
 (0)