Skip to content
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

Fix SNI handling with proxies in requests library #326

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

Conversation

cosineai[bot]
Copy link

@cosineai cosineai bot commented Mar 5, 2025

This pull request addresses issue psf#6900, which involves the inability to request a private URL endpoint with custom SNI and self-signed CA when a proxy is set. The changes made ensure that the server_hostname is correctly set based on the Host header in the request, even when using a proxy.

Changes Made:

  • Modified the get_connection_with_tls_context method in adapters.py to extract the Host header and use it for SNI.
  • Added unit tests in test_adapters.py to verify that the server_hostname is correctly passed in various scenarios, including when a proxy is used.

Expected Outcome:

With these changes, users should be able to successfully make requests to private URL endpoints with custom SNI and self-signed CA, regardless of whether a proxy is used.


This pull request was co-created with Cosine Genie

Original Task: swe-requests/m99px2ucjsk6
Author: Pandelis Zembashis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant