Repository navigation
Configure the default Linux SSL context once instead of per handshake - #1253
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 478e923fe9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
…ting a private helper
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Closes #1252.
On Linux,
truststore.SSLContextcallsset_default_verify_paths()on its shared inner context before every handshake. OpenSSL < 3.4 appends a duplicate CApath lookup on each call, so issuer lookups grow quadratically and CPU climbs over the lifetime of a reused client (sethmlarson/truststore#212).On Linux, the default context is now a stdlib
ssl.SSLContextconfigured once, with the same logictruststoreuses there (its Linux backend delegates verification to OpenSSL anyway). Windows and macOS still usetruststore.httpx2.create_ssl_context()now useshttpcore2.default_ssl_context()instead of duplicating it, passingtrust_envthrough a private_trust_envkeyword. Withtrust_env=False,SSL_CERT_FILE/SSL_CERT_DIRare ignored. The private keyword goes away together with the Linux branch.Measured on Debian bookworm (OpenSSL 3.0.22), against a server with an intermediate chain:
/usr/lib/ssl/certsopens for 5 / 20 / 50 requestsVerification is still enforced: an untrusted chain fails with
CERTIFICATE_VERIFY_FAILED, and system CAs still validate public hosts.This can be reverted once sethmlarson/truststore#213 is released.
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.