make sure internal ssl works with pycurl

and include it in tests!
This commit is contained in:
Min RK
2025-10-06 08:09:30 -07:00
parent a15656c1cf
commit a3e642150e
4 changed files with 24 additions and 19 deletions

View File

@@ -173,7 +173,7 @@ jobs:
# make sure our `>=` pins really do express our minimum supported versions # make sure our `>=` pins really do express our minimum supported versions
pip install -r ci/oldest-dependencies/requirements.old -e . pip install -r ci/oldest-dependencies/requirements.old -e .
else else
pip install --pre -e ".[test]" pip install --pre -e ".[test]" pycurl
fi fi
if [ "${{ matrix.main_dependencies }}" != "" ]; then if [ "${{ matrix.main_dependencies }}" != "" ]; then

View File

@@ -1984,14 +1984,15 @@ class JupyterHub(Application):
# Configure the AsyncHTTPClient. This will affect anything using # Configure the AsyncHTTPClient. This will affect anything using
# AsyncHTTPClient. # AsyncHTTPClient.
ssl_context = make_ssl_context( # can't use ssl_options in case of pycurl
self.internal_ssl_key,
self.internal_ssl_cert,
cafile=self.internal_ssl_ca,
)
AsyncHTTPClient.configure( AsyncHTTPClient.configure(
AsyncHTTPClient.configured_class(), AsyncHTTPClient.configured_class(),
defaults={"ssl_options": ssl_context}, defaults=dict(
ca_certs=self.internal_ssl_ca,
client_key=self.internal_ssl_key,
client_cert=self.internal_ssl_cert,
validate_cert=True,
),
) )
def init_db(self): def init_db(self):

View File

@@ -47,7 +47,6 @@ from jupyterhub.utils import (
_bool_env, _bool_env,
exponential_backoff, exponential_backoff,
isoformat, isoformat,
make_ssl_context,
url_path_join, url_path_join,
) )
@@ -325,13 +324,15 @@ class JupyterHubSingleUser(ExtensionApp):
@default('hub_http_client') @default('hub_http_client')
def _default_client(self): def _default_client(self):
ssl_context = make_ssl_context( # can't use ssl_options in case of pycurl
self.hub_auth.keyfile,
self.hub_auth.certfile,
cafile=self.hub_auth.client_ca,
)
AsyncHTTPClient.configure( AsyncHTTPClient.configure(
AsyncHTTPClient.configured_class(), defaults={"ssl_options": ssl_context} AsyncHTTPClient.configured_class(),
defaults=dict(
ca_certs=self.client_ca,
client_key=self.keyfile,
client_cert=self.certfile,
validate_cert=True,
),
) )
return AsyncHTTPClient() return AsyncHTTPClient()

View File

@@ -49,7 +49,6 @@ from ..utils import (
_bool_env, _bool_env,
exponential_backoff, exponential_backoff,
isoformat, isoformat,
make_ssl_context,
url_path_join, url_path_join,
) )
from ._decorator import allow_unauthenticated from ._decorator import allow_unauthenticated
@@ -403,11 +402,15 @@ class SingleUserNotebookAppMixin(Configurable):
@default('hub_http_client') @default('hub_http_client')
def _default_client(self): def _default_client(self):
ssl_context = make_ssl_context( # can't use ssl_options in case of pycurl
self.keyfile, self.certfile, cafile=self.client_ca
)
AsyncHTTPClient.configure( AsyncHTTPClient.configure(
AsyncHTTPClient.configured_class(), defaults={"ssl_options": ssl_context} AsyncHTTPClient.configured_class(),
defaults=dict(
ca_certs=self.client_ca,
client_key=self.keyfile,
client_cert=self.certfile,
validate_cert=True,
),
) )
return AsyncHTTPClient() return AsyncHTTPClient()