Skip to content

Commit b200495

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: 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 3392a3f + 9a07cb1 commit b200495

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
@@ -91,6 +91,10 @@ public function request(string $method, string $url, array $options = []): Respo
9191
$authority = $url['authority'];
9292
$host = parse_url($authority, \PHP_URL_HOST);
9393
$port = parse_url($authority, \PHP_URL_PORT) ?: ('http:' === $scheme ? 80 : 443);
94+
$proxy = $options['proxy']
95+
?? ('https:' === $url['scheme'] ? $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? null : null)
96+
// Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
97+
?? $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null;
9498
$url = implode('', $url);
9599

96100
if (!isset($options['normalized_headers']['user-agent'])) {
@@ -106,7 +110,7 @@ public function request(string $method, string $url, array $options = []): Respo
106110
\CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
107111
\CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
108112
\CURLOPT_TIMEOUT => 0,
109-
\CURLOPT_PROXY => $options['proxy'],
113+
\CURLOPT_PROXY => $proxy,
110114
\CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
111115
\CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],
112116
\CURLOPT_SSL_VERIFYHOST => $options['verify_host'] ? 2 : 0,
@@ -404,8 +408,15 @@ private static function createRedirectResolver(array $options, string $host, int
404408
}
405409

406410
$url = self::parseUrl(curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL));
411+
$url = self::resolveUrl($location, $url);
407412

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

0 commit comments

Comments
 (0)