From 3b581f84e7b6e4a883bf730761346e0618648aeb Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Fri, 1 Nov 2024 21:19:05 -0400 Subject: [PATCH] Fixed HTTPS:// not working with newer Python (ssl.wrap_socket removed). --- owrx/__main__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/owrx/__main__.py b/owrx/__main__.py index 06043041..bd4fc5a5 100644 --- a/owrx/__main__.py +++ b/owrx/__main__.py @@ -28,9 +28,8 @@ from pathlib import Path import signal import argparse import socket -import ssl import os.path - +import ssl class ThreadedHttpServer(ThreadingMixIn, HTTPServer): def __init__(self, web_port, RequestHandlerClass, use_ipv6, bind_address=None): @@ -162,8 +161,9 @@ Support and info: https://groups.io/g/openwebrx certFile = "/etc/openwebrx/cert.pem" # If SSL certificate found, use HTTPS instead of HTTP if os.path.isfile(keyFile) and os.path.isfile(certFile): - server.socket = ssl.wrap_socket( - server.socket, keyFile, certFile, server_side=True) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + ctx.load_cert_chain(certFile, keyFile) + server.socket = ctx.wrap_socket(server.socket, server_side=True) logger.info("Found SSL certificate, using https:// protocol.") else: logger.info("No SSL certificate, using http:// protocol.")