Sanjays2402 opened a new pull request, #2171:
URL: https://github.com/apache/libcloud/pull/2171
## 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)
- [x] [Code
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
(required, can be done after the PR checks)
- [ ] Documentation
- [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
- [ ]
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
(required for bigger changes)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]