Repository navigation
Conversation
ed6f3a0 to
a784de5
Compare
|
Thank you for the review. I have addressed the issues raised:
|
7524091 to
508449a
Compare
|
rebased onto orgin's main |
|
@hajo-m ready for another round |
|
@Mukller - ready for another review. |
|
Thank you for your review, OKAN-SOFTWARE. I'll take a look this weekend. |
11878d0 to
a1582a2
Compare
|
@OKAN-SOFTWARE Good catch on Rebased onto
|
Ensure proxy bypass directives (`'no_proxy'` and `'no'` in the `proxies` mapping, as well as `no_proxy`/`NO_PROXY` environment settings when `trust_env` is enabled) are evaluated consistently even when explicit `proxies` are supplied: - Add `_extract_no_proxy` and `_should_bypass_proxies_with_trust_env` in `requests.utils` so explicit `'no_proxy'`/`'no'` keys take precedence (including `""` to disable bypass), while environment/OS bypass fallback only runs when `trust_env=True`. - Add `trust_env: bool = True` to `select_proxy` (matching `resolve_proxies`) and pass `trust_env=False` from `HTTPAdapter`, where `Session` has already evaluated `trust_env`. - Update `Session.send` to clear `proxies` on a shallow copy of `kwargs` passed to `adapter.send` when bypassed, preserving explicit `proxies` for response hooks and subsequent redirects. - Document `'no'` and `'no_proxy'` keys on `requests.request` and `Session.request`, and add unit and end-to-end tests in `tests/test_utils.py` and `tests/test_requests.py`. Closes psf#5000
a1582a2 to
1667efd
Compare
|
Rechecked The latest fork CI still fails on Windows in both parameterizations of The test uses Using Could you update that setup and rerun the Windows matrix? I haven’t independently run Windows locally. |
Closes #5000
Problem
When an explicit
proxiesmapping is passed to a request or configured onSession.proxies,merge_environment_settingsandresolve_proxiesonly useno_proxyto decide whether to merge missing schemes fromos.environ, leaving explicit entries inproxiesuntouched. Consequently:'no_proxy'or'no'keys inproxies(including mappings returned directly byurllib.request.getproxies()) did not bypass explicit proxies.no_proxy/NO_PROXYenvironment variables were ignored whenever an explicit proxy was configured for that scheme.Approach
'no_proxy'and'no'by key presence (_extract_no_proxy) rather than truthiness. Non-empty rules always apply; an explicit empty string ('no_proxy': ''or'no': '') disables bypass so callers can force an explicit proxy without disablingtrust_envfor.netrcor CA bundles.trust_envisolation: Fall back to environment/OS bypass rules only whentrust_env=True(_should_bypass_proxies_with_trust_env).select_proxyacceptstrust_env: bool = Trueto matchresolve_proxies, whileHTTPAdapterpassestrust_env=FalsesinceSessionevaluatesself.trust_envupstream.Session.send, clearproxieson a shallow copy ofkwargspassed toadapter.sendso explicitproxiessurvive for response hooks and subsequent redirects to non-bypassed hosts.