Skip to content

Commit

Permalink
Revert "Fix deprecation warning"
Browse files Browse the repository at this point in the history
This reverts commit 8704739.
  • Loading branch information
eandersson committed Oct 13, 2024
1 parent 50abda8 commit 291336d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions amqpstorm/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,14 @@ def _ssl_wrap_socket(self, sock):
server_hostname=hostname
)
hostname = self._parameters['hostname']
if hasattr(ssl, 'PROTOCOL_TLS_CLIENT'):
protocol = ssl.PROTOCOL_TLS_CLIENT
else:
protocol = ssl.PROTOCOL_TLS
context = ssl.SSLContext(protocol)
context.check_hostname = self._parameters['ssl_options'].get(
'check_hostname', False
)
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
mode = self._parameters['ssl_options'].get('verify_mode', 'none')
if mode.lower() == 'required':
context.verify_mode = ssl.CERT_REQUIRED
else:
context.verify_mode = ssl.CERT_NONE
check = self._parameters['ssl_options'].get('check_hostname', False)
context.check_hostname = check
context.load_default_certs()
return context.wrap_socket(sock, do_handshake_on_connect=True,
server_hostname=hostname)
Expand Down

0 comments on commit 291336d

Please sign in to comment.