feat(proxy): Support no_proxy configuration#6550
feat(proxy): Support no_proxy configuration#6550philippe-granet wants to merge 6 commits intoScoopInstaller:developfrom
Conversation
Add support for NO_PROXY environment variable in git operations.
Add support for no_proxy configuration in setup_proxy function.
WalkthroughAdds NO_PROXY support: read from config, propagate into Git background jobs (set $env:NO_PROXY inside jobs), and configure the system web proxy bypass list from NO_PROXY in setup_proxy. Changes
Sequence Diagram(s)sequenceDiagram
participant Config as Config
participant Core as core.ps1 (Invoke-Git)
participant Job as Background Job (Git worker)
participant Download as download.ps1 (setup_proxy)
participant Proxy as System Proxy
Config->>Core: get_config NO_PROXY
Core->>Job: Start-Job (pass using:no_proxy)
Job->>Job: if no_proxy set -> $env:NO_PROXY = no_proxy
Config->>Download: get_config NO_PROXY
Download->>Download: if no_proxy -> split by ","
Download->>Proxy: [net.webrequest]::defaultwebproxy.BypassList = list
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
lib/download.ps1 (1)
576-579: Improve string handling for NO_PROXY bypass list.The current implementation could produce unexpected results if the NO_PROXY configuration contains leading/trailing whitespace or empty values. Consider trimming the entire string and filtering out empty entries.
Apply this diff to improve robustness:
if ($no_proxy) { - $bypass_list = $no_proxy -split "\s*,\s*" + $bypass_list = $no_proxy.Trim() -split "\s*,\s*" | Where-Object { $_ -ne '' } [net.webrequest]::defaultwebproxy.BypassList = $bypass_list }This ensures:
- Leading/trailing whitespace from the entire string is removed
- Empty elements from consecutive commas or malformed input are filtered out
- The BypassList receives only valid, non-empty entries
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/core.ps1(2 hunks)lib/download.ps1(2 hunks)
🔇 Additional comments (2)
lib/download.ps1 (1)
554-554: Good: NO_PROXY configuration retrieval.The retrieval of the NO_PROXY configuration is correctly placed and follows the same pattern as the PROXY configuration.
lib/core.ps1 (1)
235-235: NO_PROXY implementation is correct and properly propagated.Verification confirms the implementation follows best practices:
- Line 235 correctly retrieves NO_PROXY from configuration using the standard
get_configpattern- Line 250 properly passes NO_PROXY to the background job via
$using:scope- Line 256-258 conditionally sets
$env:NO_PROXYonly when the value is non-empty—more robust than the unconditional HTTP_PROXY/HTTPS_PROXY handling- NO_PROXY is applied only within background jobs for network-dependent Git operations (clone, checkout, pull, fetch, ls-remote)
The implementation is complete and correct. No changes required.
Trimmed whitespace from no_proxy variable before splitting, as reported by @coderabbitai
|
please update the help manual in |
Description
Enhance setup_proxy Invoke-Git functions to handle no_proxy settings
Motivation and Context
Closes #6549 and #1820
How Has This Been Tested?
In our network, where we need to use proxy to access to Internet, and have internal buckets that can't be reached with the proxy, and this configuration in Scoop
config.json:{ "proxy": "<proxy-server>:<proxy-port>", "no_proxy": "localhost, 127.0.0.1, .private.domain.com" }Checklist:
developbranch.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.