Skip to content

Commit bc9c844

Browse files
committed
Fix: Setting Server._ssl_context to None if not using HTTPS
1 parent 1b9371a commit bc9c844

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_httpserver/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def __init__(
106106
if https:
107107
self._validate_https_cert_provided(certfile, keyfile)
108108
self._ssl_context = self._create_ssl_context(certfile, keyfile)
109+
else:
110+
self._ssl_context = None
109111

110112
if root_path in ["", "/"] and debug:
111113
_debug_warning_exposed_files(root_path)
@@ -233,7 +235,7 @@ def serve_forever(
233235
@staticmethod
234236
def _create_server_socket(
235237
socket_source: _ISocketPool,
236-
ssl_context: SSLContext,
238+
ssl_context: "SSLContext | None",
237239
host: str,
238240
port: int,
239241
) -> _ISocket:

0 commit comments

Comments
 (0)