@@ -60,12 +60,14 @@ class Server: # pylint: disable=too-many-instance-attributes
60
60
"""Root directory to serve files from. ``None`` if serving files is disabled."""
61
61
62
62
@staticmethod
63
- def _validate_https_cert_provided (certfile : str , keyfile : str ) -> None :
64
- if not certfile or not keyfile :
63
+ def _validate_https_cert_provided (
64
+ certfile : Union [str , None ], keyfile : Union [str , None ]
65
+ ) -> None :
66
+ if certfile is None or keyfile is None :
65
67
raise ValueError ("Both certfile and keyfile must be specified for HTTPS" )
66
68
67
69
@staticmethod
68
- def __create_circuitpython_ssl_context (certfile : str , keyfile : str ) -> SSLContext :
70
+ def _create_circuitpython_ssl_context (certfile : str , keyfile : str ) -> SSLContext :
69
71
ssl_context = create_default_context ()
70
72
71
73
ssl_context .load_verify_locations (cadata = "" )
@@ -74,7 +76,7 @@ def __create_circuitpython_ssl_context(certfile: str, keyfile: str) -> SSLContex
74
76
return ssl_context
75
77
76
78
@staticmethod
77
- def __create_cpython_ssl_context (certfile : str , keyfile : str ) -> SSLContext :
79
+ def _create_cpython_ssl_context (certfile : str , keyfile : str ) -> SSLContext :
78
80
ssl_context = create_default_context (purpose = Purpose .CLIENT_AUTH )
79
81
80
82
ssl_context .load_cert_chain (certfile , keyfile )
@@ -87,9 +89,9 @@ def __create_cpython_ssl_context(certfile: str, keyfile: str) -> SSLContext:
87
89
@classmethod
88
90
def _create_ssl_context (cls , certfile : str , keyfile : str ) -> SSLContext :
89
91
return (
90
- cls .__create_circuitpython_ssl_context (certfile , keyfile )
92
+ cls ._create_circuitpython_ssl_context (certfile , keyfile )
91
93
if implementation .name == "circuitpython"
92
- else cls .__create_cpython_ssl_context (certfile , keyfile )
94
+ else cls ._create_cpython_ssl_context (certfile , keyfile )
93
95
)
94
96
95
97
def __init__ (
0 commit comments