diff --git a/src/File.php b/src/File.php index 4796296b6..d84f79a53 100644 --- a/src/File.php +++ b/src/File.php @@ -158,8 +158,10 @@ public function __construct(string $url, int $timeout = 10, int $redirects = 5, $this->success = false; return; } - $proxy = preg_replace('#^.*://#i', '', $proxy); // Strip any scheme already present in CURLOPT_PROXY - $proxy_url = "$proxy_scheme://$proxy"; // CURLOPT_PROXY ($proxy) is formatted as user:pass@hostname:port, with the part before @ being optional + // CURLOPT_PROXY ($proxy) is expected to already be scheme-less: the scheme comes from + // CURLOPT_PROXYTYPE, and the caller (e.g. FreshRSS_http_Util::sanitizeCurlParams()) rejects + // any scheme-containing value before it's ever stored or used. + $proxy_url = "$proxy_scheme://$proxy"; // formatted as user:pass@hostname:port, with the part before @ being optional $resolve = $this->get_curl_resolve_info($proxy_url); if ($resolve === null) { $this->error = 'Failed to fetch this URL, because the proxy’s IP is not in the allowlist [' .