Skip to content

Commit 9a07cb1

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Make FormErrorIterator generic [symfony/mailjet-mailer] Fix invalid mailjet error managment typehint of DkimOptions algorithm wrong Remove extra space in NotificationEmail Fix the usage of the Valid constraints in array-based forms Fix return value of `NullToken::getUser()` [DI] fix `ServiceSubscriberTrait` bug where parent has `__call()` [HttpClient] Fix reading proxy settings from dotenv when curl is used [Process] Don't return executable directories in PhpExecutableFinder Center icons vertically in trace list
2 parents a8f8732 + 7dd6293 commit 9a07cb1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

CurlHttpClient.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ public function request(string $method, string $url, array $options = []): Respo
9090
$scheme = $url['scheme'];
9191
$authority = $url['authority'];
9292
$host = parse_url($authority, \PHP_URL_HOST);
93+
$proxy = $options['proxy']
94+
?? ('https:' === $url['scheme'] ? $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? null : null)
95+
// Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
96+
?? $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null;
9397
$url = implode('', $url);
9498

9599
if (!isset($options['normalized_headers']['user-agent'])) {
@@ -105,7 +109,7 @@ public function request(string $method, string $url, array $options = []): Respo
105109
\CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
106110
\CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
107111
\CURLOPT_TIMEOUT => 0,
108-
\CURLOPT_PROXY => $options['proxy'],
112+
\CURLOPT_PROXY => $proxy,
109113
\CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
110114
\CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],
111115
\CURLOPT_SSL_VERIFYHOST => $options['verify_host'] ? 2 : 0,
@@ -402,8 +406,15 @@ private static function createRedirectResolver(array $options, string $host): \C
402406
}
403407

404408
$url = self::parseUrl(curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL));
409+
$url = self::resolveUrl($location, $url);
405410

406-
return implode('', self::resolveUrl($location, $url));
411+
curl_setopt($ch, \CURLOPT_PROXY, $options['proxy']
412+
?? ('https:' === $url['scheme'] ? $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? null : null)
413+
// Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
414+
?? $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null
415+
);
416+
417+
return implode('', $url);
407418
};
408419
}
409420

0 commit comments

Comments
 (0)