feat(core): add SOCKS5 proxy support for package management and remote providers#16900
feat(core): add SOCKS5 proxy support for package management and remote providers#16900Ibochkarev wants to merge 3 commits intomodxcms:3.xfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 3.x #16900 +/- ##
============================================
- Coverage 21.64% 21.62% -0.03%
- Complexity 10764 10787 +23
============================================
Files 566 566
Lines 33005 33158 +153
============================================
+ Hits 7144 7170 +26
- Misses 25861 25988 +127 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…e providers - Add proxy_type system setting (HTTP, SOCKS4, SOCKS5, SOCKS5_HOSTNAME) - Add modX::getProxyType() and getProxyUrl() with credential encoding - Use getProxyUrl() in Guzzle options, modTransportPackage, and Dashboard Feed - Add upgrade script 3.2.1-add-proxy-type-setting.php and mysql/3.2.1-pl.php - Replace deprecated curl_close() with unset() in modTransportPackage - Fix phpcs: space after function keyword, line length in upgrade script Resolves modxcms#16815
d323f5e to
e052ed1
Compare
Code ReviewSummaryAdds SOCKS5/SOCKS4 proxy support for Package Manager, remote providers, and dashboard feed. Introduces Issues
Suggestions
AssessmentGood refactoring — proxy logic is centralized, tests are solid. The double-encoding issue for HTTP proxy credentials is a real bug that will affect users with special characters in passwords. PHPStan clean. VerdictRequest changes — double |
…configuration - Update modX::getProxyType() to map 'SOCKS5H' to 'SOCKS5_HOSTNAME'. - Adjust proxy configuration in modTransportPackage and Dashboard Feed to only set CURLOPT_HTTPPROXYTUNNEL for HTTP proxy types. - Modify unit tests to reflect the change in expected proxy type behavior.
What does it do?
proxy_type(HTTP, SOCKS4, SOCKS5, SOCKS5_HOSTNAME) so package manager, remote providers, and dashboard feed can use SOCKS proxies.modX::getProxyType()andmodX::getProxyUrl(); proxy URL is built withrawurlencode()for username/password to support special characters.buildHttpClientOptions),modTransportPackage::transferPackage()(cURL), and Dashboard Feed widget (SimplePie cURL options).CURLOPT_PROXYAUTHandCURLOPT_PROXYUSERPWDare set only whenproxy_typeis HTTP (SOCKS auth is via URL).3.2.2-add-proxy-type-setting.php(andmysql/3.2.2-pl.php) so existing installations get the new setting.curl_close($ch)withunset($ch)inmodTransportPackage(PHP 8.4+)._build/data/transport.core.system_settings.phpfor fresh installs; English lexicon entries forproxy_typeincore/lexicon/en/setting.inc.php.Why is it needed?
Package downloads and dashboard feeds could not use SOCKS5 (or SOCKS4) proxies; only HTTP proxy was effectively supported. This change allows users behind SOCKS proxies to use package management and remote providers.
How to test
proxy_host,proxy_port, optionallyproxy_username/proxy_password, andproxy_typetoSOCKS5(orHTTP,SOCKS4,SOCKS5_HOSTNAME).proxy_typesetting appears with defaultHTTP.Related issue(s)/PR(s)
Resolves #16815