-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow simple-phpunit to be used with an HTTP proxy #20862
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a https_proxy environment variable also or not?
@@ -29,6 +29,16 @@ $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rt | ||
? $PHP.' '.escapeshellarg($COMPOSER) | ||
: 'composer'; | ||
|
||
$options = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array()
'http' => [], | ||
]; | ||
|
||
if (($proxy = getenv('http_proxy')) !== FALSE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yoda style, false always lowercase, no need for the brackets
|
composer has a bunch of code to properly deal with proxies, see: Since we don't want to put that much logic here, I propose to simply use This could then go as bug fix on 3.2 IMHO. |
In the Symfony Installer we also used a simplified proxy detection based on the Composer one. It seems to be working OK: https://github.com/symfony/symfony-installer/blob/master/src/Symfony/Installer/DownloadCommand.php#L243 |
@javiereguiluz it looks like this builds on a Guzzle feature? Which would mean not applicable here? |
@nicolas-grekas yes, I was only referring to these lines: if (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy'])) {
$defaults['proxy'] = !empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY'];
} |
👍 |
Thank you @Cydonia7. |
This PR was merged into the 3.2 branch. Discussion ---------- Allow simple-phpunit to be used with an HTTP proxy | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | no The title pretty much sums it up. I had to use the script behind a proxy and it did not work well so here is a little fix to take the `http_proxy` environment variable into account when downloading with fopen. I don't think there needs to be a doc PR associated since this feature should be transparent for the end-user. Commits ------- 921b646 Allow simple-phpunit to be used with an HTTP proxy
The title pretty much sums it up. I had to use the script behind a proxy and it did not work well so here is a little fix to take the
http_proxy
environment variable into account when downloading with fopen.I don't think there needs to be a doc PR associated since this feature should be transparent for the end-user.