Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Respect no_proxy environment variable - #2171

#2171
Open
Sanjays2402 wants to merge 1 commit into
apache:trunkapache/libcloud:trunkfrom
Sanjays2402:fix/2077-respect-no-proxySanjays2402/libcloud:fix/2077-respect-no-proxyCopy head branch name to clipboard
Open

Respect no_proxy environment variable#2171
Sanjays2402 wants to merge 1 commit into
apache:trunkapache/libcloud:trunkfrom
Sanjays2402:fix/2077-respect-no-proxySanjays2402/libcloud:fix/2077-respect-no-proxyCopy head branch name to clipboard

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Respect no_proxy environment variable

Description

Fixes #2077.

When a proxy is configured explicitly (via set_http_proxy() or the http_proxy /
https_proxy environment variables), libcloud used it for every request, including
hosts listed in no_proxy / NO_PROXY. Other HTTP clients (curl, requests via its
own env handling, urllib) all honour no_proxy, so this was surprising and made it
impossible to talk to an internal endpoint directly while a proxy was configured.

This adds a _proxies_for_url(url) helper on LibcloudBaseConnection that returns
an empty proxy mapping ({}) when the target host matches no_proxy, and None
otherwise so the session default applies. It is passed as proxies= in
LibcloudConnection.request(). Matching is delegated to requests.utils.should_bypass_proxies,
so libcloud inherits the exact same no_proxy semantics as requests rather than
reimplementing them.

Status

done, ready for review

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks)
  • Documentation
  • Tests
  • ICLA (required for bigger changes)

An explicitly configured proxy was used for every request, even when the
target host matched the no_proxy / NO_PROXY environment variable. Add a
_proxies_for_url helper that returns an empty proxy mapping for bypassed
hosts so libcloud behaves consistently with other HTTP clients.
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.

Respect no_proxy environment variable

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.