Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelfUpdateCommand.php does not use proxy settings in the stream context #10

Closed
wesleymusgrove opened this issue Apr 19, 2021 · 2 comments · Fixed by #33
Closed

SelfUpdateCommand.php does not use proxy settings in the stream context #10

wesleymusgrove opened this issue Apr 19, 2021 · 2 comments · Fixed by #33

Comments

@wesleymusgrove
Copy link

I'm behind a proxy and the self-update command breaks because it does not take my proxy environment variables into consideration when checking github for the latest release in this file:

Specifically I'm getting this error when trying to self-update Acquia CLI:

PHP Warning:  file_get_contents(https://api.github.com/repos/acquia/cli/releases): failed to open stream: Connection refused
in phar:///usr/local/bin/acli/vendor/consolidation/self-update/src/SelfUpdateCommand.php on line 70

Warning: file_get_contents(https://api.github.com/repos/acquia/cli/releases): failed to open stream: Connection refused in phar:///usr/local/bin/acli/vendor/consolidation/self-update/src/SelfUpdateCommand.php on line 70

In SelfUpdateCommand.php line 74:

  API error - no release found at GitHub repository acquia/cli

self:update [--stable] [--preview]

I think something needs to be added to check for proxy settings and apply them to the stream context, if necessary, but I'm not quite sure how to access proxy settings in this script:

$opts = [
            'http' => [
                'method' => 'GET',
                'proxy' => $proxy_environment_variable,
                'header' => [
                    'User-Agent: ' . $this->applicationName  . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)'
                ]
            ]
        ];
@danepowell
Copy link
Collaborator

Seems like Symfony handles proxy variables natively: https://symfony.com/doc/current/http_client.html#http-proxies

Maybe this package should be using the Symfony Http Client instead of handling its own stream context. Otherwise it would need to copy whatever Symfony is doing under the hood.

@danepowell
Copy link
Collaborator

@codegain @wesleymusgrove I know I'm a little late to the party, but if this still impacts you could you please test #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants