Skip to content

Commit

Permalink
minor #30978 [HttpClient] Allow the HTTP_PROXY environment variable l…
Browse files Browse the repository at this point in the history
…ookup 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
-------

fbd439e [HttpClient] Allow the HTTP_PROXY environment variable lookup with phpdbg
  • Loading branch information
nicolas-grekas committed Apr 8, 2019
2 parents d56ebef + fbd439e commit fa308e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpClient/NativeHttpClient.php
Expand Up @@ -258,7 +258,7 @@ private static function getProxy(?string $proxy, array $url): ?array
{
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;
Expand Down

0 comments on commit fa308e2

Please sign in to comment.