"true/punycode": "~2.0",
"pear/net_idna2": "^0.2.0",
"scssphp/scssphp": "^1.4",
- "guzzlehttp/guzzle": "^7.2",
+ "guzzlehttp/guzzle": "dev-proxy-stream",
"paragonie/constant_time_encoding": "^2.3"
- }
+ },
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/WoltLab/guzzle",
+ "no-api": true
+ }
+ ]
}
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "fa896feedcccd74b405ca2cb1b75e111",
+ "content-hash": "3c40e2cf3f3ed16494ac22cad6e34858",
"packages": [
{
"name": "chrisjean/php-ico",
},
{
"name": "guzzlehttp/guzzle",
- "version": "7.2.0",
+ "version": "dev-proxy-stream",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79"
+ "url": "https://github.com/WoltLab/guzzle",
+ "reference": "4b5ae5a75ebad957902452f5bab984781bcd75a3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79",
- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79",
+ "url": "https://api.github.com/repos/WoltLab/guzzle/zipball/4b5ae5a75ebad957902452f5bab984781bcd75a3",
+ "reference": "4b5ae5a75ebad957902452f5bab984781bcd75a3",
"shasum": ""
},
"require": {
"src/functions_include.php"
]
},
- "notification-url": "https://packagist.org/downloads/",
+ "autoload-dev": {
+ "psr-4": {
+ "GuzzleHttp\\Tests\\": "tests/"
+ }
+ },
"license": [
"MIT"
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
+ "HTTP client",
+ "PSR-18",
+ "PSR-7",
"client",
"curl",
"framework",
"http",
- "http client",
- "psr-18",
- "psr-7",
"rest",
"web service"
],
- "support": {
- "issues": "https://github.com/guzzle/guzzle/issues",
- "source": "https://github.com/guzzle/guzzle/tree/7.2.0"
- },
- "funding": [
- {
- "url": "https://github.com/GrahamCampbell",
- "type": "github"
- },
- {
- "url": "https://github.com/Nyholm",
- "type": "github"
- },
- {
- "url": "https://github.com/alexeyshockov",
- "type": "github"
- },
- {
- "url": "https://github.com/gmponos",
- "type": "github"
- }
- ],
- "time": "2020-10-10T11:47:56+00:00"
+ "time": "2021-02-01T10:18:22+00:00"
},
{
"name": "guzzlehttp/promises",
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": [],
+ "stability-flags": {
+ "guzzlehttp/guzzle": 20
+ },
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
*/
class ClassLoader
{
+ private $vendorDir;
+
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $missingClasses = array();
private $apcuPrefix;
+ private static $registeredLoaders = array();
+
+ public function __construct($vendorDir = null)
+ {
+ $this->vendorDir = $vendorDir;
+ }
+
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+
+ if (null === $this->vendorDir) {
+ return;
+ }
+
+ if ($prepend) {
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
+ } else {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ self::$registeredLoaders[$this->vendorDir] = $this;
+ }
}
/**
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
+
+ if (null !== $this->vendorDir) {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ }
}
/**
return $file;
}
+ /**
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
+ *
+ * @return self[]
+ */
+ public static function getRegisteredLoaders()
+ {
+ return self::$registeredLoaders;
+ }
+
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
<?php
+
+
+
+
+
+
+
+
+
+
namespace Composer;
+use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
),
'guzzlehttp/guzzle' =>
array (
- 'pretty_version' => '7.2.0',
- 'version' => '7.2.0.0',
+ 'pretty_version' => 'dev-proxy-stream',
+ 'version' => 'dev-proxy-stream',
'aliases' =>
array (
),
- 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79',
+ 'reference' => '4b5ae5a75ebad957902452f5bab984781bcd75a3',
),
'guzzlehttp/promises' =>
array (
),
),
);
+private static $canGetVendors;
+private static $installedByVendor = array();
public static function getInstalledPackages()
{
-return array_keys(self::$installed['versions']);
+$packages = array();
+foreach (self::getInstalled() as $installed) {
+$packages[] = array_keys($installed['versions']);
+}
+
+
+if (1 === \count($packages)) {
+return $packages[0];
+}
+
+return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
public static function isInstalled($packageName)
{
-return isset(self::$installed['versions'][$packageName]);
+foreach (self::getInstalled() as $installed) {
+if (isset($installed['versions'][$packageName])) {
+return true;
+}
+}
+
+return false;
}
public static function getVersionRanges($packageName)
{
-if (!isset(self::$installed['versions'][$packageName])) {
-throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
}
$ranges = array();
-if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
-$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
+if (isset($installed['versions'][$packageName]['pretty_version'])) {
+$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
-if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
-$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
+if (array_key_exists('aliases', $installed['versions'][$packageName])) {
+$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
-if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
-$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
+if (array_key_exists('replaced', $installed['versions'][$packageName])) {
+$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
-if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
-$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
+if (array_key_exists('provided', $installed['versions'][$packageName])) {
+$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+}
+
public static function getVersion($packageName)
{
-if (!isset(self::$installed['versions'][$packageName])) {
-throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
}
-if (!isset(self::$installed['versions'][$packageName]['version'])) {
+if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
-return self::$installed['versions'][$packageName]['version'];
+return $installed['versions'][$packageName]['version'];
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getPrettyVersion($packageName)
{
-if (!isset(self::$installed['versions'][$packageName])) {
-throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
}
-if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
+if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
-return self::$installed['versions'][$packageName]['pretty_version'];
+return $installed['versions'][$packageName]['pretty_version'];
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getReference($packageName)
{
-if (!isset(self::$installed['versions'][$packageName])) {
-throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
+foreach (self::getInstalled() as $installed) {
+if (!isset($installed['versions'][$packageName])) {
+continue;
}
-if (!isset(self::$installed['versions'][$packageName]['reference'])) {
+if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
-return self::$installed['versions'][$packageName]['reference'];
+return $installed['versions'][$packageName]['reference'];
+}
+
+throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getRootPackage()
{
-return self::$installed['root'];
+$installed = self::getInstalled();
+
+return $installed[0]['root'];
}
public static function reload($data)
{
self::$installed = $data;
+self::$installedByVendor = array();
+}
+
+
+
+
+private static function getInstalled()
+{
+if (null === self::$canGetVendors) {
+self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
+}
+
+$installed = array();
+
+if (self::$canGetVendors) {
+foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+if (isset(self::$installedByVendor[$vendorDir])) {
+$installed[] = self::$installedByVendor[$vendorDir];
+} elseif (is_file($vendorDir.'/composer/installed.php')) {
+$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
+}
+}
+}
+
+$installed[] = self::$installed;
+
+return $installed;
}
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInita1f5f7c74275d47a45049a2936db1d0d', 'loadClassLoader'), true, false);
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInita1f5f7c74275d47a45049a2936db1d0d', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
},
{
"name": "guzzlehttp/guzzle",
- "version": "7.2.0",
- "version_normalized": "7.2.0.0",
+ "version": "dev-proxy-stream",
+ "version_normalized": "dev-proxy-stream",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79"
+ "url": "https://github.com/WoltLab/guzzle",
+ "reference": "4b5ae5a75ebad957902452f5bab984781bcd75a3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79",
- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79",
+ "url": "https://api.github.com/repos/WoltLab/guzzle/zipball/4b5ae5a75ebad957902452f5bab984781bcd75a3",
+ "reference": "4b5ae5a75ebad957902452f5bab984781bcd75a3",
"shasum": ""
},
"require": {
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
- "time": "2020-10-10T11:47:56+00:00",
+ "time": "2021-02-01T10:18:22+00:00",
"type": "library",
"extra": {
"branch-alias": {
"src/functions_include.php"
]
},
- "notification-url": "https://packagist.org/downloads/",
+ "autoload-dev": {
+ "psr-4": {
+ "GuzzleHttp\\Tests\\": "tests/"
+ }
+ },
"license": [
"MIT"
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
+ "HTTP client",
+ "PSR-18",
+ "PSR-7",
"client",
"curl",
"framework",
"http",
- "http client",
- "psr-18",
- "psr-7",
"rest",
"web service"
],
- "funding": [
- {
- "url": "https://github.com/GrahamCampbell",
- "type": "github"
- },
- {
- "url": "https://github.com/Nyholm",
- "type": "github"
- },
- {
- "url": "https://github.com/alexeyshockov",
- "type": "github"
- },
- {
- "url": "https://github.com/gmponos",
- "type": "github"
- }
- ],
"install-path": "../guzzlehttp/guzzle"
},
{
),
'guzzlehttp/guzzle' =>
array (
- 'pretty_version' => '7.2.0',
- 'version' => '7.2.0.0',
+ 'pretty_version' => 'dev-proxy-stream',
+ 'version' => 'dev-proxy-stream',
'aliases' =>
array (
),
- 'reference' => '0aa74dfb41ae110835923ef10a9d803a22d50e79',
+ 'reference' => '4b5ae5a75ebad957902452f5bab984781bcd75a3',
),
'guzzlehttp/promises' =>
array (
*/
private function add_proxy(RequestInterface $request, array &$options, $value, array &$params): void
{
+ $uri = null;
+
if (!\is_array($value)) {
- $options['http']['proxy'] = $value;
+ $uri = $value;
} else {
$scheme = $request->getUri()->getScheme();
if (isset($value[$scheme])) {
if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) {
- $options['http']['proxy'] = $value[$scheme];
+ $uri = $value[$scheme];
+ }
+ }
+ }
+
+ if (!$uri) {
+ return;
+ }
+
+ $parsed = $this->parse_proxy($uri);
+ $options['http']['proxy'] = $parsed['proxy'];
+
+ if ($parsed['auth']) {
+ if (!isset($options['http']['header'])) {
+ $options['http']['header'] = [];
+ }
+ $options['http']['header'] .= "\r\nProxy-Authorization: {$parsed['auth']}";
+ }
+ }
+
+ /**
+ * Parses the given proxy URL to make it compatible with the format PHP's stream context expects.
+ */
+ private function parse_proxy(string $url): array
+ {
+ $parsed = \parse_url($url);
+
+ if ($parsed !== false && isset($parsed['scheme']) && $parsed['scheme'] === 'http') {
+ if (isset($parsed['host']) && isset($parsed['port'])) {
+ $auth = null;
+ if (isset($parsed['user']) && isset($parsed['pass'])) {
+ $auth = \base64_encode("{$parsed['user']}:{$parsed['pass']}");
}
+
+ return [
+ 'proxy' => "tcp://{$parsed['host']}:{$parsed['port']}",
+ 'auth' => $auth ? "Basic {$auth}" : null,
+ ];
}
}
+
+ // Return proxy as-is.
+ return [
+ 'proxy' => $url,
+ 'auth' => null,
+ ];
}
/**
/**
* Middleware that throws exceptions for 4xx or 5xx responses when the
- * "http_error" request option is set to true.
+ * "http_errors" request option is set to true.
*
* @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages.
*