minor #30978 [HttpClient] Allow the HTTP_PROXY environment variable lookup with phpdbg (theofidry)

This PR was squashed before being merged into the 4.3-dev branch (closes #30978).

Discussion
----------

[HttpClient] Allow the HTTP_PROXY environment variable lookup with phpdbg

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

`phpdbg` and `embed` are two other legit PHP SAPI's hence should be allowed.

Commits
-------

fbd439e0bd [HttpClient] Allow the HTTP_PROXY environment variable lookup with phpdbg
This commit is contained in:
Nicolas Grekas 2019-04-08 17:24:46 +02:00
commit fa308e21eb

View File

@ -258,7 +258,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
{
if (null === $proxy) {
// Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities
$proxy = $_SERVER['http_proxy'] ?? ('cli' === \PHP_SAPI ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null;
$proxy = $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null;
if ('https:' === $url['scheme']) {
$proxy = $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? $proxy;