Skip to content

Commit

Permalink
Updated deprecated SSL configuration to remove warnings from tests wi…
Browse files Browse the repository at this point in the history
…th Python 3.10
  • Loading branch information
theseion committed Mar 10, 2022
1 parent b21f687 commit 6ffa312
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ftw/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
from . import util


# Fallback to PROTOCOL_SSLv23 if PROTOCOL_TLS is not available.
PROTOCOL_TLS = getattr(ssl, 'PROTOCOL_TLS', ssl.PROTOCOL_SSLv23)


class HttpResponse(object):
def __init__(self, http_response, user_agent):
self.response = util.ensure_binary(http_response)
Expand Down Expand Up @@ -299,8 +295,9 @@ def build_socket(self):
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# Check if TLS
if self.request_object.protocol == 'https':
context = ssl.SSLContext(PROTOCOL_TLS)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.set_ciphers(self.CIPHERS)
context.load_default_certs(ssl.Purpose.SERVER_AUTH)
self.sock = context.wrap_socket(
self.sock, server_hostname=self.request_object.dest_addr)
self.sock.connect(
Expand Down

0 comments on commit 6ffa312

Please sign in to comment.