Provide httpx default context for OS-provided certs (#11505)

Co-authored-by: Pierrick Hymbert <pierrick.hymbert@gmail.com>
This commit is contained in:
Ray Myers
2025-10-27 17:54:20 -05:00
committed by GitHub
parent 818f743dc7
commit 4decd8b3e9
20 changed files with 93 additions and 37 deletions

View File

@@ -42,6 +42,7 @@ from openhands.storage.data_models.settings import Settings
from openhands.storage.files import FileStore
from openhands.storage.locations import get_conversation_dir
from openhands.utils.async_utils import call_sync_from_async
from openhands.utils.http_session import httpx_verify_option
from openhands.utils.import_utils import get_impl
from openhands.utils.utils import create_registry_and_conversation_stats
@@ -200,9 +201,10 @@ class DockerNestedConversationManager(ConversationManager):
await call_sync_from_async(runtime.wait_until_alive)
await call_sync_from_async(runtime.setup_initial_env)
async with httpx.AsyncClient(
verify=httpx_verify_option(),
headers={
'X-Session-API-Key': self._get_session_api_key_for_conversation(sid)
}
},
) as client:
# setup the settings...
settings_json = settings.model_dump(context={'expose_secrets': True})
@@ -296,9 +298,10 @@ class DockerNestedConversationManager(ConversationManager):
async def send_event_to_conversation(self, sid, data):
async with httpx.AsyncClient(
verify=httpx_verify_option(),
headers={
'X-Session-API-Key': self._get_session_api_key_for_conversation(sid)
}
},
) as client:
nested_url = self._get_nested_url(sid)
response = await client.post(
@@ -319,9 +322,10 @@ class DockerNestedConversationManager(ConversationManager):
try:
nested_url = self.get_nested_url_for_container(container)
async with httpx.AsyncClient(
verify=httpx_verify_option(),
headers={
'X-Session-API-Key': self._get_session_api_key_for_conversation(sid)
}
},
) as client:
# Stop conversation
response = await client.post(
@@ -357,11 +361,12 @@ class DockerNestedConversationManager(ConversationManager):
"""
try:
async with httpx.AsyncClient(
verify=httpx_verify_option(),
headers={
'X-Session-API-Key': self._get_session_api_key_for_conversation(
conversation_id
)
}
},
) as client:
# Query the nested runtime for conversation info
response = await client.get(nested_url)