Skip to content

Inject SSL context into urllib3 ProxyManager, too #13343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ichard26
Copy link
Member

@ichard26 ichard26 commented Apr 21, 2025

When a proxy is involved, requests uses a urllib3 proxy manager instead of the pool manager. We only inject our SSL context into the pool manager, which means the truststore context is lost when a proxy is set.

We can modify proxy manager construction by overriding proxy_manager_for on the requests adapters as described here: psf/requests#6109 (comment)

I have no idea how to write a test for this (at least for the time being), so @schribl I'd appreciate if you could check whether this fixes your issue or not. You can install this branch via pip install https://github.com/ichard26/pip/archive/bug/lost-ssl-context.zip. No rush!

Should fix #13288.

When a proxy is involved, requests uses a urllib3 proxy manager instead of
the pool manager. We only inject our SSL context into the pool manager,
which means the truststore context is lost when a proxy is set.

We can modify proxy manager construction by overriding proxy_manager_for
on the requests adapters.
@ichard26 ichard26 added this to the 25.2 milestone Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip with truststore and proxy can use incorrect ssl_context
2 participants