Skip to content

Commit

Permalink
Merge pull request ZeroNetX#170 from zeronet-conservancy/fix_ssl_version
Browse files Browse the repository at this point in the history
fix default ssl version to be secure
  • Loading branch information
caryoscelus authored Sep 20, 2022
2 parents ed8c7a8 + 8132457 commit 04fc791
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ def httpRequest(url, as_file=False):

conn = http.client.HTTPSConnection(host)
sock = socket.create_connection((conn.host, conn.port), conn.timeout, conn.source_address)
conn.sock = ssl.wrap_socket(sock, conn.key_file, conn.cert_file)

context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2

conn.sock = context.wrap_socket(sock, conn.key_file, conn.cert_file)
conn.request("GET", request)
response = conn.getresponse()
if response.status in [301, 302, 303, 307, 308]:
Expand Down

0 comments on commit 04fc791

Please sign in to comment.