From 3a262ffe471f599a8cef5a48775fdbcd38eb5f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 12:22:31 +0000 Subject: [PATCH 01/12] DIS-65 chore: add League oAuth2 Client v 2.7.0 --- .../oauth2_client_php_league/autoload.php | 25 + .../composer/ClassLoader.php | 579 ++++++ .../composer/InstalledVersions.php | 359 ++++ .../oauth2_client_php_league/composer/LICENSE | 21 + .../composer/autoload_classmap.php | 10 + .../composer/autoload_files.php | 12 + .../composer/autoload_namespaces.php | 9 + .../composer/autoload_psr4.php | 15 + .../composer/autoload_real.php | 50 + .../composer/autoload_static.php | 74 + .../composer/installed.json | 752 ++++++++ .../composer/installed.php | 131 ++ .../composer/platform_check.php | 26 + .../guzzlehttp/guzzle/.editorconfig | 17 + .../guzzlehttp/guzzle/.gitattributes | 15 + .../guzzlehttp/guzzle/.github/.editorconfig | 2 + .../guzzlehttp/guzzle/.github/FUNDING.yml | 2 + .../.github/ISSUE_TEMPLATE/bug_report.md | 20 + .../guzzle/.github/ISSUE_TEMPLATE/config.yml | 9 + .../.github/ISSUE_TEMPLATE/feature_request.md | 14 + .../guzzlehttp/guzzle/.github/logo.png | Bin 0 -> 80104 bytes .../guzzlehttp/guzzle/.github/stale.yml | 14 + .../guzzle/.github/workflows/checks.yml | 21 + .../guzzle/.github/workflows/ci.yml | 132 ++ .../guzzle/.github/workflows/static.yml | 82 + .../guzzlehttp/guzzle/.gitignore | 12 + .../guzzlehttp/guzzle/.php-cs-fixer.dist.php | 30 + .../guzzlehttp/guzzle/CHANGELOG.md | 1664 +++++++++++++++++ .../guzzlehttp/guzzle/Dockerfile | 14 + .../guzzlehttp/guzzle/LICENSE | 27 + .../guzzlehttp/guzzle/Makefile | 85 + .../guzzlehttp/guzzle/README.md | 94 + .../guzzlehttp/guzzle/UPGRADING.md | 1253 +++++++++++++ .../guzzlehttp/guzzle/composer.json | 131 ++ .../guzzlehttp/guzzle/docs/Makefile | 153 ++ .../guzzle/docs/_static/guzzle-icon.png | Bin 0 -> 803 bytes .../guzzlehttp/guzzle/docs/_static/logo.png | Bin 0 -> 247678 bytes .../guzzlehttp/guzzle/docs/conf.py | 68 + .../guzzlehttp/guzzle/docs/faq.rst | 193 ++ .../guzzle/docs/handlers-and-middleware.rst | 304 +++ .../guzzlehttp/guzzle/docs/index.rst | 54 + .../guzzlehttp/guzzle/docs/overview.rst | 169 ++ .../guzzlehttp/guzzle/docs/psr7.rst | 456 +++++ .../guzzlehttp/guzzle/docs/quickstart.rst | 613 ++++++ .../guzzle/docs/request-options.rst | 1108 +++++++++++ .../guzzlehttp/guzzle/docs/requirements.txt | 4 + .../guzzlehttp/guzzle/docs/testing.rst | 214 +++ .../guzzlehttp/guzzle/phpstan-baseline.neon | 202 ++ .../guzzlehttp/guzzle/phpstan.neon.dist | 13 + .../guzzlehttp/guzzle/phpunit.xml.dist | 30 + .../guzzlehttp/guzzle/psalm-baseline.xml | 276 +++ .../guzzlehttp/guzzle/psalm.xml | 18 + .../guzzlehttp/guzzle/src/BodySummarizer.php | 28 + .../guzzle/src/BodySummarizerInterface.php | 13 + .../guzzlehttp/guzzle/src/Client.php | 483 +++++ .../guzzlehttp/guzzle/src/ClientInterface.php | 84 + .../guzzlehttp/guzzle/src/ClientTrait.php | 241 +++ .../guzzle/src/Cookie/CookieJar.php | 307 +++ .../guzzle/src/Cookie/CookieJarInterface.php | 80 + .../guzzle/src/Cookie/FileCookieJar.php | 101 + .../guzzle/src/Cookie/SessionCookieJar.php | 77 + .../guzzle/src/Cookie/SetCookie.php | 488 +++++ .../src/Exception/BadResponseException.php | 39 + .../guzzle/src/Exception/ClientException.php | 10 + .../guzzle/src/Exception/ConnectException.php | 56 + .../guzzle/src/Exception/GuzzleException.php | 9 + .../Exception/InvalidArgumentException.php | 7 + .../guzzle/src/Exception/RequestException.php | 150 ++ .../guzzle/src/Exception/ServerException.php | 10 + .../Exception/TooManyRedirectsException.php | 7 + .../src/Exception/TransferException.php | 7 + .../guzzle/src/Handler/CurlFactory.php | 736 ++++++++ .../src/Handler/CurlFactoryInterface.php | 25 + .../guzzle/src/Handler/CurlHandler.php | 49 + .../guzzle/src/Handler/CurlMultiHandler.php | 284 +++ .../guzzle/src/Handler/EasyHandle.php | 112 ++ .../guzzle/src/Handler/HeaderProcessor.php | 42 + .../guzzle/src/Handler/MockHandler.php | 212 +++ .../guzzlehttp/guzzle/src/Handler/Proxy.php | 51 + .../guzzle/src/Handler/StreamHandler.php | 621 ++++++ .../guzzlehttp/guzzle/src/HandlerStack.php | 275 +++ .../guzzle/src/MessageFormatter.php | 199 ++ .../guzzle/src/MessageFormatterInterface.php | 18 + .../guzzlehttp/guzzle/src/Middleware.php | 268 +++ .../guzzlehttp/guzzle/src/Pool.php | 125 ++ .../guzzle/src/PrepareBodyMiddleware.php | 105 ++ .../guzzle/src/RedirectMiddleware.php | 228 +++ .../guzzlehttp/guzzle/src/RequestOptions.php | 274 +++ .../guzzlehttp/guzzle/src/RetryMiddleware.php | 119 ++ .../guzzlehttp/guzzle/src/TransferStats.php | 133 ++ .../guzzlehttp/guzzle/src/Utils.php | 384 ++++ .../guzzlehttp/guzzle/src/functions.php | 167 ++ .../guzzle/src/functions_include.php | 6 + .../guzzlehttp/guzzle/tests/ClientTest.php | 864 +++++++++ .../guzzle/tests/Cookie/CookieJarTest.php | 507 +++++ .../guzzle/tests/Cookie/FileCookieJarTest.php | 148 ++ .../tests/Cookie/SessionCookieJarTest.php | 92 + .../guzzle/tests/Cookie/SetCookieTest.php | 492 +++++ .../Exception/BadResponseExceptionTest.php | 24 + .../tests/Exception/ConnectExceptionTest.php | 28 + .../tests/Exception/RequestExceptionTest.php | 196 ++ .../guzzle/tests/Handler/CurlFactoryTest.php | 946 ++++++++++ .../guzzle/tests/Handler/CurlHandlerTest.php | 101 + .../tests/Handler/CurlMultiHandlerTest.php | 130 ++ .../guzzle/tests/Handler/EasyHandleTest.php | 22 + .../guzzle/tests/Handler/MockHandlerTest.php | 262 +++ .../Handler/Network/StreamHandlerTest.php | 71 + .../guzzle/tests/Handler/ProxyTest.php | 75 + .../tests/Handler/StreamHandlerTest.php | 797 ++++++++ .../guzzle/tests/HandlerStackTest.php | 217 +++ .../guzzlehttp/guzzle/tests/Helpers.php | 35 + .../guzzle/tests/HttplugIntegrationTest.php | 18 + .../guzzle/tests/InternalUtilsTest.php | 25 + .../guzzle/tests/MessageFormatterTest.php | 100 + .../guzzle/tests/MiddlewareTest.php | 259 +++ .../guzzlehttp/guzzle/tests/PoolTest.php | 196 ++ .../tests/PrepareBodyMiddlewareTest.php | 162 ++ .../guzzle/tests/RedirectMiddlewareTest.php | 546 ++++++ .../guzzle/tests/RetryMiddlewareTest.php | 85 + .../guzzlehttp/guzzle/tests/Server.php | 208 +++ .../guzzlehttp/guzzle/tests/TestLogger.php | 99 + .../guzzle/tests/TransferStatsTest.php | 31 + .../guzzlehttp/guzzle/tests/UtilsTest.php | 198 ++ .../guzzle/tests/bootstrap-phpstan.php | 9 + .../guzzlehttp/guzzle/tests/bootstrap.php | 43 + .../guzzlehttp/guzzle/tests/server.js | 261 +++ .../vendor-bin/php-cs-fixer/composer.json | 9 + .../guzzle/vendor-bin/phpstan/composer.json | 10 + .../guzzle/vendor-bin/psalm/composer.json | 9 + .../guzzlehttp/promises/.editorconfig | 9 + .../guzzlehttp/promises/.gitattributes | 13 + .../guzzlehttp/promises/.github/.editorconfig | 2 + .../guzzlehttp/promises/.github/FUNDING.yml | 2 + .../guzzlehttp/promises/.github/stale.yml | 14 + .../promises/.github/workflows/checks.yml | 21 + .../promises/.github/workflows/ci.yml | 58 + .../promises/.github/workflows/static.yml | 82 + .../guzzlehttp/promises/.gitignore | 7 + .../promises/.php-cs-fixer.dist.php | 28 + .../guzzlehttp/promises/CHANGELOG.md | 159 ++ .../guzzlehttp/promises/LICENSE | 24 + .../guzzlehttp/promises/Makefile | 13 + .../guzzlehttp/promises/README.md | 559 ++++++ .../guzzlehttp/promises/composer.json | 58 + .../guzzlehttp/promises/phpstan-baseline.neon | 7 + .../guzzlehttp/promises/phpstan.neon.dist | 7 + .../guzzlehttp/promises/phpunit.xml.dist | 21 + .../guzzlehttp/promises/psalm-baseline.xml | 2 + .../guzzlehttp/promises/psalm.xml | 18 + .../promises/src/AggregateException.php | 19 + .../promises/src/CancellationException.php | 12 + .../guzzlehttp/promises/src/Coroutine.php | 162 ++ .../guzzlehttp/promises/src/Create.php | 79 + .../guzzlehttp/promises/src/Each.php | 81 + .../guzzlehttp/promises/src/EachPromise.php | 248 +++ .../promises/src/FulfilledPromise.php | 89 + .../guzzlehttp/promises/src/Is.php | 40 + .../guzzlehttp/promises/src/Promise.php | 281 +++ .../promises/src/PromiseInterface.php | 91 + .../promises/src/PromisorInterface.php | 16 + .../promises/src/RejectedPromise.php | 95 + .../promises/src/RejectionException.php | 49 + .../guzzlehttp/promises/src/TaskQueue.php | 71 + .../promises/src/TaskQueueInterface.php | 24 + .../guzzlehttp/promises/src/Utils.php | 259 +++ .../promises/tests/AggregateExceptionTest.php | 18 + .../promises/tests/CoroutineTest.php | 115 ++ .../guzzlehttp/promises/tests/CreateTest.php | 58 + .../promises/tests/EachPromiseTest.php | 433 +++++ .../guzzlehttp/promises/tests/EachTest.php | 36 + .../promises/tests/FulfilledPromiseTest.php | 115 ++ .../guzzlehttp/promises/tests/IsTest.php | 42 + .../promises/tests/NotPromiseInstance.php | 51 + .../guzzlehttp/promises/tests/PromiseTest.php | 773 ++++++++ .../promises/tests/PropertyHelper.php | 29 + .../promises/tests/RejectedPromiseTest.php | 151 ++ .../promises/tests/RejectionExceptionTest.php | 30 + .../promises/tests/TaskQueueTest.php | 35 + .../guzzlehttp/promises/tests/Thennable.php | 27 + .../guzzlehttp/promises/tests/Thing1.php | 20 + .../guzzlehttp/promises/tests/Thing2.php | 14 + .../guzzlehttp/promises/tests/UtilsTest.php | 734 ++++++++ .../vendor-bin/php-cs-fixer/composer.json | 9 + .../promises/vendor-bin/phpstan/composer.json | 10 + .../promises/vendor-bin/psalm/composer.json | 9 + .../guzzlehttp/psr7/.editorconfig | 12 + .../guzzlehttp/psr7/.gitattributes | 13 + .../guzzlehttp/psr7/.github/.editorconfig | 2 + .../guzzlehttp/psr7/.github/FUNDING.yml | 2 + .../guzzlehttp/psr7/.github/stale.yml | 14 + .../psr7/.github/workflows/checks.yml | 21 + .../guzzlehttp/psr7/.github/workflows/ci.yml | 58 + .../psr7/.github/workflows/integration.yml | 45 + .../psr7/.github/workflows/static.yml | 82 + .../guzzlehttp/psr7/.gitignore | 7 + .../guzzlehttp/psr7/.php-cs-fixer.dist.php | 28 + .../guzzlehttp/psr7/CHANGELOG.md | 465 +++++ .../guzzlehttp/psr7/LICENSE | 26 + .../guzzlehttp/psr7/Makefile | 18 + .../guzzlehttp/psr7/README.md | 887 +++++++++ .../guzzlehttp/psr7/composer.json | 93 + .../guzzlehttp/psr7/phpstan-baseline.neon | 246 +++ .../guzzlehttp/psr7/phpstan.neon.dist | 11 + .../guzzlehttp/psr7/phpunit.xml.dist | 35 + .../guzzlehttp/psr7/psalm-baseline.xml | 137 ++ .../guzzlehttp/psr7/psalm.xml | 18 + .../guzzlehttp/psr7/src/AppendStream.php | 248 +++ .../guzzlehttp/psr7/src/BufferStream.php | 147 ++ .../guzzlehttp/psr7/src/CachingStream.php | 153 ++ .../guzzlehttp/psr7/src/DroppingStream.php | 49 + .../src/Exception/MalformedUriException.php | 14 + .../guzzlehttp/psr7/src/FnStream.php | 180 ++ .../guzzlehttp/psr7/src/Header.php | 134 ++ .../guzzlehttp/psr7/src/HttpFactory.php | 94 + .../guzzlehttp/psr7/src/InflateStream.php | 37 + .../guzzlehttp/psr7/src/LazyOpenStream.php | 49 + .../guzzlehttp/psr7/src/LimitStream.php | 157 ++ .../guzzlehttp/psr7/src/Message.php | 246 +++ .../guzzlehttp/psr7/src/MessageTrait.php | 265 +++ .../guzzlehttp/psr7/src/MimeType.php | 1259 +++++++++++++ .../guzzlehttp/psr7/src/MultipartStream.php | 165 ++ .../guzzlehttp/psr7/src/NoSeekStream.php | 28 + .../guzzlehttp/psr7/src/PumpStream.php | 179 ++ .../guzzlehttp/psr7/src/Query.php | 118 ++ .../guzzlehttp/psr7/src/Request.php | 159 ++ .../guzzlehttp/psr7/src/Response.php | 161 ++ .../guzzlehttp/psr7/src/Rfc7230.php | 23 + .../guzzlehttp/psr7/src/ServerRequest.php | 340 ++++ .../guzzlehttp/psr7/src/Stream.php | 283 +++ .../psr7/src/StreamDecoratorTrait.php | 156 ++ .../guzzlehttp/psr7/src/StreamWrapper.php | 207 ++ .../guzzlehttp/psr7/src/UploadedFile.php | 211 +++ .../guzzlehttp/psr7/src/Uri.php | 743 ++++++++ .../guzzlehttp/psr7/src/UriComparator.php | 52 + .../guzzlehttp/psr7/src/UriNormalizer.php | 220 +++ .../guzzlehttp/psr7/src/UriResolver.php | 211 +++ .../guzzlehttp/psr7/src/Utils.php | 477 +++++ .../psr7/tests/AppendStreamTest.php | 221 +++ .../psr7/tests/BufferStreamTest.php | 65 + .../psr7/tests/CachingStreamTest.php | 200 ++ .../psr7/tests/DroppingStreamTest.php | 30 + .../guzzlehttp/psr7/tests/FnStreamTest.php | 128 ++ .../guzzlehttp/psr7/tests/HasToString.php | 13 + .../guzzlehttp/psr7/tests/HeaderTest.php | 182 ++ .../psr7/tests/InflateStreamTest.php | 97 + .../ServerRequestFromGlobalsTest.php | 44 + .../psr7/tests/Integration/server.php | 15 + .../psr7/tests/LazyOpenStreamTest.php | 68 + .../guzzlehttp/psr7/tests/LimitStreamTest.php | 165 ++ .../guzzlehttp/psr7/tests/MessageTest.php | 299 +++ .../guzzlehttp/psr7/tests/MimeTypeTest.php | 25 + .../psr7/tests/MultipartStreamTest.php | 330 ++++ .../psr7/tests/NoSeekStreamTest.php | 38 + .../guzzlehttp/psr7/tests/PumpStreamTest.php | 105 ++ .../guzzlehttp/psr7/tests/QueryTest.php | 124 ++ .../psr7/tests/ReadSeekOnlyStream.php | 26 + .../guzzlehttp/psr7/tests/RequestTest.php | 362 ++++ .../guzzlehttp/psr7/tests/ResponseTest.php | 391 ++++ .../psr7/tests/ServerRequestTest.php | 566 ++++++ .../psr7/tests/StreamDecoratorTraitTest.php | 148 ++ .../guzzlehttp/psr7/tests/StreamTest.php | 447 +++++ .../psr7/tests/StreamWrapperTest.php | 202 ++ .../psr7/tests/UploadedFileTest.php | 210 +++ .../psr7/tests/UriComparatorTest.php | 45 + .../psr7/tests/UriNormalizerTest.php | 180 ++ .../guzzlehttp/psr7/tests/UriResolverTest.php | 210 +++ .../guzzlehttp/psr7/tests/UriTest.php | 722 +++++++ .../guzzlehttp/psr7/tests/UtilsTest.php | 551 ++++++ .../vendor-bin/php-cs-fixer/composer.json | 9 + .../psr7/vendor-bin/phpstan/composer.json | 10 + .../psr7/vendor-bin/psalm/composer.json | 9 + .../league/oauth2-client/.gitattributes | 12 + .../oauth2-client/.github/ISSUE_TEMPLATE.md | 1 + .../.github/PULL_REQUEST_TEMPLATE.md | 1 + .../oauth2-client/.github/dependabot.yml | 10 + .../workflows/continuous-integration.yml | 88 + .../league/oauth2-client/.gitignore | 9 + .../league/oauth2-client/CHANGELOG.md | 364 ++++ .../league/oauth2-client/CODE_OF_CONDUCT.md | 76 + .../league/oauth2-client/CONTRIBUTING.md | 39 + .../league/oauth2-client/CREDITS.md | 20 + .../league/oauth2-client/LICENSE | 21 + .../league/oauth2-client/README.md | 58 + .../league/oauth2-client/codecov.yml | 29 + .../league/oauth2-client/composer.json | 58 + .../league/oauth2-client/docs/.gitignore | 9 + .../league/oauth2-client/docs/.ruby-version | 1 + .../league/oauth2-client/docs/CNAME | 1 + .../league/oauth2-client/docs/Gemfile | 3 + .../league/oauth2-client/docs/Gemfile.lock | 269 +++ .../league/oauth2-client/docs/_config.yml | 2 + .../oauth2-client/docs/_data/images.yml | 8 + .../league/oauth2-client/docs/_data/menu.yml | 8 + .../oauth2-client/docs/_data/project.yml | 5 + .../oauth2-client/docs/_layouts/default.html | 99 + .../league/oauth2-client/docs/index.md | 33 + .../docs/providers/implementing.md | 78 + .../oauth2-client/docs/providers/league.md | 26 + .../docs/providers/thirdparty.md | 162 ++ .../league/oauth2-client/docs/usage.md | 244 +++ .../league/oauth2-client/phpunit.xml | 28 + .../oauth2-client/src/Grant/AbstractGrant.php | 80 + .../src/Grant/AuthorizationCode.php | 41 + .../src/Grant/ClientCredentials.php | 39 + .../Grant/Exception/InvalidGrantException.php | 26 + .../oauth2-client/src/Grant/GrantFactory.php | 104 ++ .../oauth2-client/src/Grant/Password.php | 42 + .../oauth2-client/src/Grant/RefreshToken.php | 41 + .../HttpBasicAuthOptionProvider.php | 42 + .../OptionProviderInterface.php | 30 + .../OptionProvider/PostAuthOptionProvider.php | 51 + .../src/Provider/AbstractProvider.php | 941 ++++++++++ .../Exception/IdentityProviderException.php | 48 + .../src/Provider/GenericProvider.php | 247 +++ .../src/Provider/GenericResourceOwner.php | 61 + .../src/Provider/ResourceOwnerInterface.php | 36 + .../oauth2-client/src/Token/AccessToken.php | 243 +++ .../src/Token/AccessTokenInterface.php | 74 + .../ResourceOwnerAccessTokenInterface.php | 25 + .../src/Tool/ArrayAccessorTrait.php | 52 + .../src/Tool/BearerAuthorizationTrait.php | 36 + .../src/Tool/GuardedPropertyTrait.php | 70 + .../src/Tool/MacAuthorizationTrait.php | 83 + .../src/Tool/ProviderRedirectTrait.php | 122 ++ .../src/Tool/QueryBuilderTrait.php | 33 + .../oauth2-client/src/Tool/RequestFactory.php | 87 + .../src/Tool/RequiredParameterTrait.php | 56 + .../test/src/Grant/AuthorizationCodeTest.php | 38 + .../test/src/Grant/ClientCredentialsTest.php | 29 + .../oauth2-client/test/src/Grant/Fake.php | 18 + .../test/src/Grant/GrantFactoryTest.php | 88 + .../test/src/Grant/GrantTestCase.php | 86 + .../test/src/Grant/PasswordTest.php | 46 + .../test/src/Grant/RefreshTokenTest.php | 37 + .../HttpBasicAuthOptionProviderTest.php | 56 + .../PostAuthOptionProviderTest.php | 29 + .../src/Provider/AbstractProviderTest.php | 925 +++++++++ .../IdentityProviderExceptionTest.php | 21 + .../oauth2-client/test/src/Provider/Fake.php | 97 + .../Fake/ProviderWithAccessTokenHints.php | 43 + ...ProviderWithAccessTokenResourceOwnerId.php | 10 + .../Fake/ProviderWithGuardedProperties.php | 32 + .../test/src/Provider/Fake/User.php | 38 + .../test/src/Provider/Generic.php | 30 + .../test/src/Provider/GenericProviderTest.php | 180 ++ .../test/src/Token/AccessTokenTest.php | 230 +++ .../test/src/Tool/ArrayAccessorTraitTest.php | 48 + .../src/Tool/ProviderRedirectTraitTest.php | 165 ++ .../test/src/Tool/QueryBuilderTraitTest.php | 26 + .../test/src/Tool/RequestFactoryTest.php | 56 + .../paragonie/random_compat/.gitattributes | 14 + .../paragonie/random_compat/.gitignore | 4 + .../paragonie/random_compat/.scrutinizer.yml | 4 + .../paragonie/random_compat/.travis.yml | 59 + .../paragonie/random_compat/CHANGELOG.md | 3 + .../paragonie/random_compat/LICENSE | 22 + .../paragonie/random_compat/RATIONALE.md | 36 + .../paragonie/random_compat/README.md | 232 +++ .../paragonie/random_compat/SECURITY.md | 108 ++ .../paragonie/random_compat/build-phar.sh | 5 + .../paragonie/random_compat/composer.json | 34 + .../dist/random_compat.phar.pubkey | 5 + .../dist/random_compat.phar.pubkey.asc | 11 + .../paragonie/random_compat/lib/random.php | 32 + .../random_compat/other/build_phar.php | 57 + .../random_compat/other/ide_stubs/COM.php | 20 + .../random_compat/other/ide_stubs/README.md | 7 + .../other/ide_stubs/com_exception.php | 11 + .../other/ide_stubs/libsodium.php | 90 + .../paragonie/random_compat/phpunit.sh | 60 + .../paragonie/random_compat/phpunit.xml.dist | 31 + .../random_compat/psalm-autoload.php | 9 + .../paragonie/random_compat/psalm.xml | 19 + .../random_compat/tests/full/DieHardTest.php | 61 + .../random_compat/tests/full/StatTest.php | 52 + .../random_compat/tests/specific/capicom.php | 7 + .../tests/specific/dev_urandom.php | 7 + .../tests/specific/libsodium.php | 7 + .../tests/specific/libsodium_legacy.php | 7 + .../random_compat/tests/specific/mcrypt.php | 7 + .../tests/unit/RandomBytesTest.php | 80 + .../tests/unit/RandomIntTest.php | 63 + .../random_compat/tests/unit/UtilityTest.php | 95 + .../unit_with_basedir/RandomBytesTest.php | 100 + .../tests/unit_with_basedir/RandomIntTest.php | 82 + .../tests/unit_with_basedir/UtilityTest.php | 95 + .../psr/http-client/CHANGELOG.md | 31 + .../psr/http-client/LICENSE | 19 + .../psr/http-client/README.md | 12 + .../psr/http-client/composer.json | 30 + .../src/ClientExceptionInterface.php | 10 + .../psr/http-client/src/ClientInterface.php | 20 + .../src/NetworkExceptionInterface.php | 24 + .../src/RequestExceptionInterface.php | 24 + .../psr/http-factory/.gitattributes | 3 + .../psr/http-factory/.gitignore | 2 + .../psr/http-factory/.pullapprove.yml | 7 + .../psr/http-factory/LICENSE | 21 + .../psr/http-factory/README.md | 12 + .../psr/http-factory/composer.json | 38 + .../src/RequestFactoryInterface.php | 18 + .../src/ResponseFactoryInterface.php | 18 + .../src/ServerRequestFactoryInterface.php | 24 + .../src/StreamFactoryInterface.php | 45 + .../src/UploadedFileFactoryInterface.php | 34 + .../http-factory/src/UriFactoryInterface.php | 17 + .../psr/http-message/CHANGELOG.md | 36 + .../psr/http-message/LICENSE | 19 + .../psr/http-message/README.md | 16 + .../psr/http-message/composer.json | 26 + .../psr/http-message/docs/PSR7-Interfaces.md | 130 ++ .../psr/http-message/docs/PSR7-Usage.md | 159 ++ .../psr/http-message/src/MessageInterface.php | 187 ++ .../psr/http-message/src/RequestInterface.php | 130 ++ .../http-message/src/ResponseInterface.php | 68 + .../src/ServerRequestInterface.php | 261 +++ .../psr/http-message/src/StreamInterface.php | 158 ++ .../src/UploadedFileInterface.php | 123 ++ .../psr/http-message/src/UriInterface.php | 324 ++++ .../ralouphie/getallheaders/.gitattributes | 6 + .../ralouphie/getallheaders/.gitignore | 5 + .../ralouphie/getallheaders/.travis.yml | 18 + .../ralouphie/getallheaders/LICENSE | 21 + .../ralouphie/getallheaders/README.md | 27 + .../ralouphie/getallheaders/composer.json | 26 + .../ralouphie/getallheaders/phpunit.xml | 21 + .../getallheaders/src/getallheaders.php | 46 + .../getallheaders/tests/GetAllHeadersTest.php | 128 ++ .../deprecation-contracts/.gitattributes | 1 + .../.github/PULL_REQUEST_TEMPLATE.md | 8 + .../.github/workflows/check-subtree-split.yml | 37 + .../symfony/deprecation-contracts/.gitignore | 3 + .../deprecation-contracts/CHANGELOG.md | 5 + .../symfony/deprecation-contracts/LICENSE | 19 + .../symfony/deprecation-contracts/README.md | 26 + .../deprecation-contracts/composer.json | 35 + .../deprecation-contracts/function.php | 27 + 437 files changed, 54973 insertions(+) create mode 100644 code/web/Drivers/oauth2_client_php_league/autoload.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/ClassLoader.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/InstalledVersions.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/autoload_classmap.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/autoload_files.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/autoload_namespaces.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/autoload_psr4.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/autoload_real.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/autoload_static.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/installed.json create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/installed.php create mode 100644 code/web/Drivers/oauth2_client_php_league/composer/platform_check.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.editorconfig create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/.editorconfig create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/FUNDING.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/config.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/feature_request.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/logo.png create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/stale.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/checks.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/ci.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/static.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.php-cs-fixer.dist.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Dockerfile create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Makefile create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/UPGRADING.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/Makefile create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/_static/guzzle-icon.png create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/_static/logo.png create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/conf.py create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/faq.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/handlers-and-middleware.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/index.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/overview.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/psr7.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/quickstart.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/request-options.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/requirements.txt create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/testing.rst create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan-baseline.neon create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan.neon.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpunit.xml.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm-baseline.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizer.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizerInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Client.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/ClientInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/ClientTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJar.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SetCookie.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/BadResponseException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/ClientException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/ConnectException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/GuzzleException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/RequestException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/ServerException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/TransferException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlFactory.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlHandler.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/EasyHandle.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/MockHandler.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/Proxy.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/StreamHandler.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/HandlerStack.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatter.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatterInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Middleware.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Pool.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RedirectMiddleware.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RequestOptions.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RetryMiddleware.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/TransferStats.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Utils.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/functions.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/functions_include.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/ClientTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/CookieJarTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/FileCookieJarTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SessionCookieJarTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SetCookieTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/BadResponseExceptionTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/ConnectExceptionTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/RequestExceptionTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlFactoryTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlHandlerTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlMultiHandlerTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/EasyHandleTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/MockHandlerTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/Network/StreamHandlerTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/ProxyTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/StreamHandlerTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HandlerStackTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Helpers.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HttplugIntegrationTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/InternalUtilsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MessageFormatterTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MiddlewareTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PoolTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PrepareBodyMiddlewareTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RedirectMiddlewareTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RetryMiddlewareTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Server.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TestLogger.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TransferStatsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/UtilsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/bootstrap-phpstan.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/bootstrap.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/server.js create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/php-cs-fixer/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/phpstan/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/psalm/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.editorconfig create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/.editorconfig create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/FUNDING.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/stale.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/checks.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/ci.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/static.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.php-cs-fixer.dist.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/Makefile create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan-baseline.neon create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan.neon.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpunit.xml.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm-baseline.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/AggregateException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/CancellationException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Coroutine.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Create.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Each.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/EachPromise.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/FulfilledPromise.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Is.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Promise.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/PromiseInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/PromisorInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/RejectedPromise.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/RejectionException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueue.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueueInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Utils.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/AggregateExceptionTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CoroutineTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CreateTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachPromiseTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/FulfilledPromiseTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/IsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/NotPromiseInstance.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PromiseTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PropertyHelper.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectedPromiseTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectionExceptionTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/TaskQueueTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thennable.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing1.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing2.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/UtilsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/phpstan/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/psalm/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.editorconfig create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/.editorconfig create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/FUNDING.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/stale.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/checks.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/ci.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/integration.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/static.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.php-cs-fixer.dist.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/Makefile create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan-baseline.neon create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan.neon.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpunit.xml.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm-baseline.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/AppendStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/BufferStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/CachingStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/DroppingStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Exception/MalformedUriException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/FnStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Header.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/HttpFactory.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/InflateStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LazyOpenStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LimitStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Message.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MessageTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MimeType.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MultipartStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/NoSeekStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/PumpStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Query.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Request.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Response.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Rfc7230.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/ServerRequest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Stream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamDecoratorTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamWrapper.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UploadedFile.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Uri.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriComparator.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriNormalizer.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriResolver.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Utils.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/AppendStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/BufferStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/CachingStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/DroppingStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/FnStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/HasToString.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/HeaderTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/InflateStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/ServerRequestFromGlobalsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/server.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LazyOpenStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LimitStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MessageTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MimeTypeTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MultipartStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/NoSeekStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/PumpStreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/QueryTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ReadSeekOnlyStream.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/RequestTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ResponseTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ServerRequestTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamWrapperTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UploadedFileTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriComparatorTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriNormalizerTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriResolverTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UtilsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/phpstan/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/psalm/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/ISSUE_TEMPLATE.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/dependabot.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/workflows/continuous-integration.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CODE_OF_CONDUCT.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CONTRIBUTING.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CREDITS.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/codecov.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/composer.json create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.gitignore create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.ruby-version create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/CNAME create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile.lock create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_config.yml create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/images.yml create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/menu.yml create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/project.yml create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_layouts/default.html create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/index.md create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/implementing.md create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/league.md create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/thirdparty.md create mode 100755 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/usage.md create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/phpunit.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AbstractGrant.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AuthorizationCode.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/ClientCredentials.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Exception/InvalidGrantException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/GrantFactory.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Password.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/RefreshToken.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/HttpBasicAuthOptionProvider.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/OptionProviderInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/PostAuthOptionProvider.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/AbstractProvider.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/Exception/IdentityProviderException.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericProvider.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericResourceOwner.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/ResourceOwnerInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessToken.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessTokenInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/ResourceOwnerAccessTokenInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ArrayAccessorTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/BearerAuthorizationTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/GuardedPropertyTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/MacAuthorizationTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ProviderRedirectTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/QueryBuilderTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequestFactory.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequiredParameterTrait.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/AuthorizationCodeTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/ClientCredentialsTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/Fake.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/GrantFactoryTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/GrantTestCase.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/PasswordTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/RefreshTokenTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/PostAuthOptionProviderTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/AbstractProviderTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Exception/IdentityProviderExceptionTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenHints.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenResourceOwnerId.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithGuardedProperties.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/User.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Generic.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/GenericProviderTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Token/AccessTokenTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ArrayAccessorTraitTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ProviderRedirectTraitTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/QueryBuilderTraitTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/RequestFactoryTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.scrutinizer.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.travis.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/RATIONALE.md create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/SECURITY.md create mode 100755 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/build-phar.sh create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey.asc create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/lib/random.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/build_phar.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/COM.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/com_exception.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/libsodium.php create mode 100755 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/phpunit.sh create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/phpunit.xml.dist create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/psalm-autoload.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/psalm.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/DieHardTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/StatTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/capicom.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/dev_urandom.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/libsodium.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/libsodium_legacy.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/mcrypt.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/RandomBytesTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/RandomIntTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/UtilityTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomBytesTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomIntTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/UtilityTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/src/ClientExceptionInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/src/ClientInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/src/NetworkExceptionInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-client/src/RequestExceptionInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/.pullapprove.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/RequestFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/ResponseFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/ServerRequestFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/StreamFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/UploadedFileFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/UriFactoryInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/docs/PSR7-Interfaces.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/docs/PSR7-Usage.md create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/MessageInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/RequestInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/ResponseInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/ServerRequestInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/StreamInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/UploadedFileInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/psr/http-message/src/UriInterface.php create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.travis.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/phpunit.xml create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/src/getallheaders.php create mode 100644 code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/tests/GetAllHeadersTest.php create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitattributes create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/workflows/check-subtree-split.yml create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitignore create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/CHANGELOG.md create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/LICENSE create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/README.md create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/composer.json create mode 100644 code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/function.php diff --git a/code/web/Drivers/oauth2_client_php_league/autoload.php b/code/web/Drivers/oauth2_client_php_league/autoload.php new file mode 100644 index 0000000000..3f780a4274 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/autoload.php @@ -0,0 +1,25 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + 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; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/composer/InstalledVersions.php b/code/web/Drivers/oauth2_client_php_league/composer/InstalledVersions.php new file mode 100644 index 0000000000..51e734a774 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $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))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + 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'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + 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')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/composer/LICENSE b/code/web/Drivers/oauth2_client_php_league/composer/LICENSE new file mode 100644 index 0000000000..f27399a042 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/code/web/Drivers/oauth2_client_php_league/composer/autoload_classmap.php b/code/web/Drivers/oauth2_client_php_league/composer/autoload_classmap.php new file mode 100644 index 0000000000..0fb0a2c194 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/code/web/Drivers/oauth2_client_php_league/composer/autoload_files.php b/code/web/Drivers/oauth2_client_php_league/composer/autoload_files.php new file mode 100644 index 0000000000..ff3bac206e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/autoload_files.php @@ -0,0 +1,12 @@ + $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', +); diff --git a/code/web/Drivers/oauth2_client_php_league/composer/autoload_namespaces.php b/code/web/Drivers/oauth2_client_php_league/composer/autoload_namespaces.php new file mode 100644 index 0000000000..15a2ff3ad6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'), + 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), + 'League\\OAuth2\\Client\\' => array($vendorDir . '/league/oauth2-client/src'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), + 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), +); diff --git a/code/web/Drivers/oauth2_client_php_league/composer/autoload_real.php b/code/web/Drivers/oauth2_client_php_league/composer/autoload_real.php new file mode 100644 index 0000000000..ead146d541 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/autoload_real.php @@ -0,0 +1,50 @@ +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInit8485a5d903026c85001fed86e485bb8d::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); + } + + return $loader; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/composer/autoload_static.php b/code/web/Drivers/oauth2_client_php_league/composer/autoload_static.php new file mode 100644 index 0000000000..f0079dd3b2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/autoload_static.php @@ -0,0 +1,74 @@ + __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'P' => + array ( + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Http\\Client\\' => 16, + ), + 'L' => + array ( + 'League\\OAuth2\\Client\\' => 21, + ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + 'GuzzleHttp\\Promise\\' => 19, + 'GuzzleHttp\\' => 11, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-message/src', + 1 => __DIR__ . '/..' . '/psr/http-factory/src', + ), + 'Psr\\Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-client/src', + ), + 'League\\OAuth2\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/league/oauth2-client/src', + ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'GuzzleHttp\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', + ), + 'GuzzleHttp\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit8485a5d903026c85001fed86e485bb8d::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8485a5d903026c85001fed86e485bb8d::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8485a5d903026c85001fed86e485bb8d::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/composer/installed.json b/code/web/Drivers/oauth2_client_php_league/composer/installed.json new file mode 100644 index 0000000000..3834e3e532 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/installed.json @@ -0,0 +1,752 @@ +{ + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "7.9.2", + "version_normalized": "7.9.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "time": "2024-07-24T11:22:20+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "installation-source": "source", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "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.9.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/guzzle" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.3", + "version_normalized": "2.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "time": "2024-07-18T10:29:17+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "installation-source": "source", + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/promises" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.7.0", + "version_normalized": "2.7.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2024-07-18T11:15:46+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "installation-source": "source", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.7.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/psr7" + }, + { + "name": "league/oauth2-client", + "version": "2.7.0", + "version_normalized": "2.7.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/oauth2-client.git", + "reference": "160d6274b03562ebeb55ed18399281d8118b76c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/160d6274b03562ebeb55ed18399281d8118b76c8", + "reference": "160d6274b03562ebeb55ed18399281d8118b76c8", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0 || ^7.0", + "paragonie/random_compat": "^1 || ^2 || ^9.99", + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.3.5", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpunit/phpunit": "^5.7 || ^6.0 || ^9.5", + "squizlabs/php_codesniffer": "^2.3 || ^3.0" + }, + "time": "2023-04-16T18:19:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.0.x-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-4": { + "League\\OAuth2\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Bilbie", + "email": "hello@alexbilbie.com", + "homepage": "http://www.alexbilbie.com", + "role": "Developer" + }, + { + "name": "Woody Gilk", + "homepage": "https://github.com/shadowhand", + "role": "Contributor" + } + ], + "description": "OAuth 2.0 Client Library", + "keywords": [ + "Authentication", + "SSO", + "authorization", + "identity", + "idp", + "oauth", + "oauth2", + "single sign on" + ], + "support": { + "issues": "https://github.com/thephpleague/oauth2-client/issues", + "source": "https://github.com/thephpleague/oauth2-client/tree/2.7.0" + }, + "install-path": "../league/oauth2-client" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "version_normalized": "9.99.100.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2020-10-15T08:29:30+00:00", + "type": "library", + "installation-source": "source", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "install-path": "../paragonie/random_compat" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "time": "2023-09-23T14:17:50+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "install-path": "../psr/http-client" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "time": "2024-04-15T12:06:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "install-path": "../psr/http-factory" + }, + { + "name": "psr/http-message", + "version": "2.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2023-04-04T09:54:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "install-path": "../psr/http-message" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "time": "2019-03-08T08:55:37+00:00", + "type": "library", + "installation-source": "source", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "install-path": "../ralouphie/getallheaders" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", + "version_normalized": "3.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2024-04-18T09:32:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "source", + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/deprecation-contracts" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/code/web/Drivers/oauth2_client_php_league/composer/installed.php b/code/web/Drivers/oauth2_client_php_league/composer/installed.php new file mode 100644 index 0000000000..4e4731af84 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/installed.php @@ -0,0 +1,131 @@ + array( + 'name' => '__root__', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'guzzlehttp/guzzle' => array( + 'pretty_version' => '7.9.2', + 'version' => '7.9.2.0', + 'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'guzzlehttp/promises' => array( + 'pretty_version' => '2.0.3', + 'version' => '2.0.3.0', + 'reference' => '6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8', + 'type' => 'library', + 'install_path' => __DIR__ . '/../guzzlehttp/promises', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'guzzlehttp/psr7' => array( + 'pretty_version' => '2.7.0', + 'version' => '2.7.0.0', + 'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201', + 'type' => 'library', + 'install_path' => __DIR__ . '/../guzzlehttp/psr7', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'league/oauth2-client' => array( + 'pretty_version' => '2.7.0', + 'version' => '2.7.0.0', + 'reference' => '160d6274b03562ebeb55ed18399281d8118b76c8', + 'type' => 'library', + 'install_path' => __DIR__ . '/../league/oauth2-client', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'paragonie/random_compat' => array( + 'pretty_version' => 'v9.99.100', + 'version' => '9.99.100.0', + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../paragonie/random_compat', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-client' => array( + 'pretty_version' => '1.0.3', + 'version' => '1.0.3.0', + 'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-client', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/http-factory' => array( + 'pretty_version' => '1.1.0', + 'version' => '1.1.0.0', + 'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-factory', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-factory-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/http-message' => array( + 'pretty_version' => '2.0', + 'version' => '2.0.0.0', + 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-message', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-message-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), + 'ralouphie/getallheaders' => array( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ralouphie/getallheaders', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/deprecation-contracts' => array( + 'pretty_version' => 'v3.5.0', + 'version' => '3.5.0.0', + 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/code/web/Drivers/oauth2_client_php_league/composer/platform_check.php b/code/web/Drivers/oauth2_client_php_league/composer/platform_check.php new file mode 100644 index 0000000000..4c3a5d68f1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/composer/platform_check.php @@ -0,0 +1,26 @@ += 80100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.editorconfig b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.editorconfig new file mode 100644 index 0000000000..b76dad3171 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig is awesome: https://editorconfig.org/ + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending for every file +# Indent with 4 spaces +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[Makefile] +indent_style = tab diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitattributes b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitattributes new file mode 100644 index 0000000000..030e6fe6d2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitattributes @@ -0,0 +1,15 @@ +.editorconfig export-ignore +.gitattributes export-ignore +/.github/ export-ignore +.gitignore export-ignore +.php-cs-fixer.dist.php export-ignore +/docs/ export-ignore +/Dockerfile export-ignore +/Makefile export-ignore +/phpstan-baseline.neon export-ignore +/phpstan.neon.dist export-ignore +/phpunit.xml.dist export-ignore +/psalm-baseline.xml export-ignore +/psalm.xml export-ignore +/tests/ export-ignore +/vendor-bin/ export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/.editorconfig b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/.editorconfig new file mode 100644 index 0000000000..7bd3346f26 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/.editorconfig @@ -0,0 +1,2 @@ +[*.yml] +indent_size = 2 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/FUNDING.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/FUNDING.yml new file mode 100644 index 0000000000..86ce6948a6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [Nyholm, GrahamCampbell] +tidelift: "packagist/guzzlehttp/guzzle" diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/bug_report.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..d8fb54bc2f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,20 @@ +--- +name: 🐛 Bug Report +about: Report errors and problems +--- + +**Guzzle version(s) affected**: x.y.z +**PHP version**: x.y.z (hint: `php --version`) +**cURL version**: x.y.z (hint: `php -i | grep cURL`) + +**Description** + + +**How to reproduce** + + +**Possible Solution** + + +**Additional context** + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/config.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..4a85619264 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +blank_issues_enabled: false +contact_links: + - name: 📚Documentation + url: https://docs.guzzlephp.org/en/stable/ + about: Check the documentation before opening an issue. + + - name: ❓Support + url: https://github.com/guzzle/.github/blob/master/.github/SUPPORT.md + about: We use GitHub issues only to discuss bugs and new features. diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/feature_request.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..f0cf15354a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: 🚀 Feature Request +about: RFC and ideas for new features and improvements +--- + +**Description** + + +**Example** + + +**Additional context** + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/logo.png b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..117207ea87875d4d708ad916a8184e836826737e GIT binary patch literal 80104 zcmZr&2RPO3`#+M9S<0Rf8dfU%IFY0>DkUQ%*=1%PoXSWtB9(bakr3IN%p%T_y))0T zH^=@zhtl`;`@62L-s|oAJkLEo_vaqZQ+^t1$}|UA55izD8kNfzZ@^%5u`t+v8Hxko z|3r3NcLu*v+FaJQhru*ih`&fiLlXsHFm9O2#S5CwQ4>9GHqpcGzh`UScn=Nw3sdOk zJbf7aB=4~ms|{ATUGn|6hYHVRioLSTNngjwSX{eo&Bu2lm`c^0pXYe;q(g=Z-jS+4 z$6v)n@be@m|b;) z)`#wXw5U~VY#u&?bHTBVuXwB$hH-5+k!{dgFn*WB!p zj_BdH1};UWznOw^9EB%ju;<()Pxf`O1TNF~+@CDI7aK2eU!)ix!0b-IiCZT7++P&b zL7&e(y}DAz;}yVbyPDaEVH+O{`mk|zcX#4{9E^f-z~0&LM%HUBO-{Qy^?i%6Tw8ja zP@vPPU~Os2JjN9@)8=$WEy!p=@Cy36?$IkJZx&uMTIlCG|B)2BlPx!b9A@{(xMF4O z%bT3YpsCSM;~lnnXJ6Ed=QqlBy%%&JDgWHh>~1otbUoI?BDkd0#{s%NmYxzzf{J>c z6U8+?v9>YwCdXiGefAq!Pgm!`lalh0f|t{ryQ2D;i;ZTZG|pxd@&zw)`87UN{*S#5 zJ_Xu*k1%Um`Pxw87PxM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N<1 z#s4x$KC2b-hsY30m)eKBvsI_PX&=aF3%iooysItqcbwOzZZSh!cx^q`hg^y(rXv__ z`MCiol^O?4SO@1Ic^}U4G_m-ezUt^=oNITW;vLy-ZkxNssvv9S+6qD1j`3>2wL!O- zZqgpc67PaR!d*X=*(~vuh6h;~S?vC?O?`cQ0u)f&0@`P7gP6(z=6~3gL3xNTB>GM_ z?ZHowkuHi3U5KWyy}|{ zekjGL!#^aXI!kxFc`%5x2>pj;G&}&4k6s5z#!rp3@A<`0528nV&k|`nv^?S2(puW` zuXw!4zU{NVOolQFv4EH9ny&grFD(d@8M%}AuxdRgZAT9wdZ8Qevo#c2S=Q-sZ&Y-} zp&Rtj%a_ySK^G$GyI@|U>W0+lT4R0Ev6k$ffY2&kpDr&fXJ9XKiGU;PV9_4o>fw~O z_qI>^#uI;}OR&G3{=bY4|Dy)Q4&?g+Osf9UIG}o?188Y`ApOG)Uh+6m8zftKQ42o`PsWB z&x3Vch5N$;C2_jho?-+Q1A3-F6({9D7nz}mC0|S_>pjMNJm1t%HR(aseosOygaEPp zS-d1$!;L5L6Qo>Pc+sd!%mKRJ*5;(AA+JotiZ}%^x+QS|5JBaMdc+)fR>16t6`AUB zHFuaiucTgZ4}6PQ{w(&B-=o_WpD>v0#q}4|JROnkeAY!WEGZy$9Gq+m8A(si_m+*C ost1iEi3M^>6Z9aYTM9QNn`jZQ`S#JqDfB<~7?|j%={a2bKjJzfG5`Po literal 0 HcmV?d00001 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/stale.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/stale.yml new file mode 100644 index 0000000000..53faa71bd9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/stale.yml @@ -0,0 +1,14 @@ +daysUntilStale: 120 +daysUntilClose: 14 +exemptLabels: + - lifecycle/keep-open + - lifecycle/ready-for-merge +# Label to use when marking an issue as stale +staleLabel: lifecycle/stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/checks.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/checks.yml new file mode 100644 index 0000000000..aa01ed09ca --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/checks.yml @@ -0,0 +1,21 @@ +name: Checks + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + composer-normalize: + name: Composer Normalize + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Composer normalize + uses: docker://ergebnis/composer-normalize-action diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/ci.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/ci.yml new file mode 100644 index 0000000000..0012420980 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/ci.yml @@ -0,0 +1,132 @@ +name: CI + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + build-lowest-version: + name: Build lowest version + runs-on: ubuntu-22.04 + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.2' + ini-values: error_reporting=E_ALL + coverage: none + extensions: mbstring, intl + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18.x' + + - name: Setup Problem Matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download dependencies + run: composer update --no-interaction --no-progress --prefer-stable --prefer-lowest + + - name: Start test servers + shell: bash + run: | + node tests/server.js & + ./vendor/bin/http_test_server & + + - name: Run tests + run: ./vendor/bin/phpunit + + build: + name: Build + runs-on: ubuntu-22.04 + strategy: + max-parallel: 10 + matrix: + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + psr7: ['^2.7.0'] + include: + - php: '8.4' + psr7: '^2.7.0@dev' + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + coverage: none + extensions: mbstring, intl + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18.x' + + - name: Setup Problem Matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download dependencies + run: | + composer require --no-update "guzzlehttp/psr7:${{ matrix.psr7 }}" + composer update --no-interaction --no-progress + + - name: Start test servers + shell: bash + run: | + node tests/server.js & + ./vendor/bin/http_test_server & + + - name: Run tests + run: ./vendor/bin/phpunit + + build-windows: + name: Build on Windows + runs-on: windows-2022 + strategy: + max-parallel: 10 + matrix: + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + coverage: none + extensions: mbstring, intl + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18.x' + + - name: Setup Problem Matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Start test servers + shell: bash + run: | + node tests/server.js & + ./vendor/bin/http_test_server & + + - name: Run tests + run: vendor/bin/phpunit.bat diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/static.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/static.yml new file mode 100644 index 0000000000..799401385f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.github/workflows/static.yml @@ -0,0 +1,82 @@ +name: Static analysis + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring, intl + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download PHPStan + run: composer bin phpstan update --no-interaction --no-progress + + - name: Execute PHPStan + run: vendor/bin/phpstan analyze --no-progress + + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download PHP CS Fixer + run: composer bin php-cs-fixer update --no-interaction --no-progress + + - name: Execute PHP CS Fixer + run: vendor/bin/php-cs-fixer fix --diff --dry-run + + psalm: + name: Psalm + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring, intl + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download Psalm + run: composer bin psalm update --no-interaction --no-progress + + - name: Execute Psalm + run: vendor/bin/psalm.phar --no-progress --output-format=github diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitignore b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitignore new file mode 100644 index 0000000000..17a858b223 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.gitignore @@ -0,0 +1,12 @@ +.php-cs-fixer.php +.php-cs-fixer.cache +.phpunit.result.cache +composer.lock +vendor/ +/phpstan.neon +/phpunit.xml + +build/ +artifacts/ +docs/_build +docs/*.pyc diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.php-cs-fixer.dist.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.php-cs-fixer.dist.php new file mode 100644 index 0000000000..48dee7382b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/.php-cs-fixer.dist.php @@ -0,0 +1,30 @@ +setRiskyAllowed(true) + ->setRules([ + '@PHP71Migration:risky' => true, + '@PHPUnit75Migration:risky' => true, + '@PSR12:risky' => true, + '@Symfony' => true, + 'declare_strict_types' => false, + 'global_namespace_import' => false, + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + ], + 'phpdoc_annotation_without_dot' => false, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => false, + 'single_line_throw' => false, + 'void_return' => false, + 'yoda_style' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') + ->name('*.php') + ) +; + +return $config; diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/CHANGELOG.md new file mode 100644 index 0000000000..e0b6216598 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/CHANGELOG.md @@ -0,0 +1,1664 @@ +# Change Log + +Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. + + +## 7.9.2 - 2024-07-24 + +### Fixed + +- Adjusted handler selection to use cURL if its version is 7.21.2 or higher, rather than 7.34.0 + + +## 7.9.1 - 2024-07-19 + +### Fixed + +- Fix TLS 1.3 check for HTTP/2 requests + + +## 7.9.0 - 2024-07-18 + +### Changed + +- Improve protocol version checks to provide feedback around unsupported protocols +- Only select the cURL handler by default if 7.34.0 or higher is linked +- Improved `CurlMultiHandler` to avoid busy wait if possible +- Dropped support for EOL `guzzlehttp/psr7` v1 +- Improved URI user info redaction in errors + +## 7.8.2 - 2024-07-18 + +### Added + +- Support for PHP 8.4 + + +## 7.8.1 - 2023-12-03 + +### Changed + +- Updated links in docs to their canonical versions +- Replaced `call_user_func*` with native calls + + +## 7.8.0 - 2023-08-27 + +### Added + +- Support for PHP 8.3 +- Added automatic closing of handles on `CurlFactory` object destruction + + +## 7.7.1 - 2023-08-27 + +### Changed + +- Remove the need for `AllowDynamicProperties` in `CurlMultiHandler` + + +## 7.7.0 - 2023-05-21 + +### Added + +- Support `guzzlehttp/promises` v2 + + +## 7.6.1 - 2023-05-15 + +### Fixed + +- Fix `SetCookie::fromString` MaxAge deprecation warning and skip invalid MaxAge values + + +## 7.6.0 - 2023-05-14 + +### Added + +- Support for setting the minimum TLS version in a unified way +- Apply on request the version set in options parameters + + +## 7.5.2 - 2023-05-14 + +### Fixed + +- Fixed set cookie constructor validation +- Fixed handling of files with `'0'` body + +### Changed + +- Corrected docs and default connect timeout value to 300 seconds + + +## 7.5.1 - 2023-04-17 + +### Fixed + +- Fixed `NO_PROXY` settings so that setting the `proxy` option to `no` overrides the env variable + +### Changed + +- Adjusted `guzzlehttp/psr7` version constraint to `^1.9.1 || ^2.4.5` + + +## 7.5.0 - 2022-08-28 + +### Added + +- Support PHP 8.2 +- Add request to delay closure params + + +## 7.4.5 - 2022-06-20 + +### Fixed + +* Fix change in port should be considered a change in origin +* Fix `CURLOPT_HTTPAUTH` option not cleared on change of origin + + +## 7.4.4 - 2022-06-09 + +### Fixed + +* Fix failure to strip Authorization header on HTTP downgrade +* Fix failure to strip the Cookie header on change in host or HTTP downgrade + + +## 7.4.3 - 2022-05-25 + +### Fixed + +* Fix cross-domain cookie leakage + + +## 7.4.2 - 2022-03-20 + +### Fixed + +- Remove curl auth on cross-domain redirects to align with the Authorization HTTP header +- Reject non-HTTP schemes in StreamHandler +- Set a default ssl.peer_name context in StreamHandler to allow `force_ip_resolve` + + +## 7.4.1 - 2021-12-06 + +### Changed + +- Replaced implicit URI to string coercion [#2946](https://github.com/guzzle/guzzle/pull/2946) +- Allow `symfony/deprecation-contracts` version 3 [#2961](https://github.com/guzzle/guzzle/pull/2961) + +### Fixed + +- Only close curl handle if it's done [#2950](https://github.com/guzzle/guzzle/pull/2950) + + +## 7.4.0 - 2021-10-18 + +### Added + +- Support PHP 8.1 [#2929](https://github.com/guzzle/guzzle/pull/2929), [#2939](https://github.com/guzzle/guzzle/pull/2939) +- Support `psr/log` version 2 and 3 [#2943](https://github.com/guzzle/guzzle/pull/2943) + +### Fixed + +- Make sure we always call `restore_error_handler()` [#2915](https://github.com/guzzle/guzzle/pull/2915) +- Fix progress parameter type compatibility between the cURL and stream handlers [#2936](https://github.com/guzzle/guzzle/pull/2936) +- Throw `InvalidArgumentException` when an incorrect `headers` array is provided [#2916](https://github.com/guzzle/guzzle/pull/2916), [#2942](https://github.com/guzzle/guzzle/pull/2942) + +### Changed + +- Be more strict with types [#2914](https://github.com/guzzle/guzzle/pull/2914), [#2917](https://github.com/guzzle/guzzle/pull/2917), [#2919](https://github.com/guzzle/guzzle/pull/2919), [#2945](https://github.com/guzzle/guzzle/pull/2945) + + +## 7.3.0 - 2021-03-23 + +### Added + +- Support for DER and P12 certificates [#2413](https://github.com/guzzle/guzzle/pull/2413) +- Support the cURL (http://) scheme for StreamHandler proxies [#2850](https://github.com/guzzle/guzzle/pull/2850) +- Support for `guzzlehttp/psr7:^2.0` [#2878](https://github.com/guzzle/guzzle/pull/2878) + +### Fixed + +- Handle exceptions on invalid header consistently between PHP versions and handlers [#2872](https://github.com/guzzle/guzzle/pull/2872) + + +## 7.2.0 - 2020-10-10 + +### Added + +- Support for PHP 8 [#2712](https://github.com/guzzle/guzzle/pull/2712), [#2715](https://github.com/guzzle/guzzle/pull/2715), [#2789](https://github.com/guzzle/guzzle/pull/2789) +- Support passing a body summarizer to the http errors middleware [#2795](https://github.com/guzzle/guzzle/pull/2795) + +### Fixed + +- Handle exceptions during response creation [#2591](https://github.com/guzzle/guzzle/pull/2591) +- Fix CURLOPT_ENCODING not to be overwritten [#2595](https://github.com/guzzle/guzzle/pull/2595) +- Make sure the Request always has a body object [#2804](https://github.com/guzzle/guzzle/pull/2804) + +### Changed + +- The `TooManyRedirectsException` has a response [#2660](https://github.com/guzzle/guzzle/pull/2660) +- Avoid "functions" from dependencies [#2712](https://github.com/guzzle/guzzle/pull/2712) + +### Deprecated + +- Using environment variable GUZZLE_CURL_SELECT_TIMEOUT [#2786](https://github.com/guzzle/guzzle/pull/2786) + + +## 7.1.1 - 2020-09-30 + +### Fixed + +- Incorrect EOF detection for response body streams on Windows. + +### Changed + +- We dont connect curl `sink` on HEAD requests. +- Removed some PHP 5 workarounds + + +## 7.1.0 - 2020-09-22 + +### Added + +- `GuzzleHttp\MessageFormatterInterface` + +### Fixed + +- Fixed issue that caused cookies with no value not to be stored. +- On redirects, we allow all safe methods like GET, HEAD and OPTIONS. +- Fixed logging on empty responses. +- Make sure MessageFormatter::format returns string + +### Deprecated + +- All functions in `GuzzleHttp` has been deprecated. Use static methods on `Utils` instead. +- `ClientInterface::getConfig()` +- `Client::getConfig()` +- `Client::__call()` +- `Utils::defaultCaBundle()` +- `CurlFactory::LOW_CURL_VERSION_NUMBER` + + +## 7.0.1 - 2020-06-27 + +* Fix multiply defined functions fatal error [#2699](https://github.com/guzzle/guzzle/pull/2699) + + +## 7.0.0 - 2020-06-27 + +No changes since 7.0.0-rc1. + + +## 7.0.0-rc1 - 2020-06-15 + +### Changed + +* Use error level for logging errors in Middleware [#2629](https://github.com/guzzle/guzzle/pull/2629) +* Disabled IDN support by default and require ext-intl to use it [#2675](https://github.com/guzzle/guzzle/pull/2675) + + +## 7.0.0-beta2 - 2020-05-25 + +### Added + +* Using `Utils` class instead of functions in the `GuzzleHttp` namespace. [#2546](https://github.com/guzzle/guzzle/pull/2546) +* `ClientInterface::MAJOR_VERSION` [#2583](https://github.com/guzzle/guzzle/pull/2583) + +### Changed + +* Avoid the `getenv` function when unsafe [#2531](https://github.com/guzzle/guzzle/pull/2531) +* Added real client methods [#2529](https://github.com/guzzle/guzzle/pull/2529) +* Avoid functions due to global install conflicts [#2546](https://github.com/guzzle/guzzle/pull/2546) +* Use Symfony intl-idn polyfill [#2550](https://github.com/guzzle/guzzle/pull/2550) +* Adding methods for HTTP verbs like `Client::get()`, `Client::head()`, `Client::patch()` etc [#2529](https://github.com/guzzle/guzzle/pull/2529) +* `ConnectException` extends `TransferException` [#2541](https://github.com/guzzle/guzzle/pull/2541) +* Updated the default User Agent to "GuzzleHttp/7" [#2654](https://github.com/guzzle/guzzle/pull/2654) + +### Fixed + +* Various intl icu issues [#2626](https://github.com/guzzle/guzzle/pull/2626) + +### Removed + +* Pool option `pool_size` [#2528](https://github.com/guzzle/guzzle/pull/2528) + + +## 7.0.0-beta1 - 2019-12-30 + +The diff might look very big but 95% of Guzzle users will be able to upgrade without modification. +Please see [the upgrade document](UPGRADING.md) that describes all BC breaking changes. + +### Added + +* Implement PSR-18 and dropped PHP 5 support [#2421](https://github.com/guzzle/guzzle/pull/2421) [#2474](https://github.com/guzzle/guzzle/pull/2474) +* PHP 7 types [#2442](https://github.com/guzzle/guzzle/pull/2442) [#2449](https://github.com/guzzle/guzzle/pull/2449) [#2466](https://github.com/guzzle/guzzle/pull/2466) [#2497](https://github.com/guzzle/guzzle/pull/2497) [#2499](https://github.com/guzzle/guzzle/pull/2499) +* IDN support for redirects [2424](https://github.com/guzzle/guzzle/pull/2424) + +### Changed + +* Dont allow passing null as third argument to `BadResponseException::__construct()` [#2427](https://github.com/guzzle/guzzle/pull/2427) +* Use SAPI constant instead of method call [#2450](https://github.com/guzzle/guzzle/pull/2450) +* Use native function invocation [#2444](https://github.com/guzzle/guzzle/pull/2444) +* Better defaults for PHP installations with old ICU lib [2454](https://github.com/guzzle/guzzle/pull/2454) +* Added visibility to all constants [#2462](https://github.com/guzzle/guzzle/pull/2462) +* Dont allow passing `null` as URI to `Client::request()` and `Client::requestAsync()` [#2461](https://github.com/guzzle/guzzle/pull/2461) +* Widen the exception argument to throwable [#2495](https://github.com/guzzle/guzzle/pull/2495) + +### Fixed + +* Logging when Promise rejected with a string [#2311](https://github.com/guzzle/guzzle/pull/2311) + +### Removed + +* Class `SeekException` [#2162](https://github.com/guzzle/guzzle/pull/2162) +* `RequestException::getResponseBodySummary()` [#2425](https://github.com/guzzle/guzzle/pull/2425) +* `CookieJar::getCookieValue()` [#2433](https://github.com/guzzle/guzzle/pull/2433) +* `uri_template()` and `UriTemplate` [#2440](https://github.com/guzzle/guzzle/pull/2440) +* Request options `save_to` and `exceptions` [#2464](https://github.com/guzzle/guzzle/pull/2464) + + +## 6.5.2 - 2019-12-23 + +* idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489) + + +## 6.5.1 - 2019-12-21 + +* Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454) +* IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424) + + +## 6.5.0 - 2019-12-07 + +* Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143) +* Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287) +* Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132) +* Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132) +* Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348) +* Deprecated `ClientInterface::VERSION` + + +## 6.4.1 - 2019-10-23 + +* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that +* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar` + + +## 6.4.0 - 2019-10-23 + +* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108) +* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081) +* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161) +* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163) +* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242) +* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284) +* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273) +* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335) +* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362) + + +## 6.3.3 - 2018-04-22 + +* Fix: Default headers when decode_content is specified + + +## 6.3.2 - 2018-03-26 + +* Fix: Release process + + +## 6.3.1 - 2018-03-26 + +* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014) +* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012) +* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999) +* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998) +* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953) +* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915) +* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916) + ++ Minor code cleanups, documentation fixes and clarifications. + + +## 6.3.0 - 2017-06-22 + +* Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659) +* Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621) +* Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580) +* Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609) +* Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641) +* Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611) +* Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811) +* Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642) +* Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569) +* Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711) +* Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745) +* Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721) +* Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318) +* Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684) +* Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827) + ++ Minor code cleanups, documentation fixes and clarifications. + + +## 6.2.3 - 2017-02-28 + +* Fix deprecations with guzzle/psr7 version 1.4 + + +## 6.2.2 - 2016-10-08 + +* Allow to pass nullable Response to delay callable +* Only add scheme when host is present +* Fix drain case where content-length is the literal string zero +* Obfuscate in-URL credentials in exceptions + + +## 6.2.1 - 2016-07-18 + +* Address HTTP_PROXY security vulnerability, CVE-2016-5385: + https://httpoxy.org/ +* Fixing timeout bug with StreamHandler: + https://github.com/guzzle/guzzle/pull/1488 +* Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when + a server does not honor `Connection: close`. +* Ignore URI fragment when sending requests. + + +## 6.2.0 - 2016-03-21 + +* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`. + https://github.com/guzzle/guzzle/pull/1389 +* Bug fix: Fix sleep calculation when waiting for delayed requests. + https://github.com/guzzle/guzzle/pull/1324 +* Feature: More flexible history containers. + https://github.com/guzzle/guzzle/pull/1373 +* Bug fix: defer sink stream opening in StreamHandler. + https://github.com/guzzle/guzzle/pull/1377 +* Bug fix: do not attempt to escape cookie values. + https://github.com/guzzle/guzzle/pull/1406 +* Feature: report original content encoding and length on decoded responses. + https://github.com/guzzle/guzzle/pull/1409 +* Bug fix: rewind seekable request bodies before dispatching to cURL. + https://github.com/guzzle/guzzle/pull/1422 +* Bug fix: provide an empty string to `http_build_query` for HHVM workaround. + https://github.com/guzzle/guzzle/pull/1367 + + +## 6.1.1 - 2015-11-22 + +* Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler + https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4 +* Feature: HandlerStack is now more generic. + https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e +* Bug fix: setting verify to false in the StreamHandler now disables peer + verification. https://github.com/guzzle/guzzle/issues/1256 +* Feature: Middleware now uses an exception factory, including more error + context. https://github.com/guzzle/guzzle/pull/1282 +* Feature: better support for disabled functions. + https://github.com/guzzle/guzzle/pull/1287 +* Bug fix: fixed regression where MockHandler was not using `sink`. + https://github.com/guzzle/guzzle/pull/1292 + + +## 6.1.0 - 2015-09-08 + +* Feature: Added the `on_stats` request option to provide access to transfer + statistics for requests. https://github.com/guzzle/guzzle/pull/1202 +* Feature: Added the ability to persist session cookies in CookieJars. + https://github.com/guzzle/guzzle/pull/1195 +* Feature: Some compatibility updates for Google APP Engine + https://github.com/guzzle/guzzle/pull/1216 +* Feature: Added support for NO_PROXY to prevent the use of a proxy based on + a simple set of rules. https://github.com/guzzle/guzzle/pull/1197 +* Feature: Cookies can now contain square brackets. + https://github.com/guzzle/guzzle/pull/1237 +* Bug fix: Now correctly parsing `=` inside of quotes in Cookies. + https://github.com/guzzle/guzzle/pull/1232 +* Bug fix: Cusotm cURL options now correctly override curl options of the + same name. https://github.com/guzzle/guzzle/pull/1221 +* Bug fix: Content-Type header is now added when using an explicitly provided + multipart body. https://github.com/guzzle/guzzle/pull/1218 +* Bug fix: Now ignoring Set-Cookie headers that have no name. +* Bug fix: Reason phrase is no longer cast to an int in some cases in the + cURL handler. https://github.com/guzzle/guzzle/pull/1187 +* Bug fix: Remove the Authorization header when redirecting if the Host + header changes. https://github.com/guzzle/guzzle/pull/1207 +* Bug fix: Cookie path matching fixes + https://github.com/guzzle/guzzle/issues/1129 +* Bug fix: Fixing the cURL `body_as_string` setting + https://github.com/guzzle/guzzle/pull/1201 +* Bug fix: quotes are no longer stripped when parsing cookies. + https://github.com/guzzle/guzzle/issues/1172 +* Bug fix: `form_params` and `query` now always uses the `&` separator. + https://github.com/guzzle/guzzle/pull/1163 +* Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set. + https://github.com/guzzle/guzzle/pull/1189 + + +## 6.0.2 - 2015-07-04 + +* Fixed a memory leak in the curl handlers in which references to callbacks + were not being removed by `curl_reset`. +* Cookies are now extracted properly before redirects. +* Cookies now allow more character ranges. +* Decoded Content-Encoding responses are now modified to correctly reflect + their state if the encoding was automatically removed by a handler. This + means that the `Content-Encoding` header may be removed an the + `Content-Length` modified to reflect the message size after removing the + encoding. +* Added a more explicit error message when trying to use `form_params` and + `multipart` in the same request. +* Several fixes for HHVM support. +* Functions are now conditionally required using an additional level of + indirection to help with global Composer installations. + + +## 6.0.1 - 2015-05-27 + +* Fixed a bug with serializing the `query` request option where the `&` + separator was missing. +* Added a better error message for when `body` is provided as an array. Please + use `form_params` or `multipart` instead. +* Various doc fixes. + + +## 6.0.0 - 2015-05-26 + +* See the UPGRADING.md document for more information. +* Added `multipart` and `form_params` request options. +* Added `synchronous` request option. +* Added the `on_headers` request option. +* Fixed `expect` handling. +* No longer adding default middlewares in the client ctor. These need to be + present on the provided handler in order to work. +* Requests are no longer initiated when sending async requests with the + CurlMultiHandler. This prevents unexpected recursion from requests completing + while ticking the cURL loop. +* Removed the semantics of setting `default` to `true`. This is no longer + required now that the cURL loop is not ticked for async requests. +* Added request and response logging middleware. +* No longer allowing self signed certificates when using the StreamHandler. +* Ensuring that `sink` is valid if saving to a file. +* Request exceptions now include a "handler context" which provides handler + specific contextual information. +* Added `GuzzleHttp\RequestOptions` to allow request options to be applied + using constants. +* `$maxHandles` has been removed from CurlMultiHandler. +* `MultipartPostBody` is now part of the `guzzlehttp/psr7` package. + + +## 5.3.0 - 2015-05-19 + +* Mock now supports `save_to` +* Marked `AbstractRequestEvent::getTransaction()` as public. +* Fixed a bug in which multiple headers using different casing would overwrite + previous headers in the associative array. +* Added `Utils::getDefaultHandler()` +* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated. +* URL scheme is now always lowercased. + + +## 6.0.0-beta.1 + +* Requires PHP >= 5.5 +* Updated to use PSR-7 + * Requires immutable messages, which basically means an event based system + owned by a request instance is no longer possible. + * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7). + * Removed the dependency on `guzzlehttp/streams`. These stream abstractions + are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7` + namespace. +* Added middleware and handler system + * Replaced the Guzzle event and subscriber system with a middleware system. + * No longer depends on RingPHP, but rather places the HTTP handlers directly + in Guzzle, operating on PSR-7 messages. + * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which + means the `guzzlehttp/retry-subscriber` is now obsolete. + * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`. +* Asynchronous responses + * No longer supports the `future` request option to send an async request. + Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`, + `getAsync`, etc.). + * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid + recursion required by chaining and forwarding react promises. See + https://github.com/guzzle/promises + * Added `requestAsync` and `sendAsync` to send request asynchronously. + * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests + asynchronously. +* Request options + * POST and form updates + * Added the `form_fields` and `form_files` request options. + * Removed the `GuzzleHttp\Post` namespace. + * The `body` request option no longer accepts an array for POST requests. + * The `exceptions` request option has been deprecated in favor of the + `http_errors` request options. + * The `save_to` request option has been deprecated in favor of `sink` request + option. +* Clients no longer accept an array of URI template string and variables for + URI variables. You will need to expand URI templates before passing them + into a client constructor or request method. +* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are + now magic methods that will send synchronous requests. +* Replaced `Utils.php` with plain functions in `functions.php`. +* Removed `GuzzleHttp\Collection`. +* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as + an array. +* Removed `GuzzleHttp\Query`. Query string handling is now handled using an + associative array passed into the `query` request option. The query string + is serialized using PHP's `http_build_query`. If you need more control, you + can pass the query string in as a string. +* `GuzzleHttp\QueryParser` has been replaced with the + `GuzzleHttp\Psr7\parse_query`. + + +## 5.2.0 - 2015-01-27 + +* Added `AppliesHeadersInterface` to make applying headers to a request based + on the body more generic and not specific to `PostBodyInterface`. +* Reduced the number of stack frames needed to send requests. +* Nested futures are now resolved in the client rather than the RequestFsm +* Finishing state transitions is now handled in the RequestFsm rather than the + RingBridge. +* Added a guard in the Pool class to not use recursion for request retries. + + +## 5.1.0 - 2014-12-19 + +* Pool class no longer uses recursion when a request is intercepted. +* The size of a Pool can now be dynamically adjusted using a callback. + See https://github.com/guzzle/guzzle/pull/943. +* Setting a request option to `null` when creating a request with a client will + ensure that the option is not set. This allows you to overwrite default + request options on a per-request basis. + See https://github.com/guzzle/guzzle/pull/937. +* Added the ability to limit which protocols are allowed for redirects by + specifying a `protocols` array in the `allow_redirects` request option. +* Nested futures due to retries are now resolved when waiting for synchronous + responses. See https://github.com/guzzle/guzzle/pull/947. +* `"0"` is now an allowed URI path. See + https://github.com/guzzle/guzzle/pull/935. +* `Query` no longer typehints on the `$query` argument in the constructor, + allowing for strings and arrays. +* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle + specific exceptions if necessary. + + +## 5.0.3 - 2014-11-03 + +This change updates query strings so that they are treated as un-encoded values +by default where the value represents an un-encoded value to send over the +wire. A Query object then encodes the value before sending over the wire. This +means that even value query string values (e.g., ":") are url encoded. This +makes the Query class match PHP's http_build_query function. However, if you +want to send requests over the wire using valid query string characters that do +not need to be encoded, then you can provide a string to Url::setQuery() and +pass true as the second argument to specify that the query string is a raw +string that should not be parsed or encoded (unless a call to getQuery() is +subsequently made, forcing the query-string to be converted into a Query +object). + + +## 5.0.2 - 2014-10-30 + +* Added a trailing `\r\n` to multipart/form-data payloads. See + https://github.com/guzzle/guzzle/pull/871 +* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs. +* Status codes are now returned as integers. See + https://github.com/guzzle/guzzle/issues/881 +* No longer overwriting an existing `application/x-www-form-urlencoded` header + when sending POST requests, allowing for customized headers. See + https://github.com/guzzle/guzzle/issues/877 +* Improved path URL serialization. + + * No longer double percent-encoding characters in the path or query string if + they are already encoded. + * Now properly encoding the supplied path to a URL object, instead of only + encoding ' ' and '?'. + * Note: This has been changed in 5.0.3 to now encode query string values by + default unless the `rawString` argument is provided when setting the query + string on a URL: Now allowing many more characters to be present in the + query string without being percent encoded. See + https://datatracker.ietf.org/doc/html/rfc3986#appendix-A + + +## 5.0.1 - 2014-10-16 + +Bugfix release. + +* Fixed an issue where connection errors still returned response object in + error and end events event though the response is unusable. This has been + corrected so that a response is not returned in the `getResponse` method of + these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867 +* Fixed an issue where transfer statistics were not being populated in the + RingBridge. https://github.com/guzzle/guzzle/issues/866 + + +## 5.0.0 - 2014-10-12 + +Adding support for non-blocking responses and some minor API cleanup. + +### New Features + +* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`. +* Added a public API for creating a default HTTP adapter. +* Updated the redirect plugin to be non-blocking so that redirects are sent + concurrently. Other plugins like this can now be updated to be non-blocking. +* Added a "progress" event so that you can get upload and download progress + events. +* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers + requests concurrently using a capped pool size as efficiently as possible. +* Added `hasListeners()` to EmitterInterface. +* Removed `GuzzleHttp\ClientInterface::sendAll` and marked + `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the + recommended way). + +### Breaking changes + +The breaking changes in this release are relatively minor. The biggest thing to +look out for is that request and response objects no longer implement fluent +interfaces. + +* Removed the fluent interfaces (i.e., `return $this`) from requests, + responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`, + `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and + `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of + why I did this: https://ocramius.github.io/blog/fluent-interfaces-are-evil/. + This also makes the Guzzle message interfaces compatible with the current + PSR-7 message proposal. +* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except + for the HTTP request functions from function.php, these functions are now + implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode` + moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to + `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to + `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be + `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php + caused problems for many users: they aren't PSR-4 compliant, require an + explicit include, and needed an if-guard to ensure that the functions are not + declared multiple times. +* Rewrote adapter layer. + * Removing all classes from `GuzzleHttp\Adapter`, these are now + implemented as callables that are stored in `GuzzleHttp\Ring\Client`. + * Removed the concept of "parallel adapters". Sending requests serially or + concurrently is now handled using a single adapter. + * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The + Transaction object now exposes the request, response, and client as public + properties. The getters and setters have been removed. +* Removed the "headers" event. This event was only useful for changing the + body a response once the headers of the response were known. You can implement + a similar behavior in a number of ways. One example might be to use a + FnStream that has access to the transaction being sent. For example, when the + first byte is written, you could check if the response headers match your + expectations, and if so, change the actual stream body that is being + written to. +* Removed the `asArray` parameter from + `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header + value as an array, then use the newly added `getHeaderAsArray()` method of + `MessageInterface`. This change makes the Guzzle interfaces compatible with + the PSR-7 interfaces. +* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add + custom request options using double-dispatch (this was an implementation + detail). Instead, you should now provide an associative array to the + constructor which is a mapping of the request option name mapping to a + function that applies the option value to a request. +* Removed the concept of "throwImmediately" from exceptions and error events. + This control mechanism was used to stop a transfer of concurrent requests + from completing. This can now be handled by throwing the exception or by + cancelling a pool of requests or each outstanding future request individually. +* Updated to "GuzzleHttp\Streams" 3.0. + * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a + `maxLen` parameter. This update makes the Guzzle streams project + compatible with the current PSR-7 proposal. + * `GuzzleHttp\Stream\Stream::__construct`, + `GuzzleHttp\Stream\Stream::factory`, and + `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second + argument. They now accept an associative array of options, including the + "size" key and "metadata" key which can be used to provide custom metadata. + + +## 4.2.2 - 2014-09-08 + +* Fixed a memory leak in the CurlAdapter when reusing cURL handles. +* No longer using `request_fulluri` in stream adapter proxies. +* Relative redirects are now based on the last response, not the first response. + +## 4.2.1 - 2014-08-19 + +* Ensuring that the StreamAdapter does not always add a Content-Type header +* Adding automated github releases with a phar and zip + +## 4.2.0 - 2014-08-17 + +* Now merging in default options using a case-insensitive comparison. + Closes https://github.com/guzzle/guzzle/issues/767 +* Added the ability to automatically decode `Content-Encoding` response bodies + using the `decode_content` request option. This is set to `true` by default + to decode the response body if it comes over the wire with a + `Content-Encoding`. Set this value to `false` to disable decoding the + response content, and pass a string to provide a request `Accept-Encoding` + header and turn on automatic response decoding. This feature now allows you + to pass an `Accept-Encoding` header in the headers of a request but still + disable automatic response decoding. + Closes https://github.com/guzzle/guzzle/issues/764 +* Added the ability to throw an exception immediately when transferring + requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760 +* Updating guzzlehttp/streams dependency to ~2.1 +* No longer utilizing the now deprecated namespaced methods from the stream + package. + +## 4.1.8 - 2014-08-14 + +* Fixed an issue in the CurlFactory that caused setting the `stream=false` + request option to throw an exception. + See: https://github.com/guzzle/guzzle/issues/769 +* TransactionIterator now calls rewind on the inner iterator. + See: https://github.com/guzzle/guzzle/pull/765 +* You can now set the `Content-Type` header to `multipart/form-data` + when creating POST requests to force multipart bodies. + See https://github.com/guzzle/guzzle/issues/768 + +## 4.1.7 - 2014-08-07 + +* Fixed an error in the HistoryPlugin that caused the same request and response + to be logged multiple times when an HTTP protocol error occurs. +* Ensuring that cURL does not add a default Content-Type when no Content-Type + has been supplied by the user. This prevents the adapter layer from modifying + the request that is sent over the wire after any listeners may have already + put the request in a desired state (e.g., signed the request). +* Throwing an exception when you attempt to send requests that have the + "stream" set to true in parallel using the MultiAdapter. +* Only calling curl_multi_select when there are active cURL handles. This was + previously changed and caused performance problems on some systems due to PHP + always selecting until the maximum select timeout. +* Fixed a bug where multipart/form-data POST fields were not correctly + aggregated (e.g., values with "&"). + +## 4.1.6 - 2014-08-03 + +* Added helper methods to make it easier to represent messages as strings, + including getting the start line and getting headers as a string. + +## 4.1.5 - 2014-08-02 + +* Automatically retrying cURL "Connection died, retrying a fresh connect" + errors when possible. +* cURL implementation cleanup +* Allowing multiple event subscriber listeners to be registered per event by + passing an array of arrays of listener configuration. + +## 4.1.4 - 2014-07-22 + +* Fixed a bug that caused multi-part POST requests with more than one field to + serialize incorrectly. +* Paths can now be set to "0" +* `ResponseInterface::xml` now accepts a `libxml_options` option and added a + missing default argument that was required when parsing XML response bodies. +* A `save_to` stream is now created lazily, which means that files are not + created on disk unless a request succeeds. + +## 4.1.3 - 2014-07-15 + +* Various fixes to multipart/form-data POST uploads +* Wrapping function.php in an if-statement to ensure Guzzle can be used + globally and in a Composer install +* Fixed an issue with generating and merging in events to an event array +* POST headers are only applied before sending a request to allow you to change + the query aggregator used before uploading +* Added much more robust query string parsing +* Fixed various parsing and normalization issues with URLs +* Fixing an issue where multi-valued headers were not being utilized correctly + in the StreamAdapter + +## 4.1.2 - 2014-06-18 + +* Added support for sending payloads with GET requests + +## 4.1.1 - 2014-06-08 + +* Fixed an issue related to using custom message factory options in subclasses +* Fixed an issue with nested form fields in a multi-part POST +* Fixed an issue with using the `json` request option for POST requests +* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar` + +## 4.1.0 - 2014-05-27 + +* Added a `json` request option to easily serialize JSON payloads. +* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON. +* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`. +* Added the ability to provide an emitter to a client in the client constructor. +* Added the ability to persist a cookie session using $_SESSION. +* Added a trait that can be used to add event listeners to an iterator. +* Removed request method constants from RequestInterface. +* Fixed warning when invalid request start-lines are received. +* Updated MessageFactory to work with custom request option methods. +* Updated cacert bundle to latest build. + +4.0.2 (2014-04-16) +------------------ + +* Proxy requests using the StreamAdapter now properly use request_fulluri (#632) +* Added the ability to set scalars as POST fields (#628) + +## 4.0.1 - 2014-04-04 + +* The HTTP status code of a response is now set as the exception code of + RequestException objects. +* 303 redirects will now correctly switch from POST to GET requests. +* The default parallel adapter of a client now correctly uses the MultiAdapter. +* HasDataTrait now initializes the internal data array as an empty array so + that the toArray() method always returns an array. + +## 4.0.0 - 2014-03-29 + +* For information on changes and upgrading, see: + https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 +* Added `GuzzleHttp\batch()` as a convenience function for sending requests in + parallel without needing to write asynchronous code. +* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`. + You can now pass a callable or an array of associative arrays where each + associative array contains the "fn", "priority", and "once" keys. + +## 4.0.0.rc-2 - 2014-03-25 + +* Removed `getConfig()` and `setConfig()` from clients to avoid confusion + around whether things like base_url, message_factory, etc. should be able to + be retrieved or modified. +* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface +* functions.php functions were renamed using snake_case to match PHP idioms +* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and + `GUZZLE_CURL_SELECT_TIMEOUT` environment variables +* Added the ability to specify custom `sendAll()` event priorities +* Added the ability to specify custom stream context options to the stream + adapter. +* Added a functions.php function for `get_path()` and `set_path()` +* CurlAdapter and MultiAdapter now use a callable to generate curl resources +* MockAdapter now properly reads a body and emits a `headers` event +* Updated Url class to check if a scheme and host are set before adding ":" + and "//". This allows empty Url (e.g., "") to be serialized as "". +* Parsing invalid XML no longer emits warnings +* Curl classes now properly throw AdapterExceptions +* Various performance optimizations +* Streams are created with the faster `Stream\create()` function +* Marked deprecation_proxy() as internal +* Test server is now a collection of static methods on a class + +## 4.0.0-rc.1 - 2014-03-15 + +* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 + +## 3.8.1 - 2014-01-28 + +* Bug: Always using GET requests when redirecting from a 303 response +* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in + `Guzzle\Http\ClientInterface::setSslVerification()` +* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL +* Bug: The body of a request can now be set to `"0"` +* Sending PHP stream requests no longer forces `HTTP/1.0` +* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of + each sub-exception +* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than + clobbering everything). +* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators) +* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`. + For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`. +* Now properly escaping the regular expression delimiter when matching Cookie domains. +* Network access is now disabled when loading XML documents + +## 3.8.0 - 2013-12-05 + +* Added the ability to define a POST name for a file +* JSON response parsing now properly walks additionalProperties +* cURL error code 18 is now retried automatically in the BackoffPlugin +* Fixed a cURL error when URLs contain fragments +* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were + CurlExceptions +* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e) +* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS` +* Fixed a bug that was encountered when parsing empty header parameters +* UriTemplate now has a `setRegex()` method to match the docs +* The `debug` request parameter now checks if it is truthy rather than if it exists +* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin +* Added the ability to combine URLs using strict RFC 3986 compliance +* Command objects can now return the validation errors encountered by the command +* Various fixes to cache revalidation (#437 and 29797e5) +* Various fixes to the AsyncPlugin +* Cleaned up build scripts + +## 3.7.4 - 2013-10-02 + +* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430) +* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp + (see https://github.com/aws/aws-sdk-php/issues/147) +* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots +* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420) +* Updated the bundled cacert.pem (#419) +* OauthPlugin now supports adding authentication to headers or query string (#425) + +## 3.7.3 - 2013-09-08 + +* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and + `CommandTransferException`. +* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description +* Schemas are only injected into response models when explicitly configured. +* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of + an EntityBody. +* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator. +* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`. +* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody() +* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin +* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests +* Bug fix: Properly parsing headers that contain commas contained in quotes +* Bug fix: mimetype guessing based on a filename is now case-insensitive + +## 3.7.2 - 2013-08-02 + +* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander + See https://github.com/guzzle/guzzle/issues/371 +* Bug fix: Cookie domains are now matched correctly according to RFC 6265 + See https://github.com/guzzle/guzzle/issues/377 +* Bug fix: GET parameters are now used when calculating an OAuth signature +* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted +* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched +* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input. + See https://github.com/guzzle/guzzle/issues/379 +* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See + https://github.com/guzzle/guzzle/pull/380 +* cURL multi cleanup and optimizations + +## 3.7.1 - 2013-07-05 + +* Bug fix: Setting default options on a client now works +* Bug fix: Setting options on HEAD requests now works. See #352 +* Bug fix: Moving stream factory before send event to before building the stream. See #353 +* Bug fix: Cookies no longer match on IP addresses per RFC 6265 +* Bug fix: Correctly parsing header parameters that are in `<>` and quotes +* Added `cert` and `ssl_key` as request options +* `Host` header can now diverge from the host part of a URL if the header is set manually +* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter +* OAuth parameters are only added via the plugin if they aren't already set +* Exceptions are now thrown when a URL cannot be parsed +* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails +* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin + +## 3.7.0 - 2013-06-10 + +* See UPGRADING.md for more information on how to upgrade. +* Requests now support the ability to specify an array of $options when creating a request to more easily modify a + request. You can pass a 'request.options' configuration setting to a client to apply default request options to + every request created by a client (e.g. default query string variables, headers, curl options, etc.). +* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`. + See `Guzzle\Http\StaticClient::mount`. +* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests + created by a command (e.g. custom headers, query string variables, timeout settings, etc.). +* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the + headers of a response +* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key + (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`) +* ServiceBuilders now support storing and retrieving arbitrary data +* CachePlugin can now purge all resources for a given URI +* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource +* CachePlugin now uses the Vary header to determine if a resource is a cache hit +* `Guzzle\Http\Message\Response` now implements `\Serializable` +* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters +* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable +* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()` +* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size +* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message +* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older + Symfony users can still use the old version of Monolog. +* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`. + Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`. +* Several performance improvements to `Guzzle\Common\Collection` +* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: + createRequest, head, delete, put, patch, post, options, prepareRequest +* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` +* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` +* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to + `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a + resource, string, or EntityBody into the $options parameter to specify the download location of the response. +* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a + default `array()` +* Added `Guzzle\Stream\StreamInterface::isRepeatable` +* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use + $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or + $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`. +* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`. +* Removed `Guzzle\Http\ClientInterface::expandTemplate()` +* Removed `Guzzle\Http\ClientInterface::setRequestFactory()` +* Removed `Guzzle\Http\ClientInterface::getCurlMulti()` +* Removed `Guzzle\Http\Message\RequestInterface::canCache` +* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect` +* Removed `Guzzle\Http\Message\RequestInterface::isRedirect` +* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. +* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting + `Guzzle\Common\Version::$emitWarnings` to true. +* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use + `$request->getResponseBody()->isRepeatable()` instead. +* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use + `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use + `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. +* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. +* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated +* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. + These will work through Guzzle 4.0 +* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params]. +* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. +* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`. +* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. +* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. +* Marked `Guzzle\Common\Collection::inject()` as deprecated. +* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');` +* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a + CacheStorageInterface. These two objects and interface will be removed in a future version. +* Always setting X-cache headers on cached responses +* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin +* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface + $request, Response $response);` +* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` +* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` +* Added `CacheStorageInterface::purge($url)` +* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin + $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, + CanCacheStrategyInterface $canCache = null)` +* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` + +## 3.6.0 - 2013-05-29 + +* ServiceDescription now implements ToArrayInterface +* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters +* Guzzle can now correctly parse incomplete URLs +* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. +* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution +* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). +* Specific header implementations can be created for complex headers. When a message creates a header, it uses a + HeaderFactory which can map specific headers to specific header classes. There is now a Link header and + CacheControl header implementation. +* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate +* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() +* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in + Guzzle\Http\Curl\RequestMediator +* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. +* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface +* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() +* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() +* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). +* All response header helper functions return a string rather than mixing Header objects and strings inconsistently +* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle + directly via interfaces +* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist + but are a no-op until removed. +* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a + `Guzzle\Service\Command\ArrayCommandInterface`. +* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response + on a request while the request is still being transferred +* The ability to case-insensitively search for header values +* Guzzle\Http\Message\Header::hasExactHeader +* Guzzle\Http\Message\Header::raw. Use getAll() +* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object + instead. +* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess +* Added the ability to cast Model objects to a string to view debug information. + +## 3.5.0 - 2013-05-13 + +* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times +* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove + itself from the EventDispatcher) +* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values +* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too +* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a + non-existent key +* Bug: All __call() method arguments are now required (helps with mocking frameworks) +* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference + to help with refcount based garbage collection of resources created by sending a request +* Deprecating ZF1 cache and log adapters. These will be removed in the next major version. +* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the + HistoryPlugin for a history. +* Added a `responseBody` alias for the `response_body` location +* Refactored internals to no longer rely on Response::getRequest() +* HistoryPlugin can now be cast to a string +* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests + and responses that are sent over the wire +* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects + +## 3.4.3 - 2013-04-30 + +* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response +* Added a check to re-extract the temp cacert bundle from the phar before sending each request + +## 3.4.2 - 2013-04-29 + +* Bug fix: Stream objects now work correctly with "a" and "a+" modes +* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present +* Bug fix: AsyncPlugin no longer forces HEAD requests +* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter +* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails +* Setting a response on a request will write to the custom request body from the response body if one is specified +* LogPlugin now writes to php://output when STDERR is undefined +* Added the ability to set multiple POST files for the same key in a single call +* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default +* Added the ability to queue CurlExceptions to the MockPlugin +* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send) +* Configuration loading now allows remote files + +## 3.4.1 - 2013-04-16 + +* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti + handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost. +* Exceptions are now properly grouped when sending requests in parallel +* Redirects are now properly aggregated when a multi transaction fails +* Redirects now set the response on the original object even in the event of a failure +* Bug fix: Model names are now properly set even when using $refs +* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax +* Added support for oauth_callback in OAuth signatures +* Added support for oauth_verifier in OAuth signatures +* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection + +## 3.4.0 - 2013-04-11 + +* Bug fix: URLs are now resolved correctly based on https://datatracker.ietf.org/doc/html/rfc3986#section-5.2. #289 +* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289 +* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263 +* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264. +* Bug fix: Added `number` type to service descriptions. +* Bug fix: empty parameters are removed from an OAuth signature +* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header +* Bug fix: Fixed "array to string" error when validating a union of types in a service description +* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream +* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin. +* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs. +* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections. +* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if + the Content-Type can be determined based on the entity body or the path of the request. +* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder. +* Added support for a PSR-3 LogAdapter. +* Added a `command.after_prepare` event +* Added `oauth_callback` parameter to the OauthPlugin +* Added the ability to create a custom stream class when using a stream factory +* Added a CachingEntityBody decorator +* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized. +* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar. +* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies +* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This + means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use + POST fields or files (the latter is only used when emulating a form POST in the browser). +* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest + +## 3.3.1 - 2013-03-10 + +* Added the ability to create PHP streaming responses from HTTP requests +* Bug fix: Running any filters when parsing response headers with service descriptions +* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing +* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across + response location visitors. +* Bug fix: Removed the possibility of creating configuration files with circular dependencies +* RequestFactory::create() now uses the key of a POST file when setting the POST file name +* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set + +## 3.3.0 - 2013-03-03 + +* A large number of performance optimizations have been made +* Bug fix: Added 'wb' as a valid write mode for streams +* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned +* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()` +* BC: Removed `Guzzle\Http\Utils` class +* BC: Setting a service description on a client will no longer modify the client's command factories. +* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using + the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' +* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to + lowercase +* Operation parameter objects are now lazy loaded internally +* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses +* Added support for instantiating responseType=class responseClass classes. Classes must implement + `Guzzle\Service\Command\ResponseClassInterface` +* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These + additional properties also support locations and can be used to parse JSON responses where the outermost part of the + JSON is an array +* Added support for nested renaming of JSON models (rename sentAs to name) +* CachePlugin + * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error + * Debug headers can now added to cached response in the CachePlugin + +## 3.2.0 - 2013-02-14 + +* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients. +* URLs with no path no longer contain a "/" by default +* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url. +* BadResponseException no longer includes the full request and response message +* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface +* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface +* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription +* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list +* xmlEncoding can now be customized for the XML declaration of a XML service description operation +* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value + aggregation and no longer uses callbacks +* The URL encoding implementation of Guzzle\Http\QueryString can now be customized +* Bug fix: Filters were not always invoked for array service description parameters +* Bug fix: Redirects now use a target response body rather than a temporary response body +* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded +* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives + +## 3.1.2 - 2013-01-27 + +* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the + response body. For example, the XmlVisitor now parses the XML response into an array in the before() method. +* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent +* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444) +* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse() +* Setting default headers on a client after setting the user-agent will not erase the user-agent setting + +## 3.1.1 - 2013-01-20 + +* Adding wildcard support to Guzzle\Common\Collection::getPath() +* Adding alias support to ServiceBuilder configs +* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface + +## 3.1.0 - 2013-01-12 + +* BC: CurlException now extends from RequestException rather than BadResponseException +* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse() +* Added getData to ServiceDescriptionInterface +* Added context array to RequestInterface::setState() +* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http +* Bug: Adding required content-type when JSON request visitor adds JSON to a command +* Bug: Fixing the serialization of a service description with custom data +* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing + an array of successful and failed responses +* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection +* Added Guzzle\Http\IoEmittingEntityBody +* Moved command filtration from validators to location visitors +* Added `extends` attributes to service description parameters +* Added getModels to ServiceDescriptionInterface + +## 3.0.7 - 2012-12-19 + +* Fixing phar detection when forcing a cacert to system if null or true +* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()` +* Cleaning up `Guzzle\Common\Collection::inject` method +* Adding a response_body location to service descriptions + +## 3.0.6 - 2012-12-09 + +* CurlMulti performance improvements +* Adding setErrorResponses() to Operation +* composer.json tweaks + +## 3.0.5 - 2012-11-18 + +* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin +* Bug: Response body can now be a string containing "0" +* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert +* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs +* Added support for XML attributes in service description responses +* DefaultRequestSerializer now supports array URI parameter values for URI template expansion +* Added better mimetype guessing to requests and post files + +## 3.0.4 - 2012-11-11 + +* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value +* Bug: Cookies can now be added that have a name, domain, or value set to "0" +* Bug: Using the system cacert bundle when using the Phar +* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures +* Enhanced cookie jar de-duplication +* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added +* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies +* Added the ability to create any sort of hash for a stream rather than just an MD5 hash + +## 3.0.3 - 2012-11-04 + +* Implementing redirects in PHP rather than cURL +* Added PECL URI template extension and using as default parser if available +* Bug: Fixed Content-Length parsing of Response factory +* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams. +* Adding ToArrayInterface throughout library +* Fixing OauthPlugin to create unique nonce values per request + +## 3.0.2 - 2012-10-25 + +* Magic methods are enabled by default on clients +* Magic methods return the result of a command +* Service clients no longer require a base_url option in the factory +* Bug: Fixed an issue with URI templates where null template variables were being expanded + +## 3.0.1 - 2012-10-22 + +* Models can now be used like regular collection objects by calling filter, map, etc. +* Models no longer require a Parameter structure or initial data in the constructor +* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator` + +## 3.0.0 - 2012-10-15 + +* Rewrote service description format to be based on Swagger + * Now based on JSON schema + * Added nested input structures and nested response models + * Support for JSON and XML input and output models + * Renamed `commands` to `operations` + * Removed dot class notation + * Removed custom types +* Broke the project into smaller top-level namespaces to be more component friendly +* Removed support for XML configs and descriptions. Use arrays or JSON files. +* Removed the Validation component and Inspector +* Moved all cookie code to Guzzle\Plugin\Cookie +* Magic methods on a Guzzle\Service\Client now return the command un-executed. +* Calling getResult() or getResponse() on a command will lazily execute the command if needed. +* Now shipping with cURL's CA certs and using it by default +* Added previousResponse() method to response objects +* No longer sending Accept and Accept-Encoding headers on every request +* Only sending an Expect header by default when a payload is greater than 1MB +* Added/moved client options: + * curl.blacklist to curl.option.blacklist + * Added ssl.certificate_authority +* Added a Guzzle\Iterator component +* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin +* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin) +* Added a more robust caching plugin +* Added setBody to response objects +* Updating LogPlugin to use a more flexible MessageFormatter +* Added a completely revamped build process +* Cleaning up Collection class and removing default values from the get method +* Fixed ZF2 cache adapters + +## 2.8.8 - 2012-10-15 + +* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did + +## 2.8.7 - 2012-09-30 + +* Bug: Fixed config file aliases for JSON includes +* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests +* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload +* Bug: Hardening request and response parsing to account for missing parts +* Bug: Fixed PEAR packaging +* Bug: Fixed Request::getInfo +* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail +* Adding the ability for the namespace Iterator factory to look in multiple directories +* Added more getters/setters/removers from service descriptions +* Added the ability to remove POST fields from OAuth signatures +* OAuth plugin now supports 2-legged OAuth + +## 2.8.6 - 2012-09-05 + +* Added the ability to modify and build service descriptions +* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command +* Added a `json` parameter location +* Now allowing dot notation for classes in the CacheAdapterFactory +* Using the union of two arrays rather than an array_merge when extending service builder services and service params +* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references + in service builder config files. +* Services defined in two different config files that include one another will by default replace the previously + defined service, but you can now create services that extend themselves and merge their settings over the previous +* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like + '_default' with a default JSON configuration file. + +## 2.8.5 - 2012-08-29 + +* Bug: Suppressed empty arrays from URI templates +* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching +* Added support for HTTP responses that do not contain a reason phrase in the start-line +* AbstractCommand commands are now invokable +* Added a way to get the data used when signing an Oauth request before a request is sent + +## 2.8.4 - 2012-08-15 + +* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin +* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable. +* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream +* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream +* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5()) +* Added additional response status codes +* Removed SSL information from the default User-Agent header +* DELETE requests can now send an entity body +* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries +* Added the ability of the MockPlugin to consume mocked request bodies +* LogPlugin now exposes request and response objects in the extras array + +## 2.8.3 - 2012-07-30 + +* Bug: Fixed a case where empty POST requests were sent as GET requests +* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body +* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new +* Added multiple inheritance to service description commands +* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()` +* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything +* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles + +## 2.8.2 - 2012-07-24 + +* Bug: Query string values set to 0 are no longer dropped from the query string +* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()` +* Bug: `+` is now treated as an encoded space when parsing query strings +* QueryString and Collection performance improvements +* Allowing dot notation for class paths in filters attribute of a service descriptions + +## 2.8.1 - 2012-07-16 + +* Loosening Event Dispatcher dependency +* POST redirects can now be customized using CURLOPT_POSTREDIR + +## 2.8.0 - 2012-07-15 + +* BC: Guzzle\Http\Query + * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl) + * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding() + * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool) + * Changed the aggregation functions of QueryString to be static methods + * Can now use fromString() with querystrings that have a leading ? +* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters +* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body +* Cookies are no longer URL decoded by default +* Bug: URI template variables set to null are no longer expanded + +## 2.7.2 - 2012-07-02 + +* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser. +* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty() +* CachePlugin now allows for a custom request parameter function to check if a request can be cached +* Bug fix: CachePlugin now only caches GET and HEAD requests by default +* Bug fix: Using header glue when transferring headers over the wire +* Allowing deeply nested arrays for composite variables in URI templates +* Batch divisors can now return iterators or arrays + +## 2.7.1 - 2012-06-26 + +* Minor patch to update version number in UA string +* Updating build process + +## 2.7.0 - 2012-06-25 + +* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes. +* BC: Removed magic setX methods from commands +* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method +* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable. +* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity) +* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace +* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin +* Added the ability to set POST fields and files in a service description +* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method +* Adding a command.before_prepare event to clients +* Added BatchClosureTransfer and BatchClosureDivisor +* BatchTransferException now includes references to the batch divisor and transfer strategies +* Fixed some tests so that they pass more reliably +* Added Guzzle\Common\Log\ArrayLogAdapter + +## 2.6.6 - 2012-06-10 + +* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin +* BC: Removing Guzzle\Service\Command\CommandSet +* Adding generic batching system (replaces the batch queue plugin and command set) +* Updating ZF cache and log adapters and now using ZF's composer repository +* Bug: Setting the name of each ApiParam when creating through an ApiCommand +* Adding result_type, result_doc, deprecated, and doc_url to service descriptions +* Bug: Changed the default cookie header casing back to 'Cookie' + +## 2.6.5 - 2012-06-03 + +* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource() +* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from +* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data +* BC: Renaming methods in the CookieJarInterface +* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations +* Making the default glue for HTTP headers ';' instead of ',' +* Adding a removeValue to Guzzle\Http\Message\Header +* Adding getCookies() to request interface. +* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber() + +## 2.6.4 - 2012-05-30 + +* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class. +* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand +* Bug: Fixing magic method command calls on clients +* Bug: Email constraint only validates strings +* Bug: Aggregate POST fields when POST files are present in curl handle +* Bug: Fixing default User-Agent header +* Bug: Only appending or prepending parameters in commands if they are specified +* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes +* Allowing the use of dot notation for class namespaces when using instance_of constraint +* Added any_match validation constraint +* Added an AsyncPlugin +* Passing request object to the calculateWait method of the ExponentialBackoffPlugin +* Allowing the result of a command object to be changed +* Parsing location and type sub values when instantiating a service description rather than over and over at runtime + +## 2.6.3 - 2012-05-23 + +* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options. +* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields. +* You can now use an array of data when creating PUT request bodies in the request factory. +* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable. +* [Http] Adding support for Content-Type in multipart POST uploads per upload +* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1]) +* Adding more POST data operations for easier manipulation of POST data. +* You can now set empty POST fields. +* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files. +* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate. +* CS updates + +## 2.6.2 - 2012-05-19 + +* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method. + +## 2.6.1 - 2012-05-19 + +* [BC] Removing 'path' support in service descriptions. Use 'uri'. +* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache. +* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it. +* [BC] Removing Guzzle\Common\XmlElement. +* All commands, both dynamic and concrete, have ApiCommand objects. +* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits. +* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored. +* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible. + +## 2.6.0 - 2012-05-15 + +* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder +* [BC] Executing a Command returns the result of the command rather than the command +* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed. +* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args. +* [BC] Moving ResourceIterator* to Guzzle\Service\Resource +* [BC] Completely refactored ResourceIterators to iterate over a cloned command object +* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate +* [BC] Guzzle\Guzzle is now deprecated +* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject +* Adding Guzzle\Version class to give version information about Guzzle +* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate() +* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data +* ServiceDescription and ServiceBuilder are now cacheable using similar configs +* Changing the format of XML and JSON service builder configs. Backwards compatible. +* Cleaned up Cookie parsing +* Trimming the default Guzzle User-Agent header +* Adding a setOnComplete() method to Commands that is called when a command completes +* Keeping track of requests that were mocked in the MockPlugin +* Fixed a caching bug in the CacheAdapterFactory +* Inspector objects can be injected into a Command object +* Refactoring a lot of code and tests to be case insensitive when dealing with headers +* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL +* Adding the ability to set global option overrides to service builder configs +* Adding the ability to include other service builder config files from within XML and JSON files +* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method. + +## 2.5.0 - 2012-05-08 + +* Major performance improvements +* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated. +* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component. +* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}" +* Added the ability to passed parameters to all requests created by a client +* Added callback functionality to the ExponentialBackoffPlugin +* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies. +* Rewinding request stream bodies when retrying requests +* Exception is thrown when JSON response body cannot be decoded +* Added configurable magic method calls to clients and commands. This is off by default. +* Fixed a defect that added a hash to every parsed URL part +* Fixed duplicate none generation for OauthPlugin. +* Emitting an event each time a client is generated by a ServiceBuilder +* Using an ApiParams object instead of a Collection for parameters of an ApiCommand +* cache.* request parameters should be renamed to params.cache.* +* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle. +* Added the ability to disable type validation of service descriptions +* ServiceDescriptions and ServiceBuilders are now Serializable diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Dockerfile b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Dockerfile new file mode 100644 index 0000000000..bb651d0fe7 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Dockerfile @@ -0,0 +1,14 @@ +FROM composer:latest as setup + +WORKDIR /guzzle + +RUN set -xe \ + && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár " --no-interaction \ + && composer require guzzlehttp/guzzle + + +FROM php:7.3 + +WORKDIR /guzzle + +COPY --from=setup /guzzle /guzzle diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/LICENSE b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/LICENSE new file mode 100644 index 0000000000..fd2375d888 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/LICENSE @@ -0,0 +1,27 @@ +The MIT License (MIT) + +Copyright (c) 2011 Michael Dowling +Copyright (c) 2012 Jeremy Lindblom +Copyright (c) 2014 Graham Campbell +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Tobias Schultze +Copyright (c) 2016 Tobias Nyholm +Copyright (c) 2016 George Mponos + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Makefile b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Makefile new file mode 100644 index 0000000000..0b52841fdb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/Makefile @@ -0,0 +1,85 @@ +help: + @echo "Please use \`make ' where is one of" + @echo " start-server to start the test server" + @echo " stop-server to stop the test server" + @echo " test to perform unit tests. Provide TEST to perform a specific test." + @echo " coverage to perform unit tests with code coverage. Provide TEST to perform a specific test." + @echo " coverage-show to show the code coverage report" + @echo " clean to remove build artifacts" + @echo " docs to build the Sphinx docs" + @echo " docs-show to view the Sphinx docs" + @echo " static to run phpstan and php-cs-fixer on the codebase" + @echo " static-phpstan to run phpstan on the codebase" + @echo " static-phpstan-update-baseline to regenerate the phpstan baseline file" + @echo " static-codestyle-fix to run php-cs-fixer on the codebase, writing the changes" + @echo " static-codestyle-check to run php-cs-fixer on the codebase" + +start-server: stop-server + node tests/server.js &> /dev/null & + ./vendor/bin/http_test_server &> /dev/null & + +stop-server: + @PID=$(shell ps axo pid,command \ + | grep 'tests/server.js' \ + | grep -v grep \ + | cut -f 1 -d " "\ + ) && [ -n "$$PID" ] && kill $$PID || true + @PID=$(shell ps axo pid,command \ + | grep 'vendor/bin/http_test_server' \ + | grep -v grep \ + | cut -f 1 -d " "\ + ) && [ -n "$$PID" ] && kill $$PID || true + +test: start-server + vendor/bin/phpunit + $(MAKE) stop-server + +coverage: start-server + vendor/bin/phpunit --coverage-html=build/artifacts/coverage + $(MAKE) stop-server + +coverage-show: view-coverage + +view-coverage: + open build/artifacts/coverage/index.html + +clean: + rm -rf artifacts/* + +docs: + cd docs && make html && cd .. + +docs-show: + open docs/_build/html/index.html + +static: static-phpstan static-psalm static-codestyle-check + +static-psalm: + composer install + composer bin psalm update + vendor/bin/psalm.phar $(PSALM_PARAMS) + +static-psalm-update-baseline: + composer install + composer bin psalm update + $(MAKE) static-psalm PSALM_PARAMS="--set-baseline=psalm-baseline.xml" + +static-phpstan: + composer install + composer bin phpstan update + vendor/bin/phpstan analyze $(PHPSTAN_PARAMS) + +static-phpstan-update-baseline: + composer install + composer bin phpstan update + $(MAKE) static-phpstan PHPSTAN_PARAMS="--generate-baseline" + +static-codestyle-fix: + composer install + composer bin php-cs-fixer update + vendor/bin/php-cs-fixer fix --diff $(CS_PARAMS) + +static-codestyle-check: + $(MAKE) static-codestyle-fix CS_PARAMS="--dry-run" + +.PHONY: docs coverage-show view-coverage diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/README.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/README.md new file mode 100644 index 0000000000..cdaebee3ff --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/README.md @@ -0,0 +1,94 @@ +![Guzzle](.github/logo.png?raw=true) + +# Guzzle, PHP HTTP client + +[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases) +[![Build Status](https://img.shields.io/github/actions/workflow/status/guzzle/guzzle/ci.yml?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI) +[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle) + +Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and +trivial to integrate with web services. + +- Simple interface for building query strings, POST requests, streaming large + uploads, streaming large downloads, using HTTP cookies, uploading JSON data, + etc... +- Can send both synchronous and asynchronous requests using the same interface. +- Uses PSR-7 interfaces for requests, responses, and streams. This allows you + to utilize other PSR-7 compatible libraries with Guzzle. +- Supports PSR-18 allowing interoperability between other PSR-18 HTTP Clients. +- Abstracts away the underlying HTTP transport, allowing you to write + environment and transport agnostic code; i.e., no hard dependency on cURL, + PHP streams, sockets, or non-blocking event loops. +- Middleware system allows you to augment and compose client behavior. + +```php +$client = new \GuzzleHttp\Client(); +$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); + +echo $response->getStatusCode(); // 200 +echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8' +echo $response->getBody(); // '{"id": 1420053, "name": "guzzle", ...}' + +// Send an asynchronous request. +$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); +$promise = $client->sendAsync($request)->then(function ($response) { + echo 'I completed! ' . $response->getBody(); +}); + +$promise->wait(); +``` + +## Help and docs + +We use GitHub issues only to discuss bugs and new features. For support please refer to: + +- [Documentation](https://docs.guzzlephp.org) +- [Stack Overflow](https://stackoverflow.com/questions/tagged/guzzle) +- [#guzzle](https://app.slack.com/client/T0D2S9JCT/CE6UAAKL4) channel on [PHP-HTTP Slack](https://slack.httplug.io/) +- [Gitter](https://gitter.im/guzzle/guzzle) + + +## Installing Guzzle + +The recommended way to install Guzzle is through +[Composer](https://getcomposer.org/). + +```bash +composer require guzzlehttp/guzzle +``` + + +## Version Guidance + +| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version | +|---------|---------------------|---------------------|--------------|---------------------|---------------------|-------|--------------| +| 3.x | EOL (2016-10-31) | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >=5.3.3,<7.0 | +| 4.x | EOL (2016-10-31) | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >=5.4,<7.0 | +| 5.x | EOL (2019-10-31) | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >=5.4,<7.4 | +| 6.x | EOL (2023-10-31) | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >=5.5,<8.0 | +| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >=7.2.5,<8.5 | + +[guzzle-3-repo]: https://github.com/guzzle/guzzle3 +[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x +[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3 +[guzzle-6-repo]: https://github.com/guzzle/guzzle/tree/6.5 +[guzzle-7-repo]: https://github.com/guzzle/guzzle +[guzzle-3-docs]: https://guzzle3.readthedocs.io/ +[guzzle-5-docs]: https://docs.guzzlephp.org/en/5.3/ +[guzzle-6-docs]: https://docs.guzzlephp.org/en/6.5/ +[guzzle-7-docs]: https://docs.guzzlephp.org/en/latest/ + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/guzzle/security/policy) for more information. + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-guzzle?utm_source=packagist-guzzlehttp-guzzle&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/UPGRADING.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/UPGRADING.md new file mode 100644 index 0000000000..4efbb5962e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/UPGRADING.md @@ -0,0 +1,1253 @@ +Guzzle Upgrade Guide +==================== + +6.0 to 7.0 +---------- + +In order to take advantage of the new features of PHP, Guzzle dropped the support +of PHP 5. The minimum supported PHP version is now PHP 7.2. Type hints and return +types for functions and methods have been added wherever possible. + +Please make sure: +- You are calling a function or a method with the correct type. +- If you extend a class of Guzzle; update all signatures on methods you override. + +#### Other backwards compatibility breaking changes + +- Class `GuzzleHttp\UriTemplate` is removed. +- Class `GuzzleHttp\Exception\SeekException` is removed. +- Classes `GuzzleHttp\Exception\BadResponseException`, `GuzzleHttp\Exception\ClientException`, + `GuzzleHttp\Exception\ServerException` can no longer be initialized with an empty + Response as argument. +- Class `GuzzleHttp\Exception\ConnectException` now extends `GuzzleHttp\Exception\TransferException` + instead of `GuzzleHttp\Exception\RequestException`. +- Function `GuzzleHttp\Exception\ConnectException::getResponse()` is removed. +- Function `GuzzleHttp\Exception\ConnectException::hasResponse()` is removed. +- Constant `GuzzleHttp\ClientInterface::VERSION` is removed. Added `GuzzleHttp\ClientInterface::MAJOR_VERSION` instead. +- Function `GuzzleHttp\Exception\RequestException::getResponseBodySummary` is removed. + Use `\GuzzleHttp\Psr7\get_message_body_summary` as an alternative. +- Function `GuzzleHttp\Cookie\CookieJar::getCookieValue` is removed. +- Request option `exceptions` is removed. Please use `http_errors`. +- Request option `save_to` is removed. Please use `sink`. +- Pool option `pool_size` is removed. Please use `concurrency`. +- We now look for environment variables in the `$_SERVER` super global, due to thread safety issues with `getenv`. We continue to fallback to `getenv` in CLI environments, for maximum compatibility. +- The `get`, `head`, `put`, `post`, `patch`, `delete`, `getAsync`, `headAsync`, `putAsync`, `postAsync`, `patchAsync`, and `deleteAsync` methods are now implemented as genuine methods on `GuzzleHttp\Client`, with strong typing. The original `__call` implementation remains unchanged for now, for maximum backwards compatibility, but won't be invoked under normal operation. +- The `log` middleware will log the errors with level `error` instead of `notice` +- Support for international domain names (IDN) is now disabled by default, and enabling it requires installing ext-intl, linked against a modern version of the C library (ICU 4.6 or higher). + +#### Native functions calls + +All internal native functions calls of Guzzle are now prefixed with a slash. This +change makes it impossible for method overloading by other libraries or applications. +Example: + +```php +// Before: +curl_version(); + +// After: +\curl_version(); +``` + +For the full diff you can check [here](https://github.com/guzzle/guzzle/compare/6.5.4..master). + +5.0 to 6.0 +---------- + +Guzzle now uses [PSR-7](https://www.php-fig.org/psr/psr-7/) for HTTP messages. +Due to the fact that these messages are immutable, this prompted a refactoring +of Guzzle to use a middleware based system rather than an event system. Any +HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be +updated to work with the new immutable PSR-7 request and response objects. Any +event listeners or subscribers need to be updated to become middleware +functions that wrap handlers (or are injected into a +`GuzzleHttp\HandlerStack`). + +- Removed `GuzzleHttp\BatchResults` +- Removed `GuzzleHttp\Collection` +- Removed `GuzzleHttp\HasDataTrait` +- Removed `GuzzleHttp\ToArrayInterface` +- The `guzzlehttp/streams` dependency has been removed. Stream functionality + is now present in the `GuzzleHttp\Psr7` namespace provided by the + `guzzlehttp/psr7` package. +- Guzzle no longer uses ReactPHP promises and now uses the + `guzzlehttp/promises` library. We use a custom promise library for three + significant reasons: + 1. React promises (at the time of writing this) are recursive. Promise + chaining and promise resolution will eventually blow the stack. Guzzle + promises are not recursive as they use a sort of trampolining technique. + Note: there has been movement in the React project to modify promises to + no longer utilize recursion. + 2. Guzzle needs to have the ability to synchronously block on a promise to + wait for a result. Guzzle promises allows this functionality (and does + not require the use of recursion). + 3. Because we need to be able to wait on a result, doing so using React + promises requires wrapping react promises with RingPHP futures. This + overhead is no longer needed, reducing stack sizes, reducing complexity, + and improving performance. +- `GuzzleHttp\Mimetypes` has been moved to a function in + `GuzzleHttp\Psr7\mimetype_from_extension` and + `GuzzleHttp\Psr7\mimetype_from_filename`. +- `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query + strings must now be passed into request objects as strings, or provided to + the `query` request option when creating requests with clients. The `query` + option uses PHP's `http_build_query` to convert an array to a string. If you + need a different serialization technique, you will need to pass the query + string in as a string. There are a couple helper functions that will make + working with query strings easier: `GuzzleHttp\Psr7\parse_query` and + `GuzzleHttp\Psr7\build_query`. +- Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware + system based on PSR-7, using RingPHP and it's middleware system as well adds + more complexity than the benefits it provides. All HTTP handlers that were + present in RingPHP have been modified to work directly with PSR-7 messages + and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces + complexity in Guzzle, removes a dependency, and improves performance. RingPHP + will be maintained for Guzzle 5 support, but will no longer be a part of + Guzzle 6. +- As Guzzle now uses a middleware based systems the event system and RingPHP + integration has been removed. Note: while the event system has been removed, + it is possible to add your own type of event system that is powered by the + middleware system. + - Removed the `Event` namespace. + - Removed the `Subscriber` namespace. + - Removed `Transaction` class + - Removed `RequestFsm` + - Removed `RingBridge` + - `GuzzleHttp\Subscriber\Cookie` is now provided by + `GuzzleHttp\Middleware::cookies` + - `GuzzleHttp\Subscriber\HttpError` is now provided by + `GuzzleHttp\Middleware::httpError` + - `GuzzleHttp\Subscriber\History` is now provided by + `GuzzleHttp\Middleware::history` + - `GuzzleHttp\Subscriber\Mock` is now provided by + `GuzzleHttp\Handler\MockHandler` + - `GuzzleHttp\Subscriber\Prepare` is now provided by + `GuzzleHttp\PrepareBodyMiddleware` + - `GuzzleHttp\Subscriber\Redirect` is now provided by + `GuzzleHttp\RedirectMiddleware` +- Guzzle now uses `Psr\Http\Message\UriInterface` (implements in + `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone. +- Static functions in `GuzzleHttp\Utils` have been moved to namespaced + functions under the `GuzzleHttp` namespace. This requires either a Composer + based autoloader or you to include functions.php. +- `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to + `GuzzleHttp\ClientInterface::getConfig`. +- `GuzzleHttp\ClientInterface::setDefaultOption` has been removed. +- The `json` and `xml` methods of response objects has been removed. With the + migration to strictly adhering to PSR-7 as the interface for Guzzle messages, + adding methods to message interfaces would actually require Guzzle messages + to extend from PSR-7 messages rather then work with them directly. + +## Migrating to middleware + +The change to PSR-7 unfortunately required significant refactoring to Guzzle +due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event +system from plugins. The event system relied on mutability of HTTP messages and +side effects in order to work. With immutable messages, you have to change your +workflow to become more about either returning a value (e.g., functional +middlewares) or setting a value on an object. Guzzle v6 has chosen the +functional middleware approach. + +Instead of using the event system to listen for things like the `before` event, +you now create a stack based middleware function that intercepts a request on +the way in and the promise of the response on the way out. This is a much +simpler and more predictable approach than the event system and works nicely +with PSR-7 middleware. Due to the use of promises, the middleware system is +also asynchronous. + +v5: + +```php +use GuzzleHttp\Event\BeforeEvent; +$client = new GuzzleHttp\Client(); +// Get the emitter and listen to the before event. +$client->getEmitter()->on('before', function (BeforeEvent $e) { + // Guzzle v5 events relied on mutation + $e->getRequest()->setHeader('X-Foo', 'Bar'); +}); +``` + +v6: + +In v6, you can modify the request before it is sent using the `mapRequest` +middleware. The idiomatic way in v6 to modify the request/response lifecycle is +to setup a handler middleware stack up front and inject the handler into a +client. + +```php +use GuzzleHttp\Middleware; +// Create a handler stack that has all of the default middlewares attached +$handler = GuzzleHttp\HandlerStack::create(); +// Push the handler onto the handler stack +$handler->push(Middleware::mapRequest(function (RequestInterface $request) { + // Notice that we have to return a request object + return $request->withHeader('X-Foo', 'Bar'); +})); +// Inject the handler into the client +$client = new GuzzleHttp\Client(['handler' => $handler]); +``` + +## POST Requests + +This version added the [`form_params`](https://docs.guzzlephp.org/en/latest/request-options.html#form_params) +and `multipart` request options. `form_params` is an associative array of +strings or array of strings and is used to serialize an +`application/x-www-form-urlencoded` POST request. The +[`multipart`](https://docs.guzzlephp.org/en/latest/request-options.html#multipart) +option is now used to send a multipart/form-data POST request. + +`GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add +POST files to a multipart/form-data request. + +The `body` option no longer accepts an array to send POST requests. Please use +`multipart` or `form_params` instead. + +The `base_url` option has been renamed to `base_uri`. + +4.x to 5.0 +---------- + +## Rewritten Adapter Layer + +Guzzle now uses [RingPHP](https://ringphp.readthedocs.org/en/latest) to send +HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor +is still supported, but it has now been renamed to `handler`. Instead of +passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP +`callable` that follows the RingPHP specification. + +## Removed Fluent Interfaces + +[Fluent interfaces were removed](https://ocramius.github.io/blog/fluent-interfaces-are-evil/) +from the following classes: + +- `GuzzleHttp\Collection` +- `GuzzleHttp\Url` +- `GuzzleHttp\Query` +- `GuzzleHttp\Post\PostBody` +- `GuzzleHttp\Cookie\SetCookie` + +## Removed functions.php + +Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following +functions can be used as replacements. + +- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode` +- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath` +- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path` +- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however, + deprecated in favor of using `GuzzleHttp\Pool::batch()`. + +The "procedural" global client has been removed with no replacement (e.g., +`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client` +object as a replacement. + +## `throwImmediately` has been removed + +The concept of "throwImmediately" has been removed from exceptions and error +events. This control mechanism was used to stop a transfer of concurrent +requests from completing. This can now be handled by throwing the exception or +by cancelling a pool of requests or each outstanding future request +individually. + +## headers event has been removed + +Removed the "headers" event. This event was only useful for changing the +body a response once the headers of the response were known. You can implement +a similar behavior in a number of ways. One example might be to use a +FnStream that has access to the transaction being sent. For example, when the +first byte is written, you could check if the response headers match your +expectations, and if so, change the actual stream body that is being +written to. + +## Updates to HTTP Messages + +Removed the `asArray` parameter from +`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header +value as an array, then use the newly added `getHeaderAsArray()` method of +`MessageInterface`. This change makes the Guzzle interfaces compatible with +the PSR-7 interfaces. + +3.x to 4.0 +---------- + +## Overarching changes: + +- Now requires PHP 5.4 or greater. +- No longer requires cURL to send requests. +- Guzzle no longer wraps every exception it throws. Only exceptions that are + recoverable are now wrapped by Guzzle. +- Various namespaces have been removed or renamed. +- No longer requiring the Symfony EventDispatcher. A custom event dispatcher + based on the Symfony EventDispatcher is + now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant + speed and functionality improvements). + +Changes per Guzzle 3.x namespace are described below. + +## Batch + +The `Guzzle\Batch` namespace has been removed. This is best left to +third-parties to implement on top of Guzzle's core HTTP library. + +## Cache + +The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement +has been implemented yet, but hoping to utilize a PSR cache interface). + +## Common + +- Removed all of the wrapped exceptions. It's better to use the standard PHP + library for unrecoverable exceptions. +- `FromConfigInterface` has been removed. +- `Guzzle\Common\Version` has been removed. The VERSION constant can be found + at `GuzzleHttp\ClientInterface::VERSION`. + +### Collection + +- `getAll` has been removed. Use `toArray` to convert a collection to an array. +- `inject` has been removed. +- `keySearch` has been removed. +- `getPath` no longer supports wildcard expressions. Use something better like + JMESPath for this. +- `setPath` now supports appending to an existing array via the `[]` notation. + +### Events + +Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses +`GuzzleHttp\Event\Emitter`. + +- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by + `GuzzleHttp\Event\EmitterInterface`. +- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by + `GuzzleHttp\Event\Emitter`. +- `Symfony\Component\EventDispatcher\Event` is replaced by + `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in + `GuzzleHttp\Event\EventInterface`. +- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and + `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the + event emitter of a request, client, etc. now uses the `getEmitter` method + rather than the `getDispatcher` method. + +#### Emitter + +- Use the `once()` method to add a listener that automatically removes itself + the first time it is invoked. +- Use the `listeners()` method to retrieve a list of event listeners rather than + the `getListeners()` method. +- Use `emit()` instead of `dispatch()` to emit an event from an emitter. +- Use `attach()` instead of `addSubscriber()` and `detach()` instead of + `removeSubscriber()`. + +```php +$mock = new Mock(); +// 3.x +$request->getEventDispatcher()->addSubscriber($mock); +$request->getEventDispatcher()->removeSubscriber($mock); +// 4.x +$request->getEmitter()->attach($mock); +$request->getEmitter()->detach($mock); +``` + +Use the `on()` method to add a listener rather than the `addListener()` method. + +```php +// 3.x +$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } ); +// 4.x +$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } ); +``` + +## Http + +### General changes + +- The cacert.pem certificate has been moved to `src/cacert.pem`. +- Added the concept of adapters that are used to transfer requests over the + wire. +- Simplified the event system. +- Sending requests in parallel is still possible, but batching is no longer a + concept of the HTTP layer. Instead, you must use the `complete` and `error` + events to asynchronously manage parallel request transfers. +- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`. +- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`. +- QueryAggregators have been rewritten so that they are simply callable + functions. +- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in + `functions.php` for an easy to use static client instance. +- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from + `GuzzleHttp\Exception\TransferException`. + +### Client + +Calling methods like `get()`, `post()`, `head()`, etc. no longer create and +return a request, but rather creates a request, sends the request, and returns +the response. + +```php +// 3.0 +$request = $client->get('/'); +$response = $request->send(); + +// 4.0 +$response = $client->get('/'); + +// or, to mirror the previous behavior +$request = $client->createRequest('GET', '/'); +$response = $client->send($request); +``` + +`GuzzleHttp\ClientInterface` has changed. + +- The `send` method no longer accepts more than one request. Use `sendAll` to + send multiple requests in parallel. +- `setUserAgent()` has been removed. Use a default request option instead. You + could, for example, do something like: + `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`. +- `setSslVerification()` has been removed. Use default request options instead, + like `$client->setConfig('defaults/verify', true)`. + +`GuzzleHttp\Client` has changed. + +- The constructor now accepts only an associative array. You can include a + `base_url` string or array to use a URI template as the base URL of a client. + You can also specify a `defaults` key that is an associative array of default + request options. You can pass an `adapter` to use a custom adapter, + `batch_adapter` to use a custom adapter for sending requests in parallel, or + a `message_factory` to change the factory used to create HTTP requests and + responses. +- The client no longer emits a `client.create_request` event. +- Creating requests with a client no longer automatically utilize a URI + template. You must pass an array into a creational method (e.g., + `createRequest`, `get`, `put`, etc.) in order to expand a URI template. + +### Messages + +Messages no longer have references to their counterparts (i.e., a request no +longer has a reference to it's response, and a response no loger has a +reference to its request). This association is now managed through a +`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to +these transaction objects using request events that are emitted over the +lifecycle of a request. + +#### Requests with a body + +- `GuzzleHttp\Message\EntityEnclosingRequest` and + `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The + separation between requests that contain a body and requests that do not + contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface` + handles both use cases. +- Any method that previously accepts a `GuzzleHttp\Response` object now accept a + `GuzzleHttp\Message\ResponseInterface`. +- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to + `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create + both requests and responses and is implemented in + `GuzzleHttp\Message\MessageFactory`. +- POST field and file methods have been removed from the request object. You + must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface` + to control the format of a POST body. Requests that are created using a + standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use + a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if + the method is POST and no body is provided. + +```php +$request = $client->createRequest('POST', '/'); +$request->getBody()->setField('foo', 'bar'); +$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r'))); +``` + +#### Headers + +- `GuzzleHttp\Message\Header` has been removed. Header values are now simply + represented by an array of values or as a string. Header values are returned + as a string by default when retrieving a header value from a message. You can + pass an optional argument of `true` to retrieve a header value as an array + of strings instead of a single concatenated string. +- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to + `GuzzleHttp\Post`. This interface has been simplified and now allows the + addition of arbitrary headers. +- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most + of the custom headers are now handled separately in specific + subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has + been updated to properly handle headers that contain parameters (like the + `Link` header). + +#### Responses + +- `GuzzleHttp\Message\Response::getInfo()` and + `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event + system to retrieve this type of information. +- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed. +- `GuzzleHttp\Message\Response::getMessage()` has been removed. +- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific + methods have moved to the CacheSubscriber. +- Header specific helper functions like `getContentMd5()` have been removed. + Just use `getHeader('Content-MD5')` instead. +- `GuzzleHttp\Message\Response::setRequest()` and + `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event + system to work with request and response objects as a transaction. +- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the + Redirect subscriber instead. +- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have + been removed. Use `getStatusCode()` instead. + +#### Streaming responses + +Streaming requests can now be created by a client directly, returning a +`GuzzleHttp\Message\ResponseInterface` object that contains a body stream +referencing an open PHP HTTP stream. + +```php +// 3.0 +use Guzzle\Stream\PhpStreamRequestFactory; +$request = $client->get('/'); +$factory = new PhpStreamRequestFactory(); +$stream = $factory->fromRequest($request); +$data = $stream->read(1024); + +// 4.0 +$response = $client->get('/', ['stream' => true]); +// Read some data off of the stream in the response body +$data = $response->getBody()->read(1024); +``` + +#### Redirects + +The `configureRedirects()` method has been removed in favor of a +`allow_redirects` request option. + +```php +// Standard redirects with a default of a max of 5 redirects +$request = $client->createRequest('GET', '/', ['allow_redirects' => true]); + +// Strict redirects with a custom number of redirects +$request = $client->createRequest('GET', '/', [ + 'allow_redirects' => ['max' => 5, 'strict' => true] +]); +``` + +#### EntityBody + +EntityBody interfaces and classes have been removed or moved to +`GuzzleHttp\Stream`. All classes and interfaces that once required +`GuzzleHttp\EntityBodyInterface` now require +`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no +longer uses `GuzzleHttp\EntityBody::factory` but now uses +`GuzzleHttp\Stream\Stream::factory` or even better: +`GuzzleHttp\Stream\create()`. + +- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface` +- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream` +- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream` +- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream` +- `Guzzle\Http\IoEmittyinEntityBody` has been removed. + +#### Request lifecycle events + +Requests previously submitted a large number of requests. The number of events +emitted over the lifecycle of a request has been significantly reduced to make +it easier to understand how to extend the behavior of a request. All events +emitted during the lifecycle of a request now emit a custom +`GuzzleHttp\Event\EventInterface` object that contains context providing +methods and a way in which to modify the transaction at that specific point in +time (e.g., intercept the request and set a response on the transaction). + +- `request.before_send` has been renamed to `before` and now emits a + `GuzzleHttp\Event\BeforeEvent` +- `request.complete` has been renamed to `complete` and now emits a + `GuzzleHttp\Event\CompleteEvent`. +- `request.sent` has been removed. Use `complete`. +- `request.success` has been removed. Use `complete`. +- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`. +- `request.exception` has been removed. Use `error`. +- `request.receive.status_line` has been removed. +- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to + maintain a status update. +- `curl.callback.write` has been removed. Use a custom `StreamInterface` to + intercept writes. +- `curl.callback.read` has been removed. Use a custom `StreamInterface` to + intercept reads. + +`headers` is a new event that is emitted after the response headers of a +request have been received before the body of the response is downloaded. This +event emits a `GuzzleHttp\Event\HeadersEvent`. + +You can intercept a request and inject a response using the `intercept()` event +of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and +`GuzzleHttp\Event\ErrorEvent` event. + +See: https://docs.guzzlephp.org/en/latest/events.html + +## Inflection + +The `Guzzle\Inflection` namespace has been removed. This is not a core concern +of Guzzle. + +## Iterator + +The `Guzzle\Iterator` namespace has been removed. + +- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and + `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of + Guzzle itself. +- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent + class is shipped with PHP 5.4. +- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because + it's easier to just wrap an iterator in a generator that maps values. + +For a replacement of these iterators, see https://github.com/nikic/iter + +## Log + +The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The +`Guzzle\Log` namespace has been removed. Guzzle now relies on +`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been +moved to `GuzzleHttp\Subscriber\Log\Formatter`. + +## Parser + +The `Guzzle\Parser` namespace has been removed. This was previously used to +make it possible to plug in custom parsers for cookies, messages, URI +templates, and URLs; however, this level of complexity is not needed in Guzzle +so it has been removed. + +- Cookie: Cookie parsing logic has been moved to + `GuzzleHttp\Cookie\SetCookie::fromString`. +- Message: Message parsing logic for both requests and responses has been moved + to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only + used in debugging or deserializing messages, so it doesn't make sense for + Guzzle as a library to add this level of complexity to parsing messages. +- UriTemplate: URI template parsing has been moved to + `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL + URI template library if it is installed. +- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously + it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary, + then developers are free to subclass `GuzzleHttp\Url`. + +## Plugin + +The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`. +Several plugins are shipping with the core Guzzle library under this namespace. + +- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar + code has moved to `GuzzleHttp\Cookie`. +- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin. +- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is + received. +- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin. +- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before + sending. This subscriber is attached to all requests by default. +- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin. + +The following plugins have been removed (third-parties are free to re-implement +these if needed): + +- `GuzzleHttp\Plugin\Async` has been removed. +- `GuzzleHttp\Plugin\CurlAuth` has been removed. +- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This + functionality should instead be implemented with event listeners that occur + after normal response parsing occurs in the guzzle/command package. + +The following plugins are not part of the core Guzzle package, but are provided +in separate repositories: + +- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler + to build custom retry policies using simple functions rather than various + chained classes. See: https://github.com/guzzle/retry-subscriber +- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to + https://github.com/guzzle/cache-subscriber +- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to + https://github.com/guzzle/log-subscriber +- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to + https://github.com/guzzle/message-integrity-subscriber +- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to + `GuzzleHttp\Subscriber\MockSubscriber`. +- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to + https://github.com/guzzle/oauth-subscriber + +## Service + +The service description layer of Guzzle has moved into two separate packages: + +- https://github.com/guzzle/command Provides a high level abstraction over web + services by representing web service operations using commands. +- https://github.com/guzzle/guzzle-services Provides an implementation of + guzzle/command that provides request serialization and response parsing using + Guzzle service descriptions. + +## Stream + +Stream have moved to a separate package available at +https://github.com/guzzle/streams. + +`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take +on the responsibilities of `Guzzle\Http\EntityBody` and +`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number +of methods implemented by the `StreamInterface` has been drastically reduced to +allow developers to more easily extend and decorate stream behavior. + +## Removed methods from StreamInterface + +- `getStream` and `setStream` have been removed to better encapsulate streams. +- `getMetadata` and `setMetadata` have been removed in favor of + `GuzzleHttp\Stream\MetadataStreamInterface`. +- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been + removed. This data is accessible when + using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`. +- `rewind` has been removed. Use `seek(0)` for a similar behavior. + +## Renamed methods + +- `detachStream` has been renamed to `detach`. +- `feof` has been renamed to `eof`. +- `ftell` has been renamed to `tell`. +- `readLine` has moved from an instance method to a static class method of + `GuzzleHttp\Stream\Stream`. + +## Metadata streams + +`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams +that contain additional metadata accessible via `getMetadata()`. +`GuzzleHttp\Stream\StreamInterface::getMetadata` and +`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed. + +## StreamRequestFactory + +The entire concept of the StreamRequestFactory has been removed. The way this +was used in Guzzle 3 broke the actual interface of sending streaming requests +(instead of getting back a Response, you got a StreamInterface). Streaming +PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`. + +3.6 to 3.7 +---------- + +### Deprecations + +- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.: + +```php +\Guzzle\Common\Version::$emitWarnings = true; +``` + +The following APIs and options have been marked as deprecated: + +- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead. +- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. +- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. +- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated +- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. +- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. +- Marked `Guzzle\Common\Collection::inject()` as deprecated. +- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use + `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or + `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` + +3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational +request methods. When paired with a client's configuration settings, these options allow you to specify default settings +for various aspects of a request. Because these options make other previous configuration options redundant, several +configuration options and methods of a client and AbstractCommand have been deprecated. + +- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`. +- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`. +- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')` +- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0 + + $command = $client->getCommand('foo', array( + 'command.headers' => array('Test' => '123'), + 'command.response_body' => '/path/to/file' + )); + + // Should be changed to: + + $command = $client->getCommand('foo', array( + 'command.request_options' => array( + 'headers' => array('Test' => '123'), + 'save_as' => '/path/to/file' + ) + )); + +### Interface changes + +Additions and changes (you will need to update any implementations or subclasses you may have created): + +- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: + createRequest, head, delete, put, patch, post, options, prepareRequest +- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` +- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` +- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to + `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a + resource, string, or EntityBody into the $options parameter to specify the download location of the response. +- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a + default `array()` +- Added `Guzzle\Stream\StreamInterface::isRepeatable` +- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. + +The following methods were removed from interfaces. All of these methods are still available in the concrete classes +that implement them, but you should update your code to use alternative methods: + +- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use + `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or + `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or + `$client->setDefaultOption('headers/{header_name}', 'value')`. or + `$client->setDefaultOption('headers', array('header_name' => 'value'))`. +- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`. +- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail. +- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail. +- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail. +- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin. +- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin. +- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin. + +### Cache plugin breaking changes + +- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a + CacheStorageInterface. These two objects and interface will be removed in a future version. +- Always setting X-cache headers on cached responses +- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin +- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface + $request, Response $response);` +- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` +- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` +- Added `CacheStorageInterface::purge($url)` +- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin + $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, + CanCacheStrategyInterface $canCache = null)` +- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` + +3.5 to 3.6 +---------- + +* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. +* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution +* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). + For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader(). + Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request. +* Specific header implementations can be created for complex headers. When a message creates a header, it uses a + HeaderFactory which can map specific headers to specific header classes. There is now a Link header and + CacheControl header implementation. +* Moved getLinks() from Response to just be used on a Link header object. + +If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the +HeaderInterface (e.g. toArray(), getAll(), etc.). + +### Interface changes + +* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate +* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() +* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in + Guzzle\Http\Curl\RequestMediator +* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. +* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface +* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() + +### Removed deprecated functions + +* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() +* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). + +### Deprecations + +* The ability to case-insensitively search for header values +* Guzzle\Http\Message\Header::hasExactHeader +* Guzzle\Http\Message\Header::raw. Use getAll() +* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object + instead. + +### Other changes + +* All response header helper functions return a string rather than mixing Header objects and strings inconsistently +* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle + directly via interfaces +* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist + but are a no-op until removed. +* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a + `Guzzle\Service\Command\ArrayCommandInterface`. +* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response + on a request while the request is still being transferred +* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess + +3.3 to 3.4 +---------- + +Base URLs of a client now follow the rules of https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.2 when merging URLs. + +3.2 to 3.3 +---------- + +### Response::getEtag() quote stripping removed + +`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header + +### Removed `Guzzle\Http\Utils` + +The `Guzzle\Http\Utils` class was removed. This class was only used for testing. + +### Stream wrapper and type + +`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase. + +### curl.emit_io became emit_io + +Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the +'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' + +3.1 to 3.2 +---------- + +### CurlMulti is no longer reused globally + +Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added +to a single client can pollute requests dispatched from other clients. + +If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the +ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is +created. + +```php +$multi = new Guzzle\Http\Curl\CurlMulti(); +$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json'); +$builder->addListener('service_builder.create_client', function ($event) use ($multi) { + $event['client']->setCurlMulti($multi); +} +}); +``` + +### No default path + +URLs no longer have a default path value of '/' if no path was specified. + +Before: + +```php +$request = $client->get('http://www.foo.com'); +echo $request->getUrl(); +// >> http://www.foo.com/ +``` + +After: + +```php +$request = $client->get('http://www.foo.com'); +echo $request->getUrl(); +// >> http://www.foo.com +``` + +### Less verbose BadResponseException + +The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and +response information. You can, however, get access to the request and response object by calling `getRequest()` or +`getResponse()` on the exception object. + +### Query parameter aggregation + +Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a +setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is +responsible for handling the aggregation of multi-valued query string variables into a flattened hash. + +2.8 to 3.x +---------- + +### Guzzle\Service\Inspector + +Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig` + +**Before** + +```php +use Guzzle\Service\Inspector; + +class YourClient extends \Guzzle\Service\Client +{ + public static function factory($config = array()) + { + $default = array(); + $required = array('base_url', 'username', 'api_key'); + $config = Inspector::fromConfig($config, $default, $required); + + $client = new self( + $config->get('base_url'), + $config->get('username'), + $config->get('api_key') + ); + $client->setConfig($config); + + $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); + + return $client; + } +``` + +**After** + +```php +use Guzzle\Common\Collection; + +class YourClient extends \Guzzle\Service\Client +{ + public static function factory($config = array()) + { + $default = array(); + $required = array('base_url', 'username', 'api_key'); + $config = Collection::fromConfig($config, $default, $required); + + $client = new self( + $config->get('base_url'), + $config->get('username'), + $config->get('api_key') + ); + $client->setConfig($config); + + $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); + + return $client; + } +``` + +### Convert XML Service Descriptions to JSON + +**Before** + +```xml + + + + + + Get a list of groups + + + Uses a search query to get a list of groups + + + + Create a group + + + + + Delete a group by ID + + + + + + + Update a group + + + + + + +``` + +**After** + +```json +{ + "name": "Zendesk REST API v2", + "apiVersion": "2012-12-31", + "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users", + "operations": { + "list_groups": { + "httpMethod":"GET", + "uri": "groups.json", + "summary": "Get a list of groups" + }, + "search_groups":{ + "httpMethod":"GET", + "uri": "search.json?query=\"{query} type:group\"", + "summary": "Uses a search query to get a list of groups", + "parameters":{ + "query":{ + "location": "uri", + "description":"Zendesk Search Query", + "type": "string", + "required": true + } + } + }, + "create_group": { + "httpMethod":"POST", + "uri": "groups.json", + "summary": "Create a group", + "parameters":{ + "data": { + "type": "array", + "location": "body", + "description":"Group JSON", + "filters": "json_encode", + "required": true + }, + "Content-Type":{ + "type": "string", + "location":"header", + "static": "application/json" + } + } + }, + "delete_group": { + "httpMethod":"DELETE", + "uri": "groups/{id}.json", + "summary": "Delete a group", + "parameters":{ + "id":{ + "location": "uri", + "description":"Group to delete by ID", + "type": "integer", + "required": true + } + } + }, + "get_group": { + "httpMethod":"GET", + "uri": "groups/{id}.json", + "summary": "Get a ticket", + "parameters":{ + "id":{ + "location": "uri", + "description":"Group to get by ID", + "type": "integer", + "required": true + } + } + }, + "update_group": { + "httpMethod":"PUT", + "uri": "groups/{id}.json", + "summary": "Update a group", + "parameters":{ + "id": { + "location": "uri", + "description":"Group to update by ID", + "type": "integer", + "required": true + }, + "data": { + "type": "array", + "location": "body", + "description":"Group JSON", + "filters": "json_encode", + "required": true + }, + "Content-Type":{ + "type": "string", + "location":"header", + "static": "application/json" + } + } + } +} +``` + +### Guzzle\Service\Description\ServiceDescription + +Commands are now called Operations + +**Before** + +```php +use Guzzle\Service\Description\ServiceDescription; + +$sd = new ServiceDescription(); +$sd->getCommands(); // @returns ApiCommandInterface[] +$sd->hasCommand($name); +$sd->getCommand($name); // @returns ApiCommandInterface|null +$sd->addCommand($command); // @param ApiCommandInterface $command +``` + +**After** + +```php +use Guzzle\Service\Description\ServiceDescription; + +$sd = new ServiceDescription(); +$sd->getOperations(); // @returns OperationInterface[] +$sd->hasOperation($name); +$sd->getOperation($name); // @returns OperationInterface|null +$sd->addOperation($operation); // @param OperationInterface $operation +``` + +### Guzzle\Common\Inflection\Inflector + +Namespace is now `Guzzle\Inflection\Inflector` + +### Guzzle\Http\Plugin + +Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below. + +### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log + +Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively. + +**Before** + +```php +use Guzzle\Common\Log\ClosureLogAdapter; +use Guzzle\Http\Plugin\LogPlugin; + +/** @var \Guzzle\Http\Client */ +$client; + +// $verbosity is an integer indicating desired message verbosity level +$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE); +``` + +**After** + +```php +use Guzzle\Log\ClosureLogAdapter; +use Guzzle\Log\MessageFormatter; +use Guzzle\Plugin\Log\LogPlugin; + +/** @var \Guzzle\Http\Client */ +$client; + +// $format is a string indicating desired message format -- @see MessageFormatter +$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT); +``` + +### Guzzle\Http\Plugin\CurlAuthPlugin + +Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`. + +### Guzzle\Http\Plugin\ExponentialBackoffPlugin + +Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes. + +**Before** + +```php +use Guzzle\Http\Plugin\ExponentialBackoffPlugin; + +$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge( + ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429) + )); + +$client->addSubscriber($backoffPlugin); +``` + +**After** + +```php +use Guzzle\Plugin\Backoff\BackoffPlugin; +use Guzzle\Plugin\Backoff\HttpBackoffStrategy; + +// Use convenient factory method instead -- see implementation for ideas of what +// you can do with chaining backoff strategies +$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge( + HttpBackoffStrategy::getDefaultFailureCodes(), array(429) + )); +$client->addSubscriber($backoffPlugin); +``` + +### Known Issues + +#### [BUG] Accept-Encoding header behavior changed unintentionally. + +(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e) + +In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to +properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen. +See issue #217 for a workaround, or use a version containing the fix. diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/composer.json new file mode 100644 index 0000000000..cbede149ac --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/composer.json @@ -0,0 +1,131 @@ +{ + "name": "guzzlehttp/guzzle", + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "framework", + "http", + "rest", + "web service", + "curl", + "client", + "HTTP client", + "PSR-7", + "PSR-18" + ], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "repositories": [ + { + "type": "package", + "package": { + "name": "guzzle/client-integration-tests", + "version": "v3.0.2", + "dist": { + "url": "https://codeload.github.com/guzzle/client-integration-tests/zip/2c025848417c1135031fdf9c728ee53d0a7ceaee", + "type": "zip" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.11", + "php-http/message": "^1.0 || ^2.0", + "guzzlehttp/psr7": "^1.7 || ^2.0", + "th3n3rd/cartesian-product": "^0.3" + }, + "autoload": { + "psr-4": { + "Http\\Client\\Tests\\": "src/" + } + }, + "bin": [ + "bin/http_test_server" + ] + } + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "bamarni/composer-bin-plugin": "^1.8.2", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, + "preferred-install": "dist", + "sort-packages": true + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\": "tests/" + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/Makefile b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/Makefile new file mode 100644 index 0000000000..d92e03f95e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/Makefile @@ -0,0 +1,153 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Guzzle.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Guzzle.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/Guzzle" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Guzzle" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/_static/guzzle-icon.png b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/_static/guzzle-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f1017f7e6028c14a9e0694c66a6cfbb2d546adf5 GIT binary patch literal 803 zcmV+;1Kj+HP)@ zosv>1reIXPlo1y){RjSw2_NWGX5O-#W+NK3tBQ_IN%bh7xZ1Yehws80|4azI;aWIJ z_%xhlcTubTO7Dbx z)F-R8gg5MzGv|t4=e_El4GCwW0m6?C;0bG4DRC^TH6-pa>y8_h*QBud6Ms>Qf{oN> z=Q($Dn|DINB{`Ea{)h&^x;i{)XQ{?Z&id71eOkRPqgl17&E%|dJIC&SCwnd zY4oUR`OVorB8A||QZjLWS~cr&OD?HEtM@^bIovNUC5An6?z`xDgJL2H2Mya@dku<1YUfi&QvS8KS8=~uOs!oaF z8OMF7-5yyh}yDkaCp7Ob8b;wv(27WLL#lglguF0fh3d(d@ zP%vrDIA~G}dL)X;YnCMSE4ZM-gfVsYTLItd3J`~_vw^k=W%C_MlG002ovPDHLkV1oLqbt3=( literal 0 HcmV?d00001 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/_static/logo.png b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/_static/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..965a4ef4139180ea7d33594feba2394dfce6774a GIT binary patch literal 247678 zcmb5WW3woL|(Mg6aWv=`TK0sufq`d-{kM59@!F*@2P9srH!gpS{!mKT-Z;`u~dX|C{OE-UE#F<+ZcjUa!t4 z7wtq|=KmEZTN&t1@}!IM--|wLAQO=oW-a$)ZqH&aL|tU%5w7_)b^BfKm+ZuLt{tJI zkYAsjm7kx*sIy+JigZ>_V}k;31+&}$9@f8q!!t4s{ZBG7lN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vEOOZ_>LWs$=@eO oU~&W|WCX@W8545QKca*DABLnc9p*i(!vFvP07*qoM6N<$f;ZvU5dZ)H literal 0 HcmV?d00001 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/conf.py b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/conf.py new file mode 100644 index 0000000000..c271a62722 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/conf.py @@ -0,0 +1,68 @@ +import sys, os +from sphinx.highlighting import lexers +from pygments.lexers.web import PhpLexer + + +lexers['php'] = PhpLexer(startinline=True, linenos=1) +lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1) +primary_domain = 'php' + +extensions = [] +templates_path = ['_templates'] +source_suffix = '.rst' +master_doc = 'index' +project = u'Guzzle' +copyright = u'2015, Michael Dowling' +version = '7' +html_title = "Guzzle Documentation" +html_short_title = "Guzzle 7" + +exclude_patterns = ['_build'] +html_static_path = ['_static'] + +##### Guzzle sphinx theme + +import guzzle_sphinx_theme +html_translator_class = 'guzzle_sphinx_theme.HTMLTranslator' +html_theme_path = guzzle_sphinx_theme.html_theme_path() +html_theme = 'guzzle_sphinx_theme' + +# Custom sidebar templates, maps document names to template names. +html_sidebars = { + '**': ['logo-text.html', 'globaltoc.html', 'searchbox.html'] +} + +# Register the theme as an extension to generate a sitemap.xml +extensions.append("guzzle_sphinx_theme") + +# Guzzle theme options (see theme.conf for more information) +html_theme_options = { + + # Set the path to a special layout to include for the homepage + # "index_template": "homepage.html", + + # Allow a separate homepage from the master_doc + # homepage = index + + # Set the name of the project to appear in the nav menu + # "project_nav_name": "Guzzle", + + # Set your Disqus short name to enable comments + # "disqus_comments_shortname": "my_disqus_comments_short_name", + + # Set you GA account ID to enable tracking + # "google_analytics_account": "my_ga_account", + + # Path to a touch icon + # "touch_icon": "", + + # Specify a base_url used to generate sitemap.xml links. If not + # specified, then no sitemap will be built. + "base_url": "http://guzzlephp.org" + + # Allow the "Table of Contents" page to be defined separately from "master_doc" + # tocpage = Contents + + # Allow the project link to be overriden to a custom URL. + # projectlink = http://myproject.url +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/faq.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/faq.rst new file mode 100644 index 0000000000..1e93699f78 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/faq.rst @@ -0,0 +1,193 @@ +=== +FAQ +=== + +Does Guzzle require cURL? +========================= + +No. Guzzle can use any HTTP handler to send requests. This means that Guzzle +can be used with cURL, PHP's stream wrapper, sockets, and non-blocking libraries +like `React `_. You just need to configure an HTTP handler +to use a different method of sending requests. + +.. note:: + + Guzzle has historically only utilized cURL to send HTTP requests. cURL is + an amazing HTTP client (arguably the best), and Guzzle will continue to use + it by default when it is available. It is rare, but some developers don't + have cURL installed on their systems or run into version specific issues. + By allowing swappable HTTP handlers, Guzzle is now much more customizable + and able to adapt to fit the needs of more developers. + + +Can Guzzle send asynchronous requests? +====================================== + +Yes. You can use the ``requestAsync``, ``sendAsync``, ``getAsync``, +``headAsync``, ``putAsync``, ``postAsync``, ``deleteAsync``, and ``patchAsync`` +methods of a client to send an asynchronous request. The client will return a +``GuzzleHttp\Promise\PromiseInterface`` object. You can chain ``then`` +functions off of the promise. + +.. code-block:: php + + $promise = $client->requestAsync('GET', 'http://httpbin.org/get'); + $promise->then(function ($response) { + echo 'Got a response! ' . $response->getStatusCode(); + }); + +You can force an asynchronous response to complete using the ``wait()`` method +of the returned promise. + +.. code-block:: php + + $promise = $client->requestAsync('GET', 'http://httpbin.org/get'); + $response = $promise->wait(); + + +How can I add custom cURL options? +================================== + +cURL offers a huge number of `customizable options `_. +While Guzzle normalizes many of these options across different handlers, there +are times when you need to set custom cURL options. This can be accomplished +by passing an associative array of cURL settings in the **curl** key of a +request. + +For example, let's say you need to customize the outgoing network interface +used with a client. + +.. code-block:: php + + $client->request('GET', '/', [ + 'curl' => [ + CURLOPT_INTERFACE => 'xxx.xxx.xxx.xxx' + ] + ]); + +If you use asynchronous requests with cURL multi handler and want to tweak it, +additional options can be specified as an associative array in the +**options** key of the ``CurlMultiHandler`` constructor. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Handler\CurlMultiHandler; + + $client = new Client(['handler' => HandlerStack::create(new CurlMultiHandler([ + 'options' => [ + CURLMOPT_MAX_TOTAL_CONNECTIONS => 50, + CURLMOPT_MAX_HOST_CONNECTIONS => 5, + ] + ]))]); + + +How can I add custom stream context options? +============================================ + +You can pass custom `stream context options `_ +using the **stream_context** key of the request option. The **stream_context** +array is an associative array where each key is a PHP transport, and each value +is an associative array of transport options. + +For example, let's say you need to customize the outgoing network interface +used with a client and allow self-signed certificates. + +.. code-block:: php + + $client->request('GET', '/', [ + 'stream' => true, + 'stream_context' => [ + 'ssl' => [ + 'allow_self_signed' => true + ], + 'socket' => [ + 'bindto' => 'xxx.xxx.xxx.xxx' + ] + ] + ]); + + +Why am I getting an SSL verification error? +=========================================== + +You need to specify the path on disk to the CA bundle used by Guzzle for +verifying the peer certificate. See :ref:`verify-option`. + + +What is this Maximum function nesting error? +============================================ + + Maximum function nesting level of '100' reached, aborting + +You could run into this error if you have the XDebug extension installed and +you execute a lot of requests in callbacks. This error message comes +specifically from the XDebug extension. PHP itself does not have a function +nesting limit. Change this setting in your php.ini to increase the limit:: + + xdebug.max_nesting_level = 1000 + + +Why am I getting a 417 error response? +====================================== + +This can occur for a number of reasons, but if you are sending PUT, POST, or +PATCH requests with an ``Expect: 100-Continue`` header, a server that does not +support this header will return a 417 response. You can work around this by +setting the ``expect`` request option to ``false``: + +.. code-block:: php + + $client = new GuzzleHttp\Client(); + + // Disable the expect header on a single request + $response = $client->request('PUT', '/', ['expect' => false]); + + // Disable the expect header on all client requests + $client = new GuzzleHttp\Client(['expect' => false]); + +How can I track redirected requests? +==================================== + +You can enable tracking of redirected URIs and status codes via the +`track_redirects` option. Each redirected URI and status code will be stored in the +``X-Guzzle-Redirect-History`` and the ``X-Guzzle-Redirect-Status-History`` +header respectively. + +The initial request's URI and the final status code will be excluded from the results. +With this in mind you should be able to easily track a request's full redirect path. + +For example, let's say you need to track redirects and provide both results +together in a single report: + +.. code-block:: php + + // First you configure Guzzle with redirect tracking and make a request + $client = new Client([ + RequestOptions::ALLOW_REDIRECTS => [ + 'max' => 10, // allow at most 10 redirects. + 'strict' => true, // use "strict" RFC compliant redirects. + 'referer' => true, // add a Referer header + 'track_redirects' => true, + ], + ]); + $initialRequest = '/redirect/3'; // Store the request URI for later use + $response = $client->request('GET', $initialRequest); // Make your request + + // Retrieve both Redirect History headers + $redirectUriHistory = $response->getHeader('X-Guzzle-Redirect-History')[0]; // retrieve Redirect URI history + $redirectCodeHistory = $response->getHeader('X-Guzzle-Redirect-Status-History')[0]; // retrieve Redirect HTTP Status history + + // Add the initial URI requested to the (beginning of) URI history + array_unshift($redirectUriHistory, $initialRequest); + + // Add the final HTTP status code to the end of HTTP response history + array_push($redirectCodeHistory, $response->getStatusCode()); + + // (Optional) Combine the items of each array into a single result set + $fullRedirectReport = []; + foreach ($redirectUriHistory as $key => $value) { + $fullRedirectReport[$key] = ['location' => $value, 'code' => $redirectCodeHistory[$key]]; + } + echo json_encode($fullRedirectReport); diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/handlers-and-middleware.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/handlers-and-middleware.rst new file mode 100644 index 0000000000..9f1473e4f6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/handlers-and-middleware.rst @@ -0,0 +1,304 @@ +======================= +Handlers and Middleware +======================= + +Guzzle clients use a handler and middleware system to send HTTP requests. + +Handlers +======== + +A handler function accepts a ``Psr\Http\Message\RequestInterface`` and array of +request options and returns a ``GuzzleHttp\Promise\PromiseInterface`` that is +fulfilled with a ``Psr\Http\Message\ResponseInterface`` or rejected with an +exception. + +You can provide a custom handler to a client using the ``handler`` option of +a client constructor. It is important to understand that several request +options used by Guzzle require that specific middlewares wrap the handler used +by the client. You can ensure that the handler you provide to a client uses the +default middlewares by wrapping the handler in the +``GuzzleHttp\HandlerStack::create(callable $handler = null)`` static method. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Handler\CurlHandler; + + $handler = new CurlHandler(); + $stack = HandlerStack::create($handler); // Wrap w/ middleware + $client = new Client(['handler' => $stack]); + +The ``create`` method adds default handlers to the ``HandlerStack``. When the +``HandlerStack`` is resolved, the handlers will execute in the following order: + +1. Sending request: + + 1. ``http_errors`` - No op when sending a request. The response status code + is checked in the response processing when returning a response promise up + the stack. + 2. ``allow_redirects`` - No op when sending a request. Following redirects + occurs when a response promise is being returned up the stack. + 3. ``cookies`` - Adds cookies to requests. + 4. ``prepare_body`` - The body of an HTTP request will be prepared (e.g., + add default headers like Content-Length, Content-Type, etc.). + 5. + +2. Processing response: + + 1. ``prepare_body`` - no op on response processing. + 2. ``cookies`` - extracts response cookies into the cookie jar. + 3. ``allow_redirects`` - Follows redirects. + 4. ``http_errors`` - throws exceptions when the response status code ``>=`` + 400. + +When provided no ``$handler`` argument, ``GuzzleHttp\HandlerStack::create()`` +will choose the most appropriate handler based on the extensions available on +your system. + +.. important:: + + The handler provided to a client determines how request options are applied + and utilized for each request sent by a client. For example, if you do not + have a cookie middleware associated with a client, then setting the + ``cookies`` request option will have no effect on the request. + + +Middleware +========== + +Middleware augments the functionality of handlers by invoking them in the +process of generating responses. Middleware is implemented as a higher order +function that takes the following form. + +.. code-block:: php + + use Psr\Http\Message\RequestInterface; + + function my_middleware() + { + return function (callable $handler) { + return function (RequestInterface $request, array $options) use ($handler) { + return $handler($request, $options); + }; + }; + } + +Middleware functions return a function that accepts the next handler to invoke. +This returned function then returns another function that acts as a composed +handler-- it accepts a request and options, and returns a promise that is +fulfilled with a response. Your composed middleware can modify the request, +add custom request options, and modify the promise returned by the downstream +handler. + +Here's an example of adding a header to each request. + +.. code-block:: php + + use Psr\Http\Message\RequestInterface; + + function add_header($header, $value) + { + return function (callable $handler) use ($header, $value) { + return function ( + RequestInterface $request, + array $options + ) use ($handler, $header, $value) { + $request = $request->withHeader($header, $value); + return $handler($request, $options); + }; + }; + } + +Once a middleware has been created, you can add it to a client by either +wrapping the handler used by the client or by decorating a handler stack. + +.. code-block:: php + + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Handler\CurlHandler; + use GuzzleHttp\Client; + + $stack = new HandlerStack(); + $stack->setHandler(new CurlHandler()); + $stack->push(add_header('X-Foo', 'bar')); + $client = new Client(['handler' => $stack]); + +Now when you send a request, the client will use a handler composed with your +added middleware, adding a header to each request. + +Here's an example of creating a middleware that modifies the response of the +downstream handler. This example adds a header to the response. + +.. code-block:: php + + use Psr\Http\Message\RequestInterface; + use Psr\Http\Message\ResponseInterface; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Handler\CurlHandler; + use GuzzleHttp\Client; + + function add_response_header($header, $value) + { + return function (callable $handler) use ($header, $value) { + return function ( + RequestInterface $request, + array $options + ) use ($handler, $header, $value) { + $promise = $handler($request, $options); + return $promise->then( + function (ResponseInterface $response) use ($header, $value) { + return $response->withHeader($header, $value); + } + ); + }; + }; + } + + $stack = new HandlerStack(); + $stack->setHandler(new CurlHandler()); + $stack->push(add_response_header('X-Foo', 'bar')); + $client = new Client(['handler' => $stack]); + +Creating a middleware that modifies a request is made much simpler using the +``GuzzleHttp\Middleware::mapRequest()`` middleware. This middleware accepts +a function that takes the request argument and returns the request to send. + +.. code-block:: php + + use Psr\Http\Message\RequestInterface; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Handler\CurlHandler; + use GuzzleHttp\Client; + use GuzzleHttp\Middleware; + + $stack = new HandlerStack(); + $stack->setHandler(new CurlHandler()); + + $stack->push(Middleware::mapRequest(function (RequestInterface $request) { + return $request->withHeader('X-Foo', 'bar'); + })); + + $client = new Client(['handler' => $stack]); + +Modifying a response is also much simpler using the +``GuzzleHttp\Middleware::mapResponse()`` middleware. + +.. code-block:: php + + use Psr\Http\Message\ResponseInterface; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Handler\CurlHandler; + use GuzzleHttp\Client; + use GuzzleHttp\Middleware; + + $stack = new HandlerStack(); + $stack->setHandler(new CurlHandler()); + + $stack->push(Middleware::mapResponse(function (ResponseInterface $response) { + return $response->withHeader('X-Foo', 'bar'); + })); + + $client = new Client(['handler' => $stack]); + + +HandlerStack +============ + +A handler stack represents a stack of middleware to apply to a base handler +function. You can push middleware to the stack to add to the top of the stack, +and unshift middleware onto the stack to add to the bottom of the stack. When +the stack is resolved, the handler is pushed onto the stack. Each value is +then popped off of the stack, wrapping the previous value popped off of the +stack. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Middleware; + use GuzzleHttp\Utils; + use Psr\Http\Message\RequestInterface; + + $stack = new HandlerStack(); + $stack->setHandler(Utils::chooseHandler()); + + $stack->push(Middleware::mapRequest(function (RequestInterface $r) { + echo 'A'; + return $r; + })); + + $stack->push(Middleware::mapRequest(function (RequestInterface $r) { + echo 'B'; + return $r; + })); + + $stack->push(Middleware::mapRequest(function (RequestInterface $r) { + echo 'C'; + return $r; + })); + + $client->request('GET', 'http://httpbin.org/'); + // echoes 'ABC'; + + $stack->unshift(Middleware::mapRequest(function (RequestInterface $r) { + echo '0'; + return $r; + })); + + $client = new Client(['handler' => $stack]); + $client->request('GET', 'http://httpbin.org/'); + // echoes '0ABC'; + +You can give middleware a name, which allows you to add middleware before +other named middleware, after other named middleware, or remove middleware +by name. + +.. code-block:: php + + use Psr\Http\Message\RequestInterface; + use GuzzleHttp\Middleware; + + // Add a middleware with a name + $stack->push(Middleware::mapRequest(function (RequestInterface $r) { + return $r->withHeader('X-Foo', 'Bar'); + }, 'add_foo')); + + // Add a middleware before a named middleware (unshift before). + $stack->before('add_foo', Middleware::mapRequest(function (RequestInterface $r) { + return $r->withHeader('X-Baz', 'Qux'); + }, 'add_baz')); + + // Add a middleware after a named middleware (pushed after). + $stack->after('add_baz', Middleware::mapRequest(function (RequestInterface $r) { + return $r->withHeader('X-Lorem', 'Ipsum'); + })); + + // Remove a middleware by name + $stack->remove('add_foo'); + + +Creating a Handler +================== + +As stated earlier, a handler is a function accepts a +``Psr\Http\Message\RequestInterface`` and array of request options and returns +a ``GuzzleHttp\Promise\PromiseInterface`` that is fulfilled with a +``Psr\Http\Message\ResponseInterface`` or rejected with an exception. + +A handler is responsible for applying the following :doc:`request-options`. +These request options are a subset of request options called +"transfer options". + +- :ref:`cert-option` +- :ref:`connect_timeout-option` +- :ref:`debug-option` +- :ref:`delay-option` +- :ref:`decode_content-option` +- :ref:`expect-option` +- :ref:`proxy-option` +- :ref:`sink-option` +- :ref:`timeout-option` +- :ref:`ssl_key-option` +- :ref:`stream-option` +- :ref:`verify-option` diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/index.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/index.rst new file mode 100644 index 0000000000..fba46f064e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/index.rst @@ -0,0 +1,54 @@ +.. title:: Guzzle, PHP HTTP client + +==================== +Guzzle Documentation +==================== + +Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and +trivial to integrate with web services. + +- Simple interface for building query strings, POST requests, streaming large + uploads, streaming large downloads, using HTTP cookies, uploading JSON data, + etc... +- Can send both synchronous and asynchronous requests using the same interface. +- Uses PSR-7 interfaces for requests, responses, and streams. This allows you + to utilize other PSR-7 compatible libraries with Guzzle. +- Abstracts away the underlying HTTP transport, allowing you to write + environment and transport agnostic code; i.e., no hard dependency on cURL, + PHP streams, sockets, or non-blocking event loops. +- Middleware system allows you to augment and compose client behavior. + +.. code-block:: php + + $client = new GuzzleHttp\Client(); + $res = $client->request('GET', 'https://api.github.com/user', [ + 'auth' => ['user', 'pass'] + ]); + echo $res->getStatusCode(); + // "200" + echo $res->getHeader('content-type')[0]; + // 'application/json; charset=utf8' + echo $res->getBody(); + // {"type":"User"...' + + // Send an asynchronous request. + $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); + $promise = $client->sendAsync($request)->then(function ($response) { + echo 'I completed! ' . $response->getBody(); + }); + $promise->wait(); + + +User Guide +========== + +.. toctree:: + :maxdepth: 3 + + overview + quickstart + request-options + psr7 + handlers-and-middleware + testing + faq diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/overview.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/overview.rst new file mode 100644 index 0000000000..1e7c729073 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/overview.rst @@ -0,0 +1,169 @@ +======== +Overview +======== + +Requirements +============ + +#. PHP 7.2.5 +#. To use the PHP stream handler, ``allow_url_fopen`` must be enabled in your + system's php.ini. +#. To use the cURL handler, you must have a recent version of cURL >= 7.19.4 + compiled with OpenSSL and zlib. + +.. note:: + + Guzzle no longer requires cURL in order to send HTTP requests. Guzzle will + use the PHP stream wrapper to send HTTP requests if cURL is not installed. + Alternatively, you can provide your own HTTP handler used to send requests. + Keep in mind that cURL is still required for sending concurrent requests. + + +.. _installation: + + +Installation +============ + +The recommended way to install Guzzle is with +`Composer `_. Composer is a dependency management tool +for PHP that allows you to declare the dependencies your project needs and +installs them into your project. + +.. code-block:: bash + + # Install Composer + curl -sS https://getcomposer.org/installer | php + +You can add Guzzle as a dependency using Composer: + +.. code-block:: bash + + composer require guzzlehttp/guzzle:^7.0 + +Alternatively, you can specify Guzzle as a dependency in your project's +existing composer.json file: + +.. code-block:: js + + { + "require": { + "guzzlehttp/guzzle": "^7.0" + } + } + +After installing, you need to require Composer's autoloader: + +.. code-block:: php + + require 'vendor/autoload.php'; + +You can find out more on how to install Composer, configure autoloading, and +other best-practices for defining dependencies at `getcomposer.org `_. + + +Bleeding edge +------------- + +During your development, you can keep up with the latest changes on the master +branch by setting the version requirement for Guzzle to ``^7.0@dev``. + +.. code-block:: js + + { + "require": { + "guzzlehttp/guzzle": "^7.0@dev" + } + } + + +Upgrading +========= +The git repository contains an `upgrade guide`__ that details what changed +between the major versions. + +__ https://github.com/guzzle/guzzle/blob/master/UPGRADING.md + + +License +======= + +Licensed using the `MIT license `_. + + Copyright (c) 2015 Michael Dowling + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + +Contributing +============ + + +Guidelines +---------- + +1. Guzzle utilizes PSR-1, PSR-2, PSR-4, and PSR-7. +2. Guzzle is meant to be lean and fast with very few dependencies. This means + that not every feature request will be accepted. +3. Guzzle has a minimum PHP version requirement of PHP 7.2. Pull requests must + not require a PHP version greater than PHP 7.2 unless the feature is only + utilized conditionally and the file can be parsed by PHP 7.2. +4. All pull requests must include unit tests to ensure the change works as + expected and to prevent regressions. + + +Running the tests +----------------- + +In order to contribute, you'll need to checkout the source from GitHub and +install Guzzle's dependencies using Composer: + +.. code-block:: bash + + git clone https://github.com/guzzle/guzzle.git + cd guzzle && composer install + +Guzzle is unit tested with PHPUnit. Run the tests using the Makefile: + +.. code-block:: bash + + make test + +.. note:: + + You'll need to install node.js v8 or newer in order to perform integration + tests on Guzzle's HTTP handlers. + + +Reporting a security vulnerability +================================== + +We want to ensure that Guzzle is a secure HTTP client library for everyone. If +you've discovered a security vulnerability in Guzzle, we appreciate your help +in disclosing it to us in a `responsible manner `_. + +Publicly disclosing a vulnerability can put the entire community at risk. If +you've discovered a security concern, please email us at +security@guzzlephp.org. We'll work with you to make sure that we understand the +scope of the issue, and that we fully address your concern. We consider +correspondence sent to security@guzzlephp.org our highest priority, and work to +address any issues that arise as quickly as possible. + +After a security vulnerability has been corrected, a security hotfix release will +be deployed as soon as possible. diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/psr7.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/psr7.rst new file mode 100644 index 0000000000..c3aa7fe2e1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/psr7.rst @@ -0,0 +1,456 @@ +================ +Guzzle and PSR-7 +================ + +Guzzle utilizes PSR-7 as the HTTP message interface. This allows Guzzle to work +with any other library that utilizes PSR-7 message interfaces. + +Guzzle is an HTTP client that sends HTTP requests to a server and receives HTTP +responses. Both requests and responses are referred to as messages. + +Guzzle relies on the ``guzzlehttp/psr7`` Composer package for its message +implementation of PSR-7. + +You can create a request using the ``GuzzleHttp\Psr7\Request`` class: + +.. code-block:: php + + use GuzzleHttp\Psr7\Request; + + $request = new Request('GET', 'http://httpbin.org/get'); + + // You can provide other optional constructor arguments. + $headers = ['X-Foo' => 'Bar']; + $body = 'hello!'; + $request = new Request('PUT', 'http://httpbin.org/put', $headers, $body); + +You can create a response using the ``GuzzleHttp\Psr7\Response`` class: + +.. code-block:: php + + use GuzzleHttp\Psr7\Response; + + // The constructor requires no arguments. + $response = new Response(); + echo $response->getStatusCode(); // 200 + echo $response->getProtocolVersion(); // 1.1 + + // You can supply any number of optional arguments. + $status = 200; + $headers = ['X-Foo' => 'Bar']; + $body = 'hello!'; + $protocol = '1.1'; + $response = new Response($status, $headers, $body, $protocol); + + +Headers +======= + +Both request and response messages contain HTTP headers. + + +Accessing Headers +----------------- + +You can check if a request or response has a specific header using the +``hasHeader()`` method. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $request = new Psr7\Request('GET', '/', ['X-Foo' => 'bar']); + + if ($request->hasHeader('X-Foo')) { + echo 'It is there'; + } + +You can retrieve all the header values as an array of strings using +``getHeader()``. + +.. code-block:: php + + $request->getHeader('X-Foo'); // ['bar'] + + // Retrieving a missing header returns an empty array. + $request->getHeader('X-Bar'); // [] + +You can iterate over the headers of a message using the ``getHeaders()`` +method. + +.. code-block:: php + + foreach ($request->getHeaders() as $name => $values) { + echo $name . ': ' . implode(', ', $values) . "\r\n"; + } + + +Complex Headers +--------------- + +Some headers contain additional key value pair information. For example, Link +headers contain a link and several key value pairs: + +:: + + ; rel="thing"; type="image/jpeg" + +Guzzle provides a convenience feature that can be used to parse these types of +headers: + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $request = new Psr7\Request('GET', '/', [ + 'Link' => '; rel="front"; type="image/jpeg"' + ]); + + $parsed = Psr7\Header::parse($request->getHeader('Link')); + var_export($parsed); + +Will output: + +.. code-block:: php + + array ( + 0 => + array ( + 0 => '', + 'rel' => 'front', + 'type' => 'image/jpeg', + ), + ) + +The result contains a hash of key value pairs. Header values that have no key +(i.e., the link) are indexed numerically while headers parts that form a key +value pair are added as a key value pair. + + +Body +==== + +Both request and response messages can contain a body. + +You can retrieve the body of a message using the ``getBody()`` method: + +.. code-block:: php + + $response = GuzzleHttp\get('http://httpbin.org/get'); + echo $response->getBody(); + // JSON string: { ... } + +The body used in request and response objects is a +``Psr\Http\Message\StreamInterface``. This stream is used for both +uploading data and downloading data. Guzzle will, by default, store the body of +a message in a stream that uses PHP temp streams. When the size of the body +exceeds 2 MB, the stream will automatically switch to storing data on disk +rather than in memory (protecting your application from memory exhaustion). + +The easiest way to create a body for a message is using the ``streamFor`` +method from the ``GuzzleHttp\Psr7\Utils`` class -- +``Utils::streamFor``. This method accepts strings, resources, +callables, iterators, other streamables, and returns an instance of +``Psr\Http\Message\StreamInterface``. + +The body of a request or response can be cast to a string or you can read and +write bytes off of the stream as needed. + +.. code-block:: php + + use GuzzleHttp\Stream\Stream; + $response = $client->request('GET', 'http://httpbin.org/get'); + + echo $response->getBody()->read(4); + echo $response->getBody()->read(4); + echo $response->getBody()->read(1024); + var_export($response->eof()); + + +Requests +======== + +Requests are sent from a client to a server. Requests include the method to +be applied to a resource, the identifier of the resource, and the protocol +version to use. + + +Request Methods +--------------- + +When creating a request, you are expected to provide the HTTP method you wish +to perform. You can specify any method you'd like, including a custom method +that might not be part of RFC 7231 (like "MOVE"). + +.. code-block:: php + + // Create a request using a completely custom HTTP method + $request = new \GuzzleHttp\Psr7\Request('MOVE', 'http://httpbin.org/move'); + + echo $request->getMethod(); + // MOVE + +You can create and send a request using methods on a client that map to the +HTTP method you wish to use. + +:GET: ``$client->get('http://httpbin.org/get', [/** options **/])`` +:POST: ``$client->post('http://httpbin.org/post', [/** options **/])`` +:HEAD: ``$client->head('http://httpbin.org/get', [/** options **/])`` +:PUT: ``$client->put('http://httpbin.org/put', [/** options **/])`` +:DELETE: ``$client->delete('http://httpbin.org/delete', [/** options **/])`` +:OPTIONS: ``$client->options('http://httpbin.org/get', [/** options **/])`` +:PATCH: ``$client->patch('http://httpbin.org/put', [/** options **/])`` + +For example: + +.. code-block:: php + + $response = $client->patch('http://httpbin.org/patch', ['body' => 'content']); + + +Request URI +----------- + +The request URI is represented by a ``Psr\Http\Message\UriInterface`` object. +Guzzle provides an implementation of this interface using the +``GuzzleHttp\Psr7\Uri`` class. + +When creating a request, you can provide the URI as a string or an instance of +``Psr\Http\Message\UriInterface``. + +.. code-block:: php + + $response = $client->request('GET', 'http://httpbin.org/get?q=foo'); + + +Scheme +------ + +The `scheme `_ of a +request specifies the protocol to use when sending the request. When using +Guzzle, the scheme can be set to "http" or "https". + +.. code-block:: php + + $request = new Request('GET', 'http://httpbin.org'); + echo $request->getUri()->getScheme(); // http + echo $request->getUri(); // http://httpbin.org + + +Host +---- + +The host is accessible using the URI owned by the request or by accessing the +Host header. + +.. code-block:: php + + $request = new Request('GET', 'http://httpbin.org'); + echo $request->getUri()->getHost(); // httpbin.org + echo $request->getHeader('Host'); // httpbin.org + + +Port +---- + +No port is necessary when using the "http" or "https" schemes. + +.. code-block:: php + + $request = new Request('GET', 'http://httpbin.org:8080'); + echo $request->getUri()->getPort(); // 8080 + echo $request->getUri(); // http://httpbin.org:8080 + + +Path +---- + +The path of a request is accessible via the URI object. + +.. code-block:: php + + $request = new Request('GET', 'http://httpbin.org/get'); + echo $request->getUri()->getPath(); // /get + +The contents of the path will be automatically filtered to ensure that only +allowed characters are present in the path. Any characters that are not allowed +in the path will be percent-encoded according to +`RFC 3986 section 3.3 `_ + + +Query string +------------ + +The query string of a request can be accessed using the ``getQuery()`` of the +URI object owned by the request. + +.. code-block:: php + + $request = new Request('GET', 'http://httpbin.org/?foo=bar'); + echo $request->getUri()->getQuery(); // foo=bar + +The contents of the query string will be automatically filtered to ensure that +only allowed characters are present in the query string. Any characters that +are not allowed in the query string will be percent-encoded according to +`RFC 3986 section 3.4 `_ + + +Responses +========= + +Responses are the HTTP messages a client receives from a server after sending +an HTTP request message. + + +Start-Line +---------- + +The start-line of a response contains the protocol and protocol version, +status code, and reason phrase. + +.. code-block:: php + + $client = new \GuzzleHttp\Client(); + $response = $client->request('GET', 'http://httpbin.org/get'); + + echo $response->getStatusCode(); // 200 + echo $response->getReasonPhrase(); // OK + echo $response->getProtocolVersion(); // 1.1 + + +Body +---- + +As described earlier, you can get the body of a response using the +``getBody()`` method. + +.. code-block:: php + + $body = $response->getBody(); + echo $body; + // Cast to a string: { ... } + $body->seek(0); + // Rewind the body + $body->read(1024); + // Read bytes of the body + + +Streams +======= + +Guzzle uses PSR-7 stream objects to represent request and response message +bodies. These stream objects allow you to work with various types of data all +using a common interface. + +HTTP messages consist of a start-line, headers, and a body. The body of an HTTP +message can be very small or extremely large. Attempting to represent the body +of a message as a string can easily consume more memory than intended because +the body must be stored completely in memory. Attempting to store the body of a +request or response in memory would preclude the use of that implementation from +being able to work with large message bodies. The StreamInterface is used in +order to hide the implementation details of where a stream of data is read from +or written to. + +The PSR-7 ``Psr\Http\Message\StreamInterface`` exposes several methods +that enable streams to be read from, written to, and traversed effectively. + +Streams expose their capabilities using three methods: ``isReadable()``, +``isWritable()``, and ``isSeekable()``. These methods can be used by stream +collaborators to determine if a stream is capable of their requirements. + +Each stream instance has various capabilities: they can be read-only, +write-only, read-write, allow arbitrary random access (seeking forwards or +backwards to any location), or only allow sequential access (for example in the +case of a socket or pipe). + +Guzzle uses the ``guzzlehttp/psr7`` package to provide stream support. More +information on using streams, creating streams, converting streams to PHP +stream resource, and stream decorators can be found in the +`Guzzle PSR-7 documentation `_. + + +Creating Streams +---------------- + +The best way to create a stream is using the ``GuzzleHttp\Psr7\Utils::streamFor`` +method. This method accepts strings, resources returned from ``fopen()``, +an object that implements ``__toString()``, iterators, callables, and instances +of ``Psr\Http\Message\StreamInterface``. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $stream = Psr7\Utils::streamFor('string data'); + echo $stream; + // string data + echo $stream->read(3); + // str + echo $stream->getContents(); + // ing data + var_export($stream->eof()); + // true + var_export($stream->tell()); + // 11 + +You can create streams from iterators. The iterator can yield any number of +bytes per iteration. Any excess bytes returned by the iterator that were not +requested by a stream consumer will be buffered until a subsequent read. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield '.'; + } + }; + + $iter = $generator(1024); + $stream = Psr7\Utils::streamFor($iter); + echo $stream->read(3); // ... + + +Metadata +-------- + +Streams expose stream metadata through the ``getMetadata()`` method. This +method provides the data you would retrieve when calling PHP's +`stream_get_meta_data() function `_, +and can optionally expose other custom data. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $resource = Psr7\Utils::tryFopen('/path/to/file', 'r'); + $stream = Psr7\Utils::streamFor($resource); + echo $stream->getMetadata('uri'); + // /path/to/file + var_export($stream->isReadable()); + // true + var_export($stream->isWritable()); + // false + var_export($stream->isSeekable()); + // true + + +Stream Decorators +----------------- + +Adding custom functionality to streams is very simple with stream decorators. +Guzzle provides several built-in decorators that provide additional stream +functionality. + +- `AppendStream `_ +- `BufferStream `_ +- `CachingStream `_ +- `DroppingStream `_ +- `FnStream `_ +- `InflateStream `_ +- `LazyOpenStream `_ +- `LimitStream `_ +- `MultipartStream `_ +- `NoSeekStream `_ +- `PumpStream `_ diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/quickstart.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/quickstart.rst new file mode 100644 index 0000000000..78f282b3a0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/quickstart.rst @@ -0,0 +1,613 @@ +========== +Quickstart +========== + +This page provides a quick introduction to Guzzle and introductory examples. +If you have not already installed, Guzzle, head over to the :ref:`installation` +page. + + +Making a Request +================ + +You can send requests with Guzzle using a ``GuzzleHttp\ClientInterface`` +object. + + +Creating a Client +----------------- + +.. code-block:: php + + use GuzzleHttp\Client; + + $client = new Client([ + // Base URI is used with relative requests + 'base_uri' => 'http://httpbin.org', + // You can set any number of default request options. + 'timeout' => 2.0, + ]); + +Clients are immutable in Guzzle, which means that you cannot change the defaults used by a client after it's created. + +The client constructor accepts an associative array of options: + +``base_uri`` + (string|UriInterface) Base URI of the client that is merged into relative + URIs. Can be a string or instance of UriInterface. When a relative URI + is provided to a client, the client will combine the base URI with the + relative URI using the rules described in + `RFC 3986, section 5.2 `_. + + .. code-block:: php + + // Create a client with a base URI + $client = new GuzzleHttp\Client(['base_uri' => 'https://foo.com/api/']); + // Send a request to https://foo.com/api/test + $response = $client->request('GET', 'test'); + // Send a request to https://foo.com/root + $response = $client->request('GET', '/root'); + + Don't feel like reading RFC 3986? Here are some quick examples on how a + ``base_uri`` is resolved with another URI. + + ======================= ================== =============================== + base_uri URI Result + ======================= ================== =============================== + ``http://foo.com`` ``/bar`` ``http://foo.com/bar`` + ``http://foo.com/foo`` ``/bar`` ``http://foo.com/bar`` + ``http://foo.com/foo`` ``bar`` ``http://foo.com/bar`` + ``http://foo.com/foo/`` ``bar`` ``http://foo.com/foo/bar`` + ``http://foo.com/foo/`` ``/bar`` ``http://foo.com/bar`` + ``http://foo.com`` ``http://baz.com`` ``http://baz.com`` + ``http://foo.com/?bar`` ``bar`` ``http://foo.com/bar`` + ======================= ================== =============================== + +``handler`` + (callable) Function that transfers HTTP requests over the wire. The + function is called with a ``Psr7\Http\Message\RequestInterface`` and array + of transfer options, and must return a + ``GuzzleHttp\Promise\PromiseInterface`` that is fulfilled with a + ``Psr7\Http\Message\ResponseInterface`` on success. + +``...`` + (mixed) All other options passed to the constructor are used as default + request options with every request created by the client. + + +Sending Requests +---------------- + +Magic methods on the client make it easy to send synchronous requests: + +.. code-block:: php + + $response = $client->get('http://httpbin.org/get'); + $response = $client->delete('http://httpbin.org/delete'); + $response = $client->head('http://httpbin.org/get'); + $response = $client->options('http://httpbin.org/get'); + $response = $client->patch('http://httpbin.org/patch'); + $response = $client->post('http://httpbin.org/post'); + $response = $client->put('http://httpbin.org/put'); + +You can create a request and then send the request with the client when you're +ready: + +.. code-block:: php + + use GuzzleHttp\Psr7\Request; + + $request = new Request('PUT', 'http://httpbin.org/put'); + $response = $client->send($request, ['timeout' => 2]); + +Client objects provide a great deal of flexibility in how request are +transferred including default request options, default handler stack middleware +that are used by each request, and a base URI that allows you to send requests +with relative URIs. + +You can find out more about client middleware in the +:doc:`handlers-and-middleware` page of the documentation. + + +Async Requests +-------------- + +You can send asynchronous requests using the magic methods provided by a client: + +.. code-block:: php + + $promise = $client->getAsync('http://httpbin.org/get'); + $promise = $client->deleteAsync('http://httpbin.org/delete'); + $promise = $client->headAsync('http://httpbin.org/get'); + $promise = $client->optionsAsync('http://httpbin.org/get'); + $promise = $client->patchAsync('http://httpbin.org/patch'); + $promise = $client->postAsync('http://httpbin.org/post'); + $promise = $client->putAsync('http://httpbin.org/put'); + +You can also use the `sendAsync()` and `requestAsync()` methods of a client: + +.. code-block:: php + + use GuzzleHttp\Psr7\Request; + + // Create a PSR-7 request object to send + $headers = ['X-Foo' => 'Bar']; + $body = 'Hello!'; + $request = new Request('HEAD', 'http://httpbin.org/head', $headers, $body); + $promise = $client->sendAsync($request); + + // Or, if you don't need to pass in a request instance: + $promise = $client->requestAsync('GET', 'http://httpbin.org/get'); + +The promise returned by these methods implements the +`Promises/A+ spec `_, provided by the +`Guzzle promises library `_. This means +that you can chain ``then()`` calls off of the promise. These then calls are +either fulfilled with a successful ``Psr\Http\Message\ResponseInterface`` or +rejected with an exception. + +.. code-block:: php + + use Psr\Http\Message\ResponseInterface; + use GuzzleHttp\Exception\RequestException; + + $promise = $client->requestAsync('GET', 'http://httpbin.org/get'); + $promise->then( + function (ResponseInterface $res) { + echo $res->getStatusCode() . "\n"; + }, + function (RequestException $e) { + echo $e->getMessage() . "\n"; + echo $e->getRequest()->getMethod(); + } + ); + + +Concurrent requests +------------------- + +You can send multiple requests concurrently using promises and asynchronous +requests. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\Promise; + + $client = new Client(['base_uri' => 'http://httpbin.org/']); + + // Initiate each request but do not block + $promises = [ + 'image' => $client->getAsync('/image'), + 'png' => $client->getAsync('/image/png'), + 'jpeg' => $client->getAsync('/image/jpeg'), + 'webp' => $client->getAsync('/image/webp') + ]; + + // Wait for the requests to complete; throws a ConnectException + // if any of the requests fail + $responses = Promise\Utils::unwrap($promises); + + // You can access each response using the key of the promise + echo $responses['image']->getHeader('Content-Length')[0]; + echo $responses['png']->getHeader('Content-Length')[0]; + + // Wait for the requests to complete, even if some of them fail + $responses = Promise\Utils::settle($promises)->wait(); + + // Values returned above are wrapped in an array with 2 keys: "state" (either fulfilled or rejected) and "value" (contains the response) + echo $responses['image']['state']; // returns "fulfilled" + echo $responses['image']['value']->getHeader('Content-Length')[0]; + echo $responses['png']['value']->getHeader('Content-Length')[0]; + +You can use the ``GuzzleHttp\Pool`` object when you have an indeterminate +amount of requests you wish to send. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\Exception\RequestException; + use GuzzleHttp\Pool; + use GuzzleHttp\Psr7\Request; + use GuzzleHttp\Psr7\Response; + + $client = new Client(); + + $requests = function ($total) { + $uri = 'http://127.0.0.1:8126/guzzle-server/perf'; + for ($i = 0; $i < $total; $i++) { + yield new Request('GET', $uri); + } + }; + + $pool = new Pool($client, $requests(100), [ + 'concurrency' => 5, + 'fulfilled' => function (Response $response, $index) { + // this is delivered each successful response + }, + 'rejected' => function (RequestException $reason, $index) { + // this is delivered each failed request + }, + ]); + + // Initiate the transfers and create a promise + $promise = $pool->promise(); + + // Force the pool of requests to complete. + $promise->wait(); + +Or using a closure that will return a promise once the pool calls the closure. + +.. code-block:: php + + $client = new Client(); + + $requests = function ($total) use ($client) { + $uri = 'http://127.0.0.1:8126/guzzle-server/perf'; + for ($i = 0; $i < $total; $i++) { + yield function() use ($client, $uri) { + return $client->getAsync($uri); + }; + } + }; + + $pool = new Pool($client, $requests(100)); + + +Using Responses +=============== + +In the previous examples, we retrieved a ``$response`` variable or we were +delivered a response from a promise. The response object implements a PSR-7 +response, ``Psr\Http\Message\ResponseInterface``, and contains lots of +helpful information. + +You can get the status code and reason phrase of the response: + +.. code-block:: php + + $code = $response->getStatusCode(); // 200 + $reason = $response->getReasonPhrase(); // OK + +You can retrieve headers from the response: + +.. code-block:: php + + // Check if a header exists. + if ($response->hasHeader('Content-Length')) { + echo "It exists"; + } + + // Get a header from the response. + echo $response->getHeader('Content-Length')[0]; + + // Get all of the response headers. + foreach ($response->getHeaders() as $name => $values) { + echo $name . ': ' . implode(', ', $values) . "\r\n"; + } + +The body of a response can be retrieved using the ``getBody`` method. The body +can be used as a string, cast to a string, or used as a stream like object. + +.. code-block:: php + + $body = $response->getBody(); + // Implicitly cast the body to a string and echo it + echo $body; + // Explicitly cast the body to a string + $stringBody = (string) $body; + // Read 10 bytes from the body + $tenBytes = $body->read(10); + // Read the remaining contents of the body as a string + $remainingBytes = $body->getContents(); + + +Query String Parameters +======================= + +You can provide query string parameters with a request in several ways. + +You can set query string parameters in the request's URI: + +.. code-block:: php + + $response = $client->request('GET', 'http://httpbin.org?foo=bar'); + +You can specify the query string parameters using the ``query`` request +option as an array. + +.. code-block:: php + + $client->request('GET', 'http://httpbin.org', [ + 'query' => ['foo' => 'bar'] + ]); + +Providing the option as an array will use PHP's ``http_build_query`` function +to format the query string. + +And finally, you can provide the ``query`` request option as a string. + +.. code-block:: php + + $client->request('GET', 'http://httpbin.org', ['query' => 'foo=bar']); + + +Uploading Data +============== + +Guzzle provides several methods for uploading data. + +You can send requests that contain a stream of data by passing a string, +resource returned from ``fopen``, or an instance of a +``Psr\Http\Message\StreamInterface`` to the ``body`` request option. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + // Provide the body as a string. + $r = $client->request('POST', 'http://httpbin.org/post', [ + 'body' => 'raw data' + ]); + + // Provide an fopen resource. + $body = Psr7\Utils::tryFopen('/path/to/file', 'r'); + $r = $client->request('POST', 'http://httpbin.org/post', ['body' => $body]); + + // Use the Utils::streamFor method to create a PSR-7 stream. + $body = Psr7\Utils::streamFor('hello!'); + $r = $client->request('POST', 'http://httpbin.org/post', ['body' => $body]); + +An easy way to upload JSON data and set the appropriate header is using the +``json`` request option: + +.. code-block:: php + + $r = $client->request('PUT', 'http://httpbin.org/put', [ + 'json' => ['foo' => 'bar'] + ]); + + +POST/Form Requests +------------------ + +In addition to specifying the raw data of a request using the ``body`` request +option, Guzzle provides helpful abstractions over sending POST data. + + +Sending form fields +~~~~~~~~~~~~~~~~~~~ + +Sending ``application/x-www-form-urlencoded`` POST requests requires that you +specify the POST fields as an array in the ``form_params`` request options. + +.. code-block:: php + + $response = $client->request('POST', 'http://httpbin.org/post', [ + 'form_params' => [ + 'field_name' => 'abc', + 'other_field' => '123', + 'nested_field' => [ + 'nested' => 'hello' + ] + ] + ]); + + +Sending form files +~~~~~~~~~~~~~~~~~~ + +You can send files along with a form (``multipart/form-data`` POST requests), +using the ``multipart`` request option. ``multipart`` accepts an array of +associative arrays, where each associative array contains the following keys: + +- name: (required, string) key mapping to the form field name. +- contents: (required, mixed) Provide a string to send the contents of the + file as a string, provide an fopen resource to stream the contents from a + PHP stream, or provide a ``Psr\Http\Message\StreamInterface`` to stream + the contents from a PSR-7 stream. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $response = $client->request('POST', 'http://httpbin.org/post', [ + 'multipart' => [ + [ + 'name' => 'field_name', + 'contents' => 'abc' + ], + [ + 'name' => 'file_name', + 'contents' => Psr7\Utils::tryFopen('/path/to/file', 'r') + ], + [ + 'name' => 'other_file', + 'contents' => 'hello', + 'filename' => 'filename.txt', + 'headers' => [ + 'X-Foo' => 'this is an extra header to include' + ] + ] + ] + ]); + + +Cookies +======= + +Guzzle can maintain a cookie session for you if instructed using the +``cookies`` request option. When sending a request, the ``cookies`` option +must be set to an instance of ``GuzzleHttp\Cookie\CookieJarInterface``. + +.. code-block:: php + + // Use a specific cookie jar + $jar = new \GuzzleHttp\Cookie\CookieJar; + $r = $client->request('GET', 'http://httpbin.org/cookies', [ + 'cookies' => $jar + ]); + +You can set ``cookies`` to ``true`` in a client constructor if you would like +to use a shared cookie jar for all requests. + +.. code-block:: php + + // Use a shared client cookie jar + $client = new \GuzzleHttp\Client(['cookies' => true]); + $r = $client->request('GET', 'http://httpbin.org/cookies'); + +Different implementations exist for the ``GuzzleHttp\Cookie\CookieJarInterface`` +: + +- The ``GuzzleHttp\Cookie\CookieJar`` class stores cookies as an array. +- The ``GuzzleHttp\Cookie\FileCookieJar`` class persists non-session cookies + using a JSON formatted file. +- The ``GuzzleHttp\Cookie\SessionCookieJar`` class persists cookies in the + client session. + +You can manually set cookies into a cookie jar with the named constructor +``fromArray(array $cookies, $domain)``. + +.. code-block:: php + + $jar = \GuzzleHttp\Cookie\CookieJar::fromArray( + [ + 'some_cookie' => 'foo', + 'other_cookie' => 'barbaz1234' + ], + 'example.org' + ); + +You can get a cookie by its name with the ``getCookieByName($name)`` method +which returns a ``GuzzleHttp\Cookie\SetCookie`` instance. + +.. code-block:: php + + $cookie = $jar->getCookieByName('some_cookie'); + + $cookie->getValue(); // 'foo' + $cookie->getDomain(); // 'example.org' + $cookie->getExpires(); // expiration date as a Unix timestamp + +The cookies can be also fetched into an array thanks to the `toArray()` method. +The ``GuzzleHttp\Cookie\CookieJarInterface`` interface extends +``Traversable`` so it can be iterated in a foreach loop. + + +Redirects +========= + +Guzzle will automatically follow redirects unless you tell it not to. You can +customize the redirect behavior using the ``allow_redirects`` request option. + +- Set to ``true`` to enable normal redirects with a maximum number of 5 + redirects. This is the default setting. +- Set to ``false`` to disable redirects. +- Pass an associative array containing the 'max' key to specify the maximum + number of redirects and optionally provide a 'strict' key value to specify + whether or not to use strict RFC compliant redirects (meaning redirect POST + requests with POST requests vs. doing what most browsers do which is + redirect POST requests with GET requests). + +.. code-block:: php + + $response = $client->request('GET', 'http://github.com'); + echo $response->getStatusCode(); + // 200 + +The following example shows that redirects can be disabled. + +.. code-block:: php + + $response = $client->request('GET', 'http://github.com', [ + 'allow_redirects' => false + ]); + echo $response->getStatusCode(); + // 301 + + +Exceptions +========== + +**Tree View** + +The following tree view describes how the Guzzle Exceptions depend +on each other. + +.. code-block:: none + + . \RuntimeException + └── TransferException (implements GuzzleException) + ├── ConnectException (implements NetworkExceptionInterface) + └── RequestException + ├── BadResponseException + │   ├── ServerException + │ └── ClientException + └── TooManyRedirectsException + +Guzzle throws exceptions for errors that occur during a transfer. + +- A ``GuzzleHttp\Exception\ConnectException`` exception is thrown in the + event of a networking error. This exception extends from + ``GuzzleHttp\Exception\TransferException``. + +- A ``GuzzleHttp\Exception\ClientException`` is thrown for 400 + level errors if the ``http_errors`` request option is set to true. This + exception extends from ``GuzzleHttp\Exception\BadResponseException`` and + ``GuzzleHttp\Exception\BadResponseException`` extends from + ``GuzzleHttp\Exception\RequestException``. + + .. code-block:: php + + use GuzzleHttp\Psr7; + use GuzzleHttp\Exception\ClientException; + + try { + $client->request('GET', 'https://github.com/_abc_123_404'); + } catch (ClientException $e) { + echo Psr7\Message::toString($e->getRequest()); + echo Psr7\Message::toString($e->getResponse()); + } + +- A ``GuzzleHttp\Exception\ServerException`` is thrown for 500 level + errors if the ``http_errors`` request option is set to true. This + exception extends from ``GuzzleHttp\Exception\BadResponseException``. + +- A ``GuzzleHttp\Exception\TooManyRedirectsException`` is thrown when too + many redirects are followed. This exception extends from ``GuzzleHttp\Exception\RequestException``. + +All of the above exceptions extend from +``GuzzleHttp\Exception\TransferException``. + + +Environment Variables +===================== + +Guzzle exposes a few environment variables that can be used to customize the +behavior of the library. + +``GUZZLE_CURL_SELECT_TIMEOUT`` + Controls the duration in seconds that a curl_multi_* handler will use when + selecting on curl handles using ``curl_multi_select()``. Some systems + have issues with PHP's implementation of ``curl_multi_select()`` where + calling this function always results in waiting for the maximum duration of + the timeout. +``HTTP_PROXY`` + Defines the proxy to use when sending requests using the "http" protocol. + + Note: because the HTTP_PROXY variable may contain arbitrary user input on some (CGI) environments, the variable is only used on the CLI SAPI. See https://httpoxy.org for more information. +``HTTPS_PROXY`` + Defines the proxy to use when sending requests using the "https" protocol. +``NO_PROXY`` + Defines URLs for which a proxy should not be used. See :ref:`proxy-option` for usage. + + +Relevant ini Settings +--------------------- + +Guzzle can utilize PHP ini settings when configuring clients. + +``openssl.cafile`` + Specifies the path on disk to a CA file in PEM format to use when sending + requests over "https". See: https://wiki.php.net/rfc/tls-peer-verification#phpini_defaults diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/request-options.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/request-options.rst new file mode 100644 index 0000000000..53ea057597 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/request-options.rst @@ -0,0 +1,1108 @@ +=============== +Request Options +=============== + +You can customize requests created and transferred by a client using +**request options**. Request options control various aspects of a request +including, headers, query string parameters, timeout settings, the body of a +request, and much more. + +All of the following examples use the following client: + +.. code-block:: php + + $client = new GuzzleHttp\Client(['base_uri' => 'http://httpbin.org']); + + +.. _allow_redirects-option: + +allow_redirects +--------------- + +:Summary: Describes the redirect behavior of a request +:Types: + - bool + - array +:Default: + + :: + + [ + 'max' => 5, + 'strict' => false, + 'referer' => false, + 'protocols' => ['http', 'https'], + 'track_redirects' => false + ] + +:Constant: ``GuzzleHttp\RequestOptions::ALLOW_REDIRECTS`` + +Set to ``false`` to disable redirects. + +.. code-block:: php + + $res = $client->request('GET', '/redirect/3', ['allow_redirects' => false]); + echo $res->getStatusCode(); + // 302 + +Set to ``true`` (the default setting) to enable normal redirects with a maximum +number of 5 redirects. + +.. code-block:: php + + $res = $client->request('GET', '/redirect/3'); + echo $res->getStatusCode(); + // 200 + +You can also pass an associative array containing the following key value +pairs: + +- max: (int, default=5) maximum number of allowed redirects. +- strict: (bool, default=false) Set to true to use strict redirects. + Strict RFC compliant redirects mean that POST redirect requests are sent as + POST requests vs. doing what most browsers do which is redirect POST requests + with GET requests. +- referer: (bool, default=false) Set to true to enable adding the Referer + header when redirecting. +- protocols: (array, default=['http', 'https']) Specified which protocols are + allowed for redirect requests. +- on_redirect: (callable) PHP callable that is invoked when a redirect + is encountered. The callable is invoked with the original request and the + redirect response that was received. Any return value from the on_redirect + function is ignored. +- track_redirects: (bool) When set to ``true``, each redirected URI and status + code encountered will be tracked in the ``X-Guzzle-Redirect-History`` and + ``X-Guzzle-Redirect-Status-History`` headers respectively. All URIs and + status codes will be stored in the order which the redirects were encountered. + + Note: When tracking redirects the ``X-Guzzle-Redirect-History`` header will + exclude the initial request's URI and the ``X-Guzzle-Redirect-Status-History`` + header will exclude the final status code. + +.. code-block:: php + + use Psr\Http\Message\RequestInterface; + use Psr\Http\Message\ResponseInterface; + use Psr\Http\Message\UriInterface; + + $onRedirect = function( + RequestInterface $request, + ResponseInterface $response, + UriInterface $uri + ) { + echo 'Redirecting! ' . $request->getUri() . ' to ' . $uri . "\n"; + }; + + $res = $client->request('GET', '/redirect/3', [ + 'allow_redirects' => [ + 'max' => 10, // allow at most 10 redirects. + 'strict' => true, // use "strict" RFC compliant redirects. + 'referer' => true, // add a Referer header + 'protocols' => ['https'], // only allow https URLs + 'on_redirect' => $onRedirect, + 'track_redirects' => true + ] + ]); + + echo $res->getStatusCode(); + // 200 + + echo $res->getHeaderLine('X-Guzzle-Redirect-History'); + // http://first-redirect, http://second-redirect, etc... + + echo $res->getHeaderLine('X-Guzzle-Redirect-Status-History'); + // 301, 302, etc... + +.. warning:: + + This option only has an effect if your handler has the + ``GuzzleHttp\Middleware::redirect`` middleware. This middleware is added + by default when a client is created with no handler, and is added by + default when creating a handler with ``GuzzleHttp\HandlerStack::create``. + +.. note:: + + This option has **no** effect when making requests using ``GuzzleHttp\Client::sendRequest()``. In order to stay compliant with PSR-18 any redirect response is returned as is. + + +auth +---- + +:Summary: Pass an array of HTTP authentication parameters to use with the + request. The array must contain the username in index [0], the password in + index [1], and you can optionally provide a built-in authentication type in + index [2]. Pass ``null`` to disable authentication for a request. +:Types: + - array + - string + - null +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::AUTH`` + +The built-in authentication types are as follows: + +basic + Use `basic HTTP authentication `_ + in the ``Authorization`` header (the default setting used if none is + specified). + +.. code-block:: php + + $client->request('GET', '/get', ['auth' => ['username', 'password']]); + +digest + Use `digest authentication `_ + (must be supported by the HTTP handler). + +.. code-block:: php + + $client->request('GET', '/get', [ + 'auth' => ['username', 'password', 'digest'] + ]); + +.. note:: + + This is currently only supported when using the cURL handler, but + creating a replacement that can be used with any HTTP handler is + planned. + +ntlm + Use `Microsoft NTLM authentication `_ + (must be supported by the HTTP handler). + +.. code-block:: php + + $client->request('GET', '/get', [ + 'auth' => ['username', 'password', 'ntlm'] + ]); + +.. note:: + + This is currently only supported when using the cURL handler. + + +body +---- + +:Summary: The ``body`` option is used to control the body of an entity + enclosing request (e.g., PUT, POST, PATCH). +:Types: + - string + - ``fopen()`` resource + - ``Psr\Http\Message\StreamInterface`` +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::BODY`` + +This setting can be set to any of the following types: + +- string + + .. code-block:: php + + // You can send requests that use a string as the message body. + $client->request('PUT', '/put', ['body' => 'foo']); + +- resource returned from ``fopen()`` + + .. code-block:: php + + // You can send requests that use a stream resource as the body. + $resource = \GuzzleHttp\Psr7\Utils::tryFopen('http://httpbin.org', 'r'); + $client->request('PUT', '/put', ['body' => $resource]); + +- ``Psr\Http\Message\StreamInterface`` + + .. code-block:: php + + // You can send requests that use a Guzzle stream object as the body + $stream = GuzzleHttp\Psr7\Utils::streamFor('contents...'); + $client->request('POST', '/post', ['body' => $stream]); + +.. note:: + + This option cannot be used with ``form_params``, ``multipart``, or ``json`` + + +.. _cert-option: + +cert +---- + +:Summary: Set to a string to specify the path to a file containing a PEM + formatted client side certificate. If a password is required, then set to + an array containing the path to the PEM file in the first array element + followed by the password required for the certificate in the second array + element. +:Types: + - string + - array +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::CERT`` + +.. code-block:: php + + $client->request('GET', '/', ['cert' => ['/path/server.pem', 'password']]); + + +.. _cookies-option: + +cookies +------- + +:Summary: Specifies whether or not cookies are used in a request or what cookie + jar to use or what cookies to send. +:Types: ``GuzzleHttp\Cookie\CookieJarInterface`` +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::COOKIES`` + +You must specify the cookies option as a +``GuzzleHttp\Cookie\CookieJarInterface`` or ``false``. + +.. code-block:: php + + $jar = new \GuzzleHttp\Cookie\CookieJar(); + $client->request('GET', '/get', ['cookies' => $jar]); + +.. warning:: + + This option only has an effect if your handler has the + ``GuzzleHttp\Middleware::cookies`` middleware. This middleware is added + by default when a client is created with no handler, and is added by + default when creating a handler with ``GuzzleHttp\HandlerStack::create``. + +.. tip:: + + When creating a client, you can set the default cookie option to ``true`` + to use a shared cookie session associated with the client. + + +.. _connect_timeout-option: + +connect_timeout +--------------- + +:Summary: Float describing the number of seconds to wait while trying to connect + to a server. Use ``0`` to wait 300 seconds (the default behavior). +:Types: float +:Default: ``0`` +:Constant: ``GuzzleHttp\RequestOptions::CONNECT_TIMEOUT`` + +.. code-block:: php + + // Timeout if the client fails to connect to the server in 3.14 seconds. + $client->request('GET', '/delay/5', ['connect_timeout' => 3.14]); + +.. note:: + + This setting must be supported by the HTTP handler used to send a request. + ``connect_timeout`` is currently only supported by the built-in cURL + handler. + + +.. _crypto_method-option: + +crypto_method +--------------- + +:Summary: A value describing the minimum TLS protocol version to use. +:Types: int +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::CRYPTO_METHOD`` + +.. code-block:: php + + $client->request('GET', '/foo', ['crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT]); + +.. note:: + + This setting must be set to one of the ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` + constants. PHP 7.4 or higher is required in order to use TLS 1.3, and cURL + 7.34.0 or higher is required in order to specify a crypto method, with cURL + 7.52.0 or higher being required to use TLS 1.3. + + +.. _debug-option: + +debug +----- + +:Summary: Set to ``true`` or set to a PHP stream returned by ``fopen()`` to + enable debug output with the handler used to send a request. For example, + when using cURL to transfer requests, cURL's verbose of ``CURLOPT_VERBOSE`` + will be emitted. When using the PHP stream wrapper, stream wrapper + notifications will be emitted. If set to true, the output is written to + PHP's STDOUT. If a PHP stream is provided, output is written to the stream. +:Types: + - bool + - ``fopen()`` resource +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::DEBUG`` + +.. code-block:: php + + $client->request('GET', '/get', ['debug' => true]); + +Running the above example would output something like the following: + +:: + + * About to connect() to httpbin.org port 80 (#0) + * Trying 107.21.213.98... * Connected to httpbin.org (107.21.213.98) port 80 (#0) + > GET /get HTTP/1.1 + Host: httpbin.org + User-Agent: Guzzle/4.0 curl/7.21.4 PHP/5.5.7 + + < HTTP/1.1 200 OK + < Access-Control-Allow-Origin: * + < Content-Type: application/json + < Date: Sun, 16 Feb 2014 06:50:09 GMT + < Server: gunicorn/0.17.4 + < Content-Length: 335 + < Connection: keep-alive + < + * Connection #0 to host httpbin.org left intact + + +.. _decode_content-option: + +decode_content +-------------- + +:Summary: Specify whether or not ``Content-Encoding`` responses (gzip, + deflate, etc.) are automatically decoded. +:Types: + - string + - bool +:Default: ``true`` +:Constant: ``GuzzleHttp\RequestOptions::DECODE_CONTENT`` + +This option can be used to control how content-encoded response bodies are +handled. By default, ``decode_content`` is set to true, meaning any gzipped +or deflated response will be decoded by Guzzle. + +When set to ``false``, the body of a response is never decoded, meaning the +bytes pass through the handler unchanged. + +.. code-block:: php + + // Request gzipped data, but do not decode it while downloading + $client->request('GET', '/foo.js', [ + 'headers' => ['Accept-Encoding' => 'gzip'], + 'decode_content' => false + ]); + +When set to a string, the bytes of a response are decoded and the string value +provided to the ``decode_content`` option is passed as the ``Accept-Encoding`` +header of the request. + +.. code-block:: php + + // Pass "gzip" as the Accept-Encoding header. + $client->request('GET', '/foo.js', ['decode_content' => 'gzip']); + +.. warning:: + + The ``Accept-Encoding`` header will not be sent unless you provide it + explicitly, or pass a string value to ``decode_content``. That is + `equivalent ` + to sending ``Accept-Encoding: *``. Most servers will probably + return an uncompressed body in response to that but some might opt + to use a compression method that is not supported by your system. + + In order to enable compression, and to ensure that only supported + encoding methods will be used, you should let curl send + the ``Accept-Encoding`` header: + + .. code-block:: php + + // Delegate choosing compression method to curl + $client->request('GET', '/foo.js', [ + 'curl' => [ + \CURLOPT_ENCODING => '', + ], + ]); + + +.. _delay-option: + +delay +----- + +:Summary: The number of milliseconds to delay before sending the request. +:Types: + - integer + - float +:Default: null +:Constant: ``GuzzleHttp\RequestOptions::DELAY`` + + +.. _expect-option: + +expect +------ + +:Summary: Controls the behavior of the "Expect: 100-Continue" header. +:Types: + - bool + - integer +:Default: ``1048576`` +:Constant: ``GuzzleHttp\RequestOptions::EXPECT`` + +Set to ``true`` to enable the "Expect: 100-Continue" header for all requests +that sends a body. Set to ``false`` to disable the "Expect: 100-Continue" +header for all requests. Set to a number so that the size of the payload must +be greater than the number in order to send the Expect header. Setting to a +number will send the Expect header for all requests in which the size of the +payload cannot be determined or where the body is not rewindable. + +By default, Guzzle will add the "Expect: 100-Continue" header when the size of +the body of a request is greater than 1 MB and a request is using HTTP/1.1. + +.. note:: + + This option only takes effect when using HTTP/1.1. The HTTP/1.0 and + HTTP/2.0 protocols do not support the "Expect: 100-Continue" header. + Support for handling the "Expect: 100-Continue" workflow must be + implemented by Guzzle HTTP handlers used by a client. + + +force_ip_resolve +---------------- + +:Summary: Set to "v4" if you want the HTTP handlers to use only ipv4 protocol or "v6" for ipv6 protocol. +:Types: string +:Default: null +:Constant: ``GuzzleHttp\RequestOptions::FORCE_IP_RESOLVE`` + +.. code-block:: php + + // Force ipv4 protocol + $client->request('GET', '/foo', ['force_ip_resolve' => 'v4']); + + // Force ipv6 protocol + $client->request('GET', '/foo', ['force_ip_resolve' => 'v6']); + +.. note:: + + This setting must be supported by the HTTP handler used to send a request. + ``force_ip_resolve`` is currently only supported by the built-in cURL + and stream handlers. + + +form_params +----------- + +:Summary: Used to send an `application/x-www-form-urlencoded` POST request. +:Types: array +:Constant: ``GuzzleHttp\RequestOptions::FORM_PARAMS`` + +Associative array of form field names to values where each value is a string or +array of strings. Sets the Content-Type header to +application/x-www-form-urlencoded when no Content-Type header is already +present. + +.. code-block:: php + + $client->request('POST', '/post', [ + 'form_params' => [ + 'foo' => 'bar', + 'baz' => ['hi', 'there!'] + ] + ]); + +.. note:: + + ``form_params`` cannot be used with the ``multipart`` option. You will need to use + one or the other. Use ``form_params`` for ``application/x-www-form-urlencoded`` + requests, and ``multipart`` for ``multipart/form-data`` requests. + + This option cannot be used with ``body``, ``multipart``, or ``json`` + + +headers +------- + +:Summary: Associative array of headers to add to the request. Each key is the + name of a header, and each value is a string or array of strings + representing the header field values. +:Types: array +:Defaults: None +:Constant: ``GuzzleHttp\RequestOptions::HEADERS`` + +.. code-block:: php + + // Set various headers on a request + $client->request('GET', '/get', [ + 'headers' => [ + 'User-Agent' => 'testing/1.0', + 'Accept' => 'application/json', + 'X-Foo' => ['Bar', 'Baz'] + ] + ]); + +Headers may be added as default options when creating a client. When headers +are used as default options, they are only applied if the request being created +does not already contain the specific header. This includes both requests passed +to the client in the ``send()`` and ``sendAsync()`` methods, and requests +created by the client (e.g., ``request()`` and ``requestAsync()``). + +.. code-block:: php + + $client = new GuzzleHttp\Client(['headers' => ['X-Foo' => 'Bar']]); + + // Will send a request with the X-Foo header. + $client->request('GET', '/get'); + + // Sets the X-Foo header to "test", which prevents the default header + // from being applied. + $client->request('GET', '/get', ['headers' => ['X-Foo' => 'test']]); + + // Will disable adding in default headers. + $client->request('GET', '/get', ['headers' => null]); + + // Will not overwrite the X-Foo header because it is in the message. + use GuzzleHttp\Psr7\Request; + $request = new Request('GET', 'http://foo.com', ['X-Foo' => 'test']); + $client->send($request); + + // Will overwrite the X-Foo header with the request option provided in the + // send method. + use GuzzleHttp\Psr7\Request; + $request = new Request('GET', 'http://foo.com', ['X-Foo' => 'test']); + $client->send($request, ['headers' => ['X-Foo' => 'overwrite']]); + + +.. _http-errors-option: + +http_errors +----------- + +:Summary: Set to ``false`` to disable throwing exceptions on an HTTP protocol + errors (i.e., 4xx and 5xx responses). Exceptions are thrown by default when + HTTP protocol errors are encountered. +:Types: bool +:Default: ``true`` +:Constant: ``GuzzleHttp\RequestOptions::HTTP_ERRORS`` + +.. code-block:: php + + $client->request('GET', '/status/500'); + // Throws a GuzzleHttp\Exception\ServerException + + $res = $client->request('GET', '/status/500', ['http_errors' => false]); + echo $res->getStatusCode(); + // 500 + +.. warning:: + + This option only has an effect if your handler has the + ``GuzzleHttp\Middleware::httpErrors`` middleware. This middleware is added + by default when a client is created with no handler, and is added by + default when creating a handler with ``GuzzleHttp\HandlerStack::create``. + + +idn_conversion +-------------- + +:Summary: Internationalized Domain Name (IDN) support. +:Types: + - bool + - int +:Default: ``false`` +:Constant: ``GuzzleHttp\RequestOptions::IDN_CONVERSION`` + +.. code-block:: php + + $client->request('GET', 'https://яндекс.рф'); + // яндекс.рф is translated to xn--d1acpjx3f.xn--p1ai before passing it to the handler + + $res = $client->request('GET', 'https://яндекс.рф', ['idn_conversion' => false]); + // The domain part (яндекс.рф) stays unmodified + +Enables/disables IDN support, can also be used for precise control by combining +IDNA_* constants (except IDNA_ERROR_*), see ``$options`` parameter in +`idn_to_ascii() `_ +documentation for more details. + + +json +---- + +:Summary: The ``json`` option is used to easily upload JSON encoded data as the + body of a request. A Content-Type header of ``application/json`` will be + added if no Content-Type header is already present on the message. +:Types: + Any PHP type that can be operated on by PHP's ``json_encode()`` function. +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::JSON`` + +.. code-block:: php + + $response = $client->request('PUT', '/put', ['json' => ['foo' => 'bar']]); + +Here's an example of using the ``tap`` middleware to see what request is sent +over the wire. + +.. code-block:: php + + use GuzzleHttp\Middleware; + + // Create a middleware that echoes parts of the request. + $tapMiddleware = Middleware::tap(function ($request) { + echo $request->getHeaderLine('Content-Type'); + // application/json + echo $request->getBody(); + // {"foo":"bar"} + }); + + // The $handler variable is the handler passed in the + // options to the client constructor. + $response = $client->request('PUT', '/put', [ + 'json' => ['foo' => 'bar'], + 'handler' => $tapMiddleware($handler) + ]); + +.. note:: + + This request option does not support customizing the Content-Type header + or any of the options from PHP's `json_encode() `_ + function. If you need to customize these settings, then you must pass the + JSON encoded data into the request yourself using the ``body`` request + option and you must specify the correct Content-Type header using the + ``headers`` request option. + + This option cannot be used with ``body``, ``form_params``, or ``multipart`` + + +multipart +--------- + +:Summary: Sets the body of the request to a `multipart/form-data` form. +:Types: array +:Constant: ``GuzzleHttp\RequestOptions::MULTIPART`` + +The value of ``multipart`` is an array of associative arrays, each containing +the following key value pairs: + +- ``name``: (string, required) the form field name +- ``contents``: (StreamInterface/resource/string, required) The data to use in + the form element. +- ``headers``: (array) Optional associative array of custom headers to use with + the form element. +- ``filename``: (string) Optional string to send as the filename in the part. + +.. code-block:: php + + use GuzzleHttp\Psr7; + + $client->request('POST', '/post', [ + 'multipart' => [ + [ + 'name' => 'foo', + 'contents' => 'data', + 'headers' => ['X-Baz' => 'bar'] + ], + [ + 'name' => 'baz', + 'contents' => Psr7\Utils::tryFopen('/path/to/file', 'r') + ], + [ + 'name' => 'qux', + 'contents' => Psr7\Utils::tryFopen('/path/to/file', 'r'), + 'filename' => 'custom_filename.txt' + ], + ] + ]); + +.. note:: + + ``multipart`` cannot be used with the ``form_params`` option. You will need to + use one or the other. Use ``form_params`` for ``application/x-www-form-urlencoded`` + requests, and ``multipart`` for ``multipart/form-data`` requests. + + This option cannot be used with ``body``, ``form_params``, or ``json`` + + +.. _on-headers: + +on_headers +---------- + +:Summary: A callable that is invoked when the HTTP headers of the response have + been received but the body has not yet begun to download. +:Types: - callable +:Constant: ``GuzzleHttp\RequestOptions::ON_HEADERS`` + +The callable accepts a ``Psr\Http\Message\ResponseInterface`` object. If an exception +is thrown by the callable, then the promise associated with the response will +be rejected with a ``GuzzleHttp\Exception\RequestException`` that wraps the +exception that was thrown. + +You may need to know what headers and status codes were received before data +can be written to the sink. + +.. code-block:: php + + // Reject responses that are greater than 1024 bytes. + $client->request('GET', 'http://httpbin.org/stream/1024', [ + 'on_headers' => function (ResponseInterface $response) { + if ($response->getHeaderLine('Content-Length') > 1024) { + throw new \Exception('The file is too big!'); + } + } + ]); + +.. note:: + + When writing HTTP handlers, the ``on_headers`` function must be invoked + before writing data to the body of the response. + + +.. _on_stats: + +on_stats +-------- + +:Summary: ``on_stats`` allows you to get access to transfer statistics of a + request and access the lower level transfer details of the handler + associated with your client. ``on_stats`` is a callable that is invoked + when a handler has finished sending a request. The callback is invoked + with transfer statistics about the request, the response received, or the + error encountered. Included in the data is the total amount of time taken + to send the request. +:Types: - callable +:Constant: ``GuzzleHttp\RequestOptions::ON_STATS`` + +The callable accepts a ``GuzzleHttp\TransferStats`` object. + +.. code-block:: php + + use GuzzleHttp\TransferStats; + + $client = new GuzzleHttp\Client(); + + $client->request('GET', 'http://httpbin.org/stream/1024', [ + 'on_stats' => function (TransferStats $stats) { + echo $stats->getEffectiveUri() . "\n"; + echo $stats->getTransferTime() . "\n"; + var_dump($stats->getHandlerStats()); + + // You must check if a response was received before using the + // response object. + if ($stats->hasResponse()) { + echo $stats->getResponse()->getStatusCode(); + } else { + // Error data is handler specific. You will need to know what + // type of error data your handler uses before using this + // value. + var_dump($stats->getHandlerErrorData()); + } + } + ]); + + +progress +-------- + +:Summary: Defines a function to invoke when transfer progress is made. +:Types: - callable +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::PROGRESS`` + +The function accepts the following positional arguments: + +- the total number of bytes expected to be downloaded, zero if unknown +- the number of bytes downloaded so far +- the total number of bytes expected to be uploaded +- the number of bytes uploaded so far + +.. code-block:: php + + // Send a GET request to /get?foo=bar + $result = $client->request( + 'GET', + '/', + [ + 'progress' => function( + $downloadTotal, + $downloadedBytes, + $uploadTotal, + $uploadedBytes + ) { + //do something + }, + ] + ); + + +.. _proxy-option: + +proxy +----- + +:Summary: Pass a string to specify an HTTP proxy, or an array to specify + different proxies for different protocols. +:Types: + - string + - array +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::PROXY`` + +Pass a string to specify a proxy for all protocols. + +.. code-block:: php + + $client->request('GET', '/', ['proxy' => 'http://localhost:8125']); + +Pass an associative array to specify HTTP proxies for specific URI schemes +(i.e., "http", "https"). Provide a ``no`` key value pair to provide a list of +host names that should not be proxied to. + +.. note:: + + Guzzle will automatically populate this value with your environment's + ``NO_PROXY`` environment variable. However, when providing a ``proxy`` + request option, it is up to you to provide the ``no`` value parsed from + the ``NO_PROXY`` environment variable + (e.g., ``explode(',', getenv('NO_PROXY'))``). + +.. code-block:: php + + $client->request('GET', '/', [ + 'proxy' => [ + 'http' => 'http://localhost:8125', // Use this proxy with "http" + 'https' => 'http://localhost:9124', // Use this proxy with "https", + 'no' => ['.mit.edu', 'foo.com'] // Don't use a proxy with these + ] + ]); + +.. note:: + + You can provide proxy URLs that contain a scheme, username, and password. + For example, ``"http://username:password@192.168.16.1:10"``. + + +query +----- + +:Summary: Associative array of query string values or query string to add to + the request. +:Types: + - array + - string +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::QUERY`` + +.. code-block:: php + + // Send a GET request to /get?foo=bar + $client->request('GET', '/get', ['query' => ['foo' => 'bar']]); + +Query strings specified in the ``query`` option will overwrite all query string +values supplied in the URI of a request. + +.. code-block:: php + + // Send a GET request to /get?foo=bar + $client->request('GET', '/get?abc=123', ['query' => ['foo' => 'bar']]); + +read_timeout +------------ + +:Summary: Float describing the timeout to use when reading a streamed body +:Types: float +:Default: Defaults to the value of the ``default_socket_timeout`` PHP ini setting +:Constant: ``GuzzleHttp\RequestOptions::READ_TIMEOUT`` + +The timeout applies to individual read operations on a streamed body (when the ``stream`` option is enabled). + +.. code-block:: php + + $response = $client->request('GET', '/stream', [ + 'stream' => true, + 'read_timeout' => 10, + ]); + + $body = $response->getBody(); + + // Returns false on timeout + $data = $body->read(1024); + + // Returns false on timeout + $line = fgets($body->detach()); + +.. _sink-option: + +sink +---- + +:Summary: Specify where the body of a response will be saved. +:Types: + - string (path to file on disk) + - ``fopen()`` resource + - ``Psr\Http\Message\StreamInterface`` + +:Default: PHP temp stream +:Constant: ``GuzzleHttp\RequestOptions::SINK`` + +Pass a string to specify the path to a file that will store the contents of the +response body: + +.. code-block:: php + + $client->request('GET', '/stream/20', ['sink' => '/path/to/file']); + +Pass a resource returned from ``fopen()`` to write the response to a PHP stream: + +.. code-block:: php + + $resource = \GuzzleHttp\Psr7\Utils::tryFopen('/path/to/file', 'w'); + $client->request('GET', '/stream/20', ['sink' => $resource]); + +Pass a ``Psr\Http\Message\StreamInterface`` object to stream the response +body to an open PSR-7 stream. + +.. code-block:: php + + $resource = \GuzzleHttp\Psr7\Utils::tryFopen('/path/to/file', 'w'); + $stream = \GuzzleHttp\Psr7\Utils::streamFor($resource); + $client->request('GET', '/stream/20', ['save_to' => $stream]); + +.. note:: + + The ``save_to`` request option has been deprecated in favor of the + ``sink`` request option. Providing the ``save_to`` option is now an alias + of ``sink``. + + +.. _ssl_key-option: + +ssl_key +------- + +:Summary: Specify the path to a file containing a private SSL key in PEM + format. If a password is required, then set to an array containing the path + to the SSL key in the first array element followed by the password required + for the certificate in the second element. +:Types: + - string + - array +:Default: None +:Constant: ``GuzzleHttp\RequestOptions::SSL_KEY`` + +.. note:: + + ``ssl_key`` is implemented by HTTP handlers. This is currently only + supported by the cURL handler, but might be supported by other third-part + handlers. + + +.. _stream-option: + +stream +------ + +:Summary: Set to ``true`` to stream a response rather than download it all + up-front. +:Types: bool +:Default: ``false`` +:Constant: ``GuzzleHttp\RequestOptions::STREAM`` + +.. code-block:: php + + $response = $client->request('GET', '/stream/20', ['stream' => true]); + // Read bytes off of the stream until the end of the stream is reached + $body = $response->getBody(); + while (!$body->eof()) { + echo $body->read(1024); + } + +.. note:: + + Streaming response support must be implemented by the HTTP handler used by + a client. This option might not be supported by every HTTP handler, but the + interface of the response object remains the same regardless of whether or + not it is supported by the handler. + + +synchronous +----------- + +:Summary: Set to true to inform HTTP handlers that you intend on waiting on the + response. This can be useful for optimizations. +:Types: bool +:Default: none +:Constant: ``GuzzleHttp\RequestOptions::SYNCHRONOUS`` + + +.. _verify-option: + +verify +------ + +:Summary: Describes the SSL certificate verification behavior of a request. + + - Set to ``true`` to enable SSL certificate verification and use the default + CA bundle provided by operating system. + - Set to ``false`` to disable certificate verification (this is insecure!). + - Set to a string to provide the path to a CA bundle to enable verification + using a custom certificate. +:Types: + - bool + - string +:Default: ``true`` +:Constant: ``GuzzleHttp\RequestOptions::VERIFY`` + +.. code-block:: php + + // Use the system's CA bundle (this is the default setting) + $client->request('GET', '/', ['verify' => true]); + + // Use a custom SSL certificate on disk. + $client->request('GET', '/', ['verify' => '/path/to/cert.pem']); + + // Disable validation entirely (don't do this!). + $client->request('GET', '/', ['verify' => false]); + +If you do not need a specific certificate bundle, then Mozilla provides a +commonly used CA bundle which can be downloaded +`here `_ +(provided by the maintainer of cURL). Once you have a CA bundle available on +disk, you can set the "openssl.cafile" PHP ini setting to point to the path to +the file, allowing you to omit the "verify" request option. Much more detail on +SSL certificates can be found on the +`cURL website `_. + + +.. _timeout-option: + +timeout +------- + +:Summary: Float describing the total timeout of the request in seconds. Use ``0`` + to wait indefinitely (the default behavior). +:Types: float +:Default: ``0`` +:Constant: ``GuzzleHttp\RequestOptions::TIMEOUT`` + +.. code-block:: php + + // Timeout if a server does not return a response in 3.14 seconds. + $client->request('GET', '/delay/5', ['timeout' => 3.14]); + // PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\TransferException' + + +.. _version-option: + +version +------- + +:Summary: Protocol version to use with the request. +:Types: string, float +:Default: ``1.1`` +:Constant: ``GuzzleHttp\RequestOptions::VERSION`` + +.. code-block:: php + + // Force HTTP/1.0 + $request = $client->request('GET', '/get', ['version' => 1.0]); diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/requirements.txt b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/requirements.txt new file mode 100644 index 0000000000..65adf95d2c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/requirements.txt @@ -0,0 +1,4 @@ +Sphinx>=1.3.0,<1.4.0 +guzzle_sphinx_theme>=0.7.0,<0.8.0 +jinja2<3 +markupsafe<2.1 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/testing.rst b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/testing.rst new file mode 100644 index 0000000000..e1bf8324e4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/docs/testing.rst @@ -0,0 +1,214 @@ +====================== +Testing Guzzle Clients +====================== + +Guzzle provides several tools that will enable you to easily mock the HTTP +layer without needing to send requests over the internet. + +* Mock handler +* History middleware +* Node.js web server for integration testing + + +Mock Handler +============ + +When testing HTTP clients, you often need to simulate specific scenarios like +returning a successful response, returning an error, or returning specific +responses in a certain order. Because unit tests need to be predictable, easy +to bootstrap, and fast, hitting an actual remote API is a test smell. + +Guzzle provides a mock handler that can be used to fulfill HTTP requests with +a response or exception by shifting return values off of a queue. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\Handler\MockHandler; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Psr7\Response; + use GuzzleHttp\Psr7\Request; + use GuzzleHttp\Exception\RequestException; + + // Create a mock and queue two responses. + $mock = new MockHandler([ + new Response(200, ['X-Foo' => 'Bar'], 'Hello, World'), + new Response(202, ['Content-Length' => 0]), + new RequestException('Error Communicating with Server', new Request('GET', 'test')) + ]); + + $handlerStack = HandlerStack::create($mock); + $client = new Client(['handler' => $handlerStack]); + + // The first request is intercepted with the first response. + $response = $client->request('GET', '/'); + echo $response->getStatusCode(); + //> 200 + echo $response->getBody(); + //> Hello, World + // The second request is intercepted with the second response. + echo $client->request('GET', '/')->getStatusCode(); + //> 202 + + // Reset the queue and queue up a new response + $mock->reset(); + $mock->append(new Response(201)); + + // As the mock was reset, the new response is the 201 CREATED, + // instead of the previously queued RequestException + echo $client->request('GET', '/')->getStatusCode(); + //> 201 + + +When no more responses are in the queue and a request is sent, an +``OutOfBoundsException`` is thrown. + +History Middleware +================== + +When using things like the ``Mock`` handler, you often need to know if the +requests you expected to send were sent exactly as you intended. While the mock +handler responds with mocked responses, the history middleware maintains a +history of the requests that were sent by a client. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\HandlerStack; + use GuzzleHttp\Middleware; + + $container = []; + $history = Middleware::history($container); + + $handlerStack = HandlerStack::create(); + // or $handlerStack = HandlerStack::create($mock); if using the Mock handler. + + // Add the history middleware to the handler stack. + $handlerStack->push($history); + + $client = new Client(['handler' => $handlerStack]); + + $client->request('GET', 'http://httpbin.org/get'); + $client->request('HEAD', 'http://httpbin.org/get'); + + // Count the number of transactions + echo count($container); + //> 2 + + // Iterate over the requests and responses + foreach ($container as $transaction) { + echo $transaction['request']->getMethod(); + //> GET, HEAD + if ($transaction['response']) { + echo $transaction['response']->getStatusCode(); + //> 200, 200 + } elseif ($transaction['error']) { + echo $transaction['error']; + //> exception + } + var_dump($transaction['options']); + //> dumps the request options of the sent request. + } + + +Test Web Server +=============== + +Using mock responses is almost always enough when testing a web service client. +When implementing custom :doc:`HTTP handlers `, you'll +need to send actual HTTP requests in order to sufficiently test the handler. +However, a best practice is to contact a local web server rather than a server +over the internet. + +- Tests are more reliable +- Tests do not require a network connection +- Tests have no external dependencies + + +Using the test server +--------------------- + +.. warning:: + + The following functionality is provided to help developers of Guzzle + develop HTTP handlers. There is no promise of backwards compatibility + when it comes to the node.js test server or the ``GuzzleHttp\Tests\Server`` + class. If you are using the test server or ``Server`` class outside of + guzzlehttp/guzzle, then you will need to configure autoloading and + ensure the web server is started manually. + +.. hint:: + + You almost never need to use this test web server. You should only ever + consider using it when developing HTTP handlers. The test web server + is not necessary for mocking requests. For that, please use the + Mock handler and history middleware. + +Guzzle provides a node.js test server as a separate composer package that +receives requests and returns responses from a queue. The test server exposes +a simple API that is used to enqueue responses and inspect the requests that it +has received. + +You can add the test server as a dev dependency using Composer. + +.. code-block:: bash + + composer require --dev guzzlehttp/test-server:^0.1 + +Alternatively, you can include it as a dev dependency in your project's +existing composer.json file: + +.. code-block:: json + + { + "require-dev": { + "guzzlehttp/test-server": "^0.1" + } + } + +Any operation on the ``Server`` object will ensure that +the server is running and wait until it is able to receive requests before +returning. + +``GuzzleHttp\Tests\Server`` provides a static interface to the test server. You +can queue an HTTP response or an array of responses by calling +``Server::enqueue()``. This method accepts an array of +``Psr\Http\Message\ResponseInterface`` and ``Exception`` objects. + +.. code-block:: php + + use GuzzleHttp\Client; + use GuzzleHttp\Psr7\Response; + use GuzzleHttp\Tests\Server; + + // Start the server and queue a response + Server::enqueue([ + new Response(200, ['Content-Length' => 0]) + ]); + + $client = new Client(['base_uri' => Server::$url]); + echo $client->request('GET', '/foo')->getStatusCode(); + // 200 + +When a response is queued on the test server, the test server will remove any +previously queued responses. As the server receives requests, queued responses +are dequeued and returned to the request. When the queue is empty, the server +will return a 500 response. + +You can inspect the requests that the server has retrieved by calling +``Server::received()``. + +.. code-block:: php + + foreach (Server::received() as $response) { + echo $response->getStatusCode(); + } + +You can clear the list of received requests from the web server using the +``Server::flush()`` method. + +.. code-block:: php + + Server::flush(); + echo count(Server::received()); + // 0 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan-baseline.neon b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan-baseline.neon new file mode 100644 index 0000000000..f7dff93a58 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan-baseline.neon @@ -0,0 +1,202 @@ +parameters: + ignoreErrors: + - + message: "#^Method GuzzleHttp\\\\Client\\:\\:request\\(\\) should return Psr\\\\Http\\\\Message\\\\ResponseInterface but returns mixed\\.$#" + count: 1 + path: src/Client.php + + - + message: "#^Method GuzzleHttp\\\\Client\\:\\:send\\(\\) should return Psr\\\\Http\\\\Message\\\\ResponseInterface but returns mixed\\.$#" + count: 1 + path: src/Client.php + + - + message: "#^Method GuzzleHttp\\\\Client\\:\\:sendRequest\\(\\) should return Psr\\\\Http\\\\Message\\\\ResponseInterface but returns mixed\\.$#" + count: 1 + path: src/Client.php + + - + message: "#^Parameter \\#1 \\$str of function strtolower expects string, int\\|string given\\.$#" + count: 1 + path: src/Client.php + + - + message: "#^Parameter \\#1 \\$string of function strlen expects string, mixed given\\.$#" + count: 1 + path: src/Cookie/SessionCookieJar.php + + - + message: "#^Result of && is always false\\.$#" + count: 3 + path: src/Cookie/SetCookie.php + + - + message: "#^Strict comparison using \\!\\=\\= between null and null will always evaluate to false\\.$#" + count: 3 + path: src/Cookie/SetCookie.php + + - + message: "#^Cannot access offset 'features' on array\\|false\\.$#" + count: 3 + path: src/Handler/CurlFactory.php + + - + message: "#^Cannot access offset 'version' on array\\|false\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Cannot call method getBody\\(\\) on Psr\\\\Http\\\\Message\\\\ResponseInterface\\|null\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_close expects resource, CurlHandle\\|resource given\\.$#" + count: 2 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_error expects resource, CurlHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_getinfo expects resource, CurlHandle\\|resource given\\.$#" + count: 4 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_reset expects resource, CurlHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_setopt expects resource, CurlHandle\\|resource given\\.$#" + count: 4 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_setopt_array expects resource, CurlHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$str1 of function strcasecmp expects string, int\\|string given\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Property GuzzleHttp\\\\Handler\\\\CurlFactory\\:\\:\\$handles has unknown class CurlHandle as its type\\.$#" + count: 1 + path: src/Handler/CurlFactory.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_errno expects resource, CurlHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlHandler.php + + - + message: "#^Parameter \\#1 \\$ch of function curl_exec expects resource, CurlHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlHandler.php + + - + message: "#^Method GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:__get\\(\\) has invalid return type CurlMultiHandle\\.$#" + count: 1 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Parameter \\#1 \\$mh of function curl_multi_add_handle expects resource, CurlMultiHandle\\|resource given\\.$#" + count: 2 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Parameter \\#1 \\$mh of function curl_multi_close expects resource, CurlMultiHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Parameter \\#1 \\$mh of function curl_multi_exec expects resource, CurlMultiHandle\\|resource given\\.$#" + count: 2 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Parameter \\#1 \\$mh of function curl_multi_info_read expects resource, CurlMultiHandle\\|resource given\\.$#" + count: 1 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Parameter \\#1 \\$mh of function curl_multi_remove_handle expects resource, CurlMultiHandle\\|resource given\\.$#" + count: 2 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Parameter \\#1 \\$mh of function curl_multi_select expects resource, CurlMultiHandle\\|resource given\\.$#" + count: 3 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$_mh \\(CurlMultiHandle\\|resource\\) in isset\\(\\) is not nullable\\.$#" + count: 1 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$_mh has unknown class CurlMultiHandle as its type\\.$#" + count: 1 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Strict comparison using \\=\\=\\= between false and resource will always evaluate to false\\.$#" + count: 1 + path: src/Handler/CurlMultiHandler.php + + - + message: "#^Property GuzzleHttp\\\\Handler\\\\EasyHandle\\:\\:\\$handle has unknown class CurlHandle as its type\\.$#" + count: 1 + path: src/Handler/EasyHandle.php + + - + message: "#^Trying to invoke mixed but it's not a callable\\.$#" + count: 1 + path: src/Handler/StreamHandler.php + + - + message: "#^Variable \\$http_response_header on left side of \\?\\? always exists and is not nullable\\.$#" + count: 1 + path: src/Handler/StreamHandler.php + + - + message: "#^Variable \\$options in empty\\(\\) always exists and is not falsy\\.$#" + count: 1 + path: src/Handler/StreamHandler.php + + - + message: "#^Result of && is always false\\.$#" + count: 1 + path: src/HandlerStack.php + + - + message: "#^Result of && is always false\\.$#" + count: 2 + path: src/Middleware.php + + - + message: "#^Cannot access offset 'version' on array\\|false\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Method GuzzleHttp\\\\Utils\\:\\:jsonDecode\\(\\) should return array\\|bool\\|float\\|int\\|object\\|string\\|null but returns mixed\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Parameter \\#3 \\$depth of function json_decode expects int\\<1, max\\>, int given\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Parameter \\#3 \\$depth of function json_encode expects int\\<1, max\\>, int given\\.$#" + count: 1 + path: src/Utils.php + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan.neon.dist b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan.neon.dist new file mode 100644 index 0000000000..4a8a32171c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpstan.neon.dist @@ -0,0 +1,13 @@ +includes: + - phpstan-baseline.neon + - vendor-bin/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon + +parameters: + ignoreErrors: + - + identifier: missingType.iterableValue + level: max + paths: + - src + bootstrapFiles: + - tests/bootstrap-phpstan.php diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpunit.xml.dist b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpunit.xml.dist new file mode 100644 index 0000000000..4dd5ecc6da --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + tests + + + + + + + + + + src + + src/ + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm-baseline.xml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm-baseline.xml new file mode 100644 index 0000000000..396852dbfe --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm-baseline.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + cookies))]]> + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + handle]]> + handle]]> + handle]]> + handle]]> + handle]]> + handle]]> + + + + + + + + + + + + + + + + + + + + + + + handle]]> + handle]]> + + + + + timeToNext()]]> + + + handle]]> + + + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + _mh]]> + + + _mh)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getMethod() + .' '.$request->getRequestTarget()) + .' HTTP/'.$request->getProtocolVersion()."\r\n" + .$this->headers($request); + break; + case 'res_headers': + $result = $response ? + \sprintf( + 'HTTP/%s %d %s', + $response->getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + )."\r\n".$this->headers($response) + : 'NULL'; + break; + case 'req_body': + $result = $request->getBody()->__toString(); + break; + case 'res_body': + if (!$response instanceof ResponseInterface) { + $result = 'NULL'; + break; + } + + $body = $response->getBody(); + + if (!$body->isSeekable()) { + $result = 'RESPONSE_NOT_LOGGEABLE'; + break; + } + + $result = $response->getBody()->__toString(); + break; + case 'ts': + case 'date_iso_8601': + $result = \gmdate('c'); + break; + case 'date_common_log': + $result = \date('d/M/Y:H:i:s O'); + break; + case 'method': + $result = $request->getMethod(); + break; + case 'version': + $result = $request->getProtocolVersion(); + break; + case 'uri': + case 'url': + $result = $request->getUri()->__toString(); + break; + case 'target': + $result = $request->getRequestTarget(); + break; + case 'req_version': + $result = $request->getProtocolVersion(); + break; + case 'res_version': + $result = $response + ? $response->getProtocolVersion() + : 'NULL'; + break; + case 'host': + $result = $request->getHeaderLine('Host'); + break; + case 'hostname': + $result = \gethostname(); + break; + case 'code': + $result = $response ? $response->getStatusCode() : 'NULL'; + break; + case 'phrase': + $result = $response ? $response->getReasonPhrase() : 'NULL'; + break; + case 'error': + $result = $error ? $error->getMessage() : 'NULL'; + break; + default: + // handle prefixed dynamic headers + if (\strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(\substr($matches[1], 11)); + } elseif (\strpos($matches[1], 'res_header_') === 0) { + $result = $response + ? $response->getHeaderLine(\substr($matches[1], 11)) + : 'NULL'; + } + } + + $cache[$matches[1]] = $result; + + return $result; + }]]> + + + + + + + + + + delay)(++$options['retries'], $response, $request)]]> + + + + + + + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm.xml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm.xml new file mode 100644 index 0000000000..86d8671da8 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizer.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizer.php new file mode 100644 index 0000000000..761506dd07 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizer.php @@ -0,0 +1,28 @@ +truncateAt = $truncateAt; + } + + /** + * Returns a summarized message body. + */ + public function summarize(MessageInterface $message): ?string + { + return $this->truncateAt === null + ? Psr7\Message::bodySummary($message) + : Psr7\Message::bodySummary($message, $this->truncateAt); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizerInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizerInterface.php new file mode 100644 index 0000000000..3e02e036e3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/BodySummarizerInterface.php @@ -0,0 +1,13 @@ + 'http://www.foo.com/1.0/', + * 'timeout' => 0, + * 'allow_redirects' => false, + * 'proxy' => '192.168.16.1:10' + * ]); + * + * Client configuration settings include the following options: + * + * - handler: (callable) Function that transfers HTTP requests over the + * wire. The function is called with a Psr7\Http\Message\RequestInterface + * and array of transfer options, and must return a + * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a + * Psr7\Http\Message\ResponseInterface on success. + * If no handler is provided, a default handler will be created + * that enables all of the request options below by attaching all of the + * default middleware to the handler. + * - base_uri: (string|UriInterface) Base URI of the client that is merged + * into relative URIs. Can be a string or instance of UriInterface. + * - **: any request option + * + * @param array $config Client configuration settings. + * + * @see RequestOptions for a list of available request options. + */ + public function __construct(array $config = []) + { + if (!isset($config['handler'])) { + $config['handler'] = HandlerStack::create(); + } elseif (!\is_callable($config['handler'])) { + throw new InvalidArgumentException('handler must be a callable'); + } + + // Convert the base_uri to a UriInterface + if (isset($config['base_uri'])) { + $config['base_uri'] = Psr7\Utils::uriFor($config['base_uri']); + } + + $this->configureDefaults($config); + } + + /** + * @param string $method + * @param array $args + * + * @return PromiseInterface|ResponseInterface + * + * @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0. + */ + public function __call($method, $args) + { + if (\count($args) < 1) { + throw new InvalidArgumentException('Magic request methods require a URI and optional options array'); + } + + $uri = $args[0]; + $opts = $args[1] ?? []; + + return \substr($method, -5) === 'Async' + ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts) + : $this->request($method, $uri, $opts); + } + + /** + * Asynchronously send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + */ + public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface + { + // Merge the base URI into the request URI if needed. + $options = $this->prepareDefaults($options); + + return $this->transfer( + $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), + $options + ); + } + + /** + * Send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function send(RequestInterface $request, array $options = []): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + + return $this->sendAsync($request, $options)->wait(); + } + + /** + * The HttpClient PSR (PSR-18) specify this method. + * + * {@inheritDoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + $options[RequestOptions::ALLOW_REDIRECTS] = false; + $options[RequestOptions::HTTP_ERRORS] = false; + + return $this->sendAsync($request, $options)->wait(); + } + + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + */ + public function requestAsync(string $method, $uri = '', array $options = []): PromiseInterface + { + $options = $this->prepareDefaults($options); + // Remove request modifying parameter because it can be done up-front. + $headers = $options['headers'] ?? []; + $body = $options['body'] ?? null; + $version = $options['version'] ?? '1.1'; + // Merge the URI into the base URI. + $uri = $this->buildUri(Psr7\Utils::uriFor($uri), $options); + if (\is_array($body)) { + throw $this->invalidBody(); + } + $request = new Psr7\Request($method, $uri, $headers, $body, $version); + // Remove the option so that they are not doubly-applied. + unset($options['headers'], $options['body'], $options['version']); + + return $this->transfer($request, $options); + } + + /** + * Create and send an HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string $method HTTP method. + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function request(string $method, $uri = '', array $options = []): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + + return $this->requestAsync($method, $uri, $options)->wait(); + } + + /** + * Get a client configuration option. + * + * These options include default request options of the client, a "handler" + * (if utilized by the concrete client), and a "base_uri" if utilized by + * the concrete client. + * + * @param string|null $option The config option to retrieve. + * + * @return mixed + * + * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0. + */ + public function getConfig(?string $option = null) + { + return $option === null + ? $this->config + : ($this->config[$option] ?? null); + } + + private function buildUri(UriInterface $uri, array $config): UriInterface + { + if (isset($config['base_uri'])) { + $uri = Psr7\UriResolver::resolve(Psr7\Utils::uriFor($config['base_uri']), $uri); + } + + if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) { + $idnOptions = ($config['idn_conversion'] === true) ? \IDNA_DEFAULT : $config['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + + return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; + } + + /** + * Configures the default options for a client. + */ + private function configureDefaults(array $config): void + { + $defaults = [ + 'allow_redirects' => RedirectMiddleware::$defaultSettings, + 'http_errors' => true, + 'decode_content' => true, + 'verify' => true, + 'cookies' => false, + 'idn_conversion' => false, + ]; + + // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. + + // We can only trust the HTTP_PROXY environment variable in a CLI + // process due to the fact that PHP has no reliable mechanism to + // get environment variables that start with "HTTP_". + if (\PHP_SAPI === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) { + $defaults['proxy']['http'] = $proxy; + } + + if ($proxy = Utils::getenv('HTTPS_PROXY')) { + $defaults['proxy']['https'] = $proxy; + } + + if ($noProxy = Utils::getenv('NO_PROXY')) { + $cleanedNoProxy = \str_replace(' ', '', $noProxy); + $defaults['proxy']['no'] = \explode(',', $cleanedNoProxy); + } + + $this->config = $config + $defaults; + + if (!empty($config['cookies']) && $config['cookies'] === true) { + $this->config['cookies'] = new CookieJar(); + } + + // Add the default user-agent header. + if (!isset($this->config['headers'])) { + $this->config['headers'] = ['User-Agent' => Utils::defaultUserAgent()]; + } else { + // Add the User-Agent header if one was not already set. + foreach (\array_keys($this->config['headers']) as $name) { + if (\strtolower($name) === 'user-agent') { + return; + } + } + $this->config['headers']['User-Agent'] = Utils::defaultUserAgent(); + } + } + + /** + * Merges default options into the array. + * + * @param array $options Options to modify by reference + */ + private function prepareDefaults(array $options): array + { + $defaults = $this->config; + + if (!empty($defaults['headers'])) { + // Default headers are only added if they are not present. + $defaults['_conditional'] = $defaults['headers']; + unset($defaults['headers']); + } + + // Special handling for headers is required as they are added as + // conditional headers and as headers passed to a request ctor. + if (\array_key_exists('headers', $options)) { + // Allows default headers to be unset. + if ($options['headers'] === null) { + $defaults['_conditional'] = []; + unset($options['headers']); + } elseif (!\is_array($options['headers'])) { + throw new InvalidArgumentException('headers must be an array'); + } + } + + // Shallow merge defaults underneath options. + $result = $options + $defaults; + + // Remove null values. + foreach ($result as $k => $v) { + if ($v === null) { + unset($result[$k]); + } + } + + return $result; + } + + /** + * Transfers the given request and applies request options. + * + * The URI of the request is not modified and the request options are used + * as-is without merging in default options. + * + * @param array $options See \GuzzleHttp\RequestOptions. + */ + private function transfer(RequestInterface $request, array $options): PromiseInterface + { + $request = $this->applyOptions($request, $options); + /** @var HandlerStack $handler */ + $handler = $options['handler']; + + try { + return P\Create::promiseFor($handler($request, $options)); + } catch (\Exception $e) { + return P\Create::rejectionFor($e); + } + } + + /** + * Applies the array of request options to a request. + */ + private function applyOptions(RequestInterface $request, array &$options): RequestInterface + { + $modify = [ + 'set_headers' => [], + ]; + + if (isset($options['headers'])) { + if (array_keys($options['headers']) === range(0, count($options['headers']) - 1)) { + throw new InvalidArgumentException('The headers array must have header name as keys.'); + } + $modify['set_headers'] = $options['headers']; + unset($options['headers']); + } + + if (isset($options['form_params'])) { + if (isset($options['multipart'])) { + throw new InvalidArgumentException('You cannot use ' + .'form_params and multipart at the same time. Use the ' + .'form_params option if you want to send application/' + .'x-www-form-urlencoded requests, and the multipart ' + .'option to send multipart/form-data requests.'); + } + $options['body'] = \http_build_query($options['form_params'], '', '&'); + unset($options['form_params']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + if (isset($options['multipart'])) { + $options['body'] = new Psr7\MultipartStream($options['multipart']); + unset($options['multipart']); + } + + if (isset($options['json'])) { + $options['body'] = Utils::jsonEncode($options['json']); + unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/json'; + } + + if (!empty($options['decode_content']) + && $options['decode_content'] !== true + ) { + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Accept-Encoding'], $options['_conditional']); + $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; + } + + if (isset($options['body'])) { + if (\is_array($options['body'])) { + throw $this->invalidBody(); + } + $modify['body'] = Psr7\Utils::streamFor($options['body']); + unset($options['body']); + } + + if (!empty($options['auth']) && \is_array($options['auth'])) { + $value = $options['auth']; + $type = isset($value[2]) ? \strtolower($value[2]) : 'basic'; + switch ($type) { + case 'basic': + // Ensure that we don't have the header in different case and set the new value. + $modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']); + $modify['set_headers']['Authorization'] = 'Basic ' + .\base64_encode("$value[0]:$value[1]"); + break; + case 'digest': + // @todo: Do not rely on curl + $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST; + $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + case 'ntlm': + $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM; + $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + } + } + + if (isset($options['query'])) { + $value = $options['query']; + if (\is_array($value)) { + $value = \http_build_query($value, '', '&', \PHP_QUERY_RFC3986); + } + if (!\is_string($value)) { + throw new InvalidArgumentException('query must be a string or array'); + } + $modify['query'] = $value; + unset($options['query']); + } + + // Ensure that sink is not an invalid value. + if (isset($options['sink'])) { + // TODO: Add more sink validation? + if (\is_bool($options['sink'])) { + throw new InvalidArgumentException('sink must not be a boolean'); + } + } + + if (isset($options['version'])) { + $modify['version'] = $options['version']; + } + + $request = Psr7\Utils::modifyRequest($request, $modify); + if ($request->getBody() instanceof Psr7\MultipartStream) { + // Use a multipart/form-data POST if a Content-Type is not set. + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' + .$request->getBody()->getBoundary(); + } + + // Merge in conditional headers if they are not present. + if (isset($options['_conditional'])) { + // Build up the changes so it's in a single clone of the message. + $modify = []; + foreach ($options['_conditional'] as $k => $v) { + if (!$request->hasHeader($k)) { + $modify['set_headers'][$k] = $v; + } + } + $request = Psr7\Utils::modifyRequest($request, $modify); + // Don't pass this internal value along to middleware/handlers. + unset($options['_conditional']); + } + + return $request; + } + + /** + * Return an InvalidArgumentException with pre-set message. + */ + private function invalidBody(): InvalidArgumentException + { + return new InvalidArgumentException('Passing in the "body" request ' + .'option as an array to send a request is not supported. ' + .'Please use the "form_params" request option to send a ' + .'application/x-www-form-urlencoded request, or the "multipart" ' + .'request option to send a multipart/form-data request.'); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/ClientInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/ClientInterface.php new file mode 100644 index 0000000000..6aaee61afc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/ClientInterface.php @@ -0,0 +1,84 @@ +request('GET', $uri, $options); + } + + /** + * Create and send an HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function head($uri, array $options = []): ResponseInterface + { + return $this->request('HEAD', $uri, $options); + } + + /** + * Create and send an HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function put($uri, array $options = []): ResponseInterface + { + return $this->request('PUT', $uri, $options); + } + + /** + * Create and send an HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function post($uri, array $options = []): ResponseInterface + { + return $this->request('POST', $uri, $options); + } + + /** + * Create and send an HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function patch($uri, array $options = []): ResponseInterface + { + return $this->request('PATCH', $uri, $options); + } + + /** + * Create and send an HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function delete($uri, array $options = []): ResponseInterface + { + return $this->request('DELETE', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + abstract public function requestAsync(string $method, $uri, array $options = []): PromiseInterface; + + /** + * Create and send an asynchronous HTTP GET request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function getAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('GET', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function headAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('HEAD', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function putAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('PUT', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function postAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('POST', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function patchAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('PATCH', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function deleteAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('DELETE', $uri, $options); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJar.php new file mode 100644 index 0000000000..b616cf2ed6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -0,0 +1,307 @@ +strictMode = $strictMode; + + foreach ($cookieArray as $cookie) { + if (!($cookie instanceof SetCookie)) { + $cookie = new SetCookie($cookie); + } + $this->setCookie($cookie); + } + } + + /** + * Create a new Cookie jar from an associative array and domain. + * + * @param array $cookies Cookies to create the jar from + * @param string $domain Domain to set the cookies to + */ + public static function fromArray(array $cookies, string $domain): self + { + $cookieJar = new self(); + foreach ($cookies as $name => $value) { + $cookieJar->setCookie(new SetCookie([ + 'Domain' => $domain, + 'Name' => $name, + 'Value' => $value, + 'Discard' => true, + ])); + } + + return $cookieJar; + } + + /** + * Evaluate if this cookie should be persisted to storage + * that survives between requests. + * + * @param SetCookie $cookie Being evaluated. + * @param bool $allowSessionCookies If we should persist session cookies + */ + public static function shouldPersist(SetCookie $cookie, bool $allowSessionCookies = false): bool + { + if ($cookie->getExpires() || $allowSessionCookies) { + if (!$cookie->getDiscard()) { + return true; + } + } + + return false; + } + + /** + * Finds and returns the cookie based on the name + * + * @param string $name cookie name to search for + * + * @return SetCookie|null cookie that was found or null if not found + */ + public function getCookieByName(string $name): ?SetCookie + { + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) { + return $cookie; + } + } + + return null; + } + + public function toArray(): array + { + return \array_map(static function (SetCookie $cookie): array { + return $cookie->toArray(); + }, $this->getIterator()->getArrayCopy()); + } + + public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void + { + if (!$domain) { + $this->cookies = []; + + return; + } elseif (!$path) { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($domain): bool { + return !$cookie->matchesDomain($domain); + } + ); + } elseif (!$name) { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($path, $domain): bool { + return !($cookie->matchesPath($path) + && $cookie->matchesDomain($domain)); + } + ); + } else { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($path, $domain, $name) { + return !($cookie->getName() == $name + && $cookie->matchesPath($path) + && $cookie->matchesDomain($domain)); + } + ); + } + } + + public function clearSessionCookies(): void + { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie): bool { + return !$cookie->getDiscard() && $cookie->getExpires(); + } + ); + } + + public function setCookie(SetCookie $cookie): bool + { + // If the name string is empty (but not 0), ignore the set-cookie + // string entirely. + $name = $cookie->getName(); + if (!$name && $name !== '0') { + return false; + } + + // Only allow cookies with set and valid domain, name, value + $result = $cookie->validate(); + if ($result !== true) { + if ($this->strictMode) { + throw new \RuntimeException('Invalid cookie: '.$result); + } + $this->removeCookieIfEmpty($cookie); + + return false; + } + + // Resolve conflicts with previously set cookies + foreach ($this->cookies as $i => $c) { + // Two cookies are identical, when their path, and domain are + // identical. + if ($c->getPath() != $cookie->getPath() + || $c->getDomain() != $cookie->getDomain() + || $c->getName() != $cookie->getName() + ) { + continue; + } + + // The previously set cookie is a discard cookie and this one is + // not so allow the new cookie to be set + if (!$cookie->getDiscard() && $c->getDiscard()) { + unset($this->cookies[$i]); + continue; + } + + // If the new cookie's expiration is further into the future, then + // replace the old cookie + if ($cookie->getExpires() > $c->getExpires()) { + unset($this->cookies[$i]); + continue; + } + + // If the value has changed, we better change it + if ($cookie->getValue() !== $c->getValue()) { + unset($this->cookies[$i]); + continue; + } + + // The cookie exists, so no need to continue + return false; + } + + $this->cookies[] = $cookie; + + return true; + } + + public function count(): int + { + return \count($this->cookies); + } + + /** + * @return \ArrayIterator + */ + public function getIterator(): \ArrayIterator + { + return new \ArrayIterator(\array_values($this->cookies)); + } + + public function extractCookies(RequestInterface $request, ResponseInterface $response): void + { + if ($cookieHeader = $response->getHeader('Set-Cookie')) { + foreach ($cookieHeader as $cookie) { + $sc = SetCookie::fromString($cookie); + if (!$sc->getDomain()) { + $sc->setDomain($request->getUri()->getHost()); + } + if (0 !== \strpos($sc->getPath(), '/')) { + $sc->setPath($this->getCookiePathFromRequest($request)); + } + if (!$sc->matchesDomain($request->getUri()->getHost())) { + continue; + } + // Note: At this point `$sc->getDomain()` being a public suffix should + // be rejected, but we don't want to pull in the full PSL dependency. + $this->setCookie($sc); + } + } + } + + /** + * Computes cookie path following RFC 6265 section 5.1.4 + * + * @see https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4 + */ + private function getCookiePathFromRequest(RequestInterface $request): string + { + $uriPath = $request->getUri()->getPath(); + if ('' === $uriPath) { + return '/'; + } + if (0 !== \strpos($uriPath, '/')) { + return '/'; + } + if ('/' === $uriPath) { + return '/'; + } + $lastSlashPos = \strrpos($uriPath, '/'); + if (0 === $lastSlashPos || false === $lastSlashPos) { + return '/'; + } + + return \substr($uriPath, 0, $lastSlashPos); + } + + public function withCookieHeader(RequestInterface $request): RequestInterface + { + $values = []; + $uri = $request->getUri(); + $scheme = $uri->getScheme(); + $host = $uri->getHost(); + $path = $uri->getPath() ?: '/'; + + foreach ($this->cookies as $cookie) { + if ($cookie->matchesPath($path) + && $cookie->matchesDomain($host) + && !$cookie->isExpired() + && (!$cookie->getSecure() || $scheme === 'https') + ) { + $values[] = $cookie->getName().'=' + .$cookie->getValue(); + } + } + + return $values + ? $request->withHeader('Cookie', \implode('; ', $values)) + : $request; + } + + /** + * If a cookie already exists and the server asks to set it again with a + * null value, the cookie must be deleted. + */ + private function removeCookieIfEmpty(SetCookie $cookie): void + { + $cookieValue = $cookie->getValue(); + if ($cookieValue === null || $cookieValue === '') { + $this->clear( + $cookie->getDomain(), + $cookie->getPath(), + $cookie->getName() + ); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php new file mode 100644 index 0000000000..93ada58d22 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -0,0 +1,80 @@ + + */ +interface CookieJarInterface extends \Countable, \IteratorAggregate +{ + /** + * Create a request with added cookie headers. + * + * If no matching cookies are found in the cookie jar, then no Cookie + * header is added to the request and the same request is returned. + * + * @param RequestInterface $request Request object to modify. + * + * @return RequestInterface returns the modified request. + */ + public function withCookieHeader(RequestInterface $request): RequestInterface; + + /** + * Extract cookies from an HTTP response and store them in the CookieJar. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface $response Response that was received + */ + public function extractCookies(RequestInterface $request, ResponseInterface $response): void; + + /** + * Sets a cookie in the cookie jar. + * + * @param SetCookie $cookie Cookie to set. + * + * @return bool Returns true on success or false on failure + */ + public function setCookie(SetCookie $cookie): bool; + + /** + * Remove cookies currently held in the cookie jar. + * + * Invoking this method without arguments will empty the whole cookie jar. + * If given a $domain argument only cookies belonging to that domain will + * be removed. If given a $domain and $path argument, cookies belonging to + * the specified path within that domain are removed. If given all three + * arguments, then the cookie with the specified name, path and domain is + * removed. + * + * @param string|null $domain Clears cookies matching a domain + * @param string|null $path Clears cookies matching a domain and path + * @param string|null $name Clears cookies matching a domain, path, and name + */ + public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void; + + /** + * Discard all sessions cookies. + * + * Removes cookies that don't have an expire field or a have a discard + * field set to true. To be called when the user agent shuts down according + * to RFC 2965. + */ + public function clearSessionCookies(): void; + + /** + * Converts the cookie jar to an array. + */ + public function toArray(): array; +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php new file mode 100644 index 0000000000..290236d543 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php @@ -0,0 +1,101 @@ +filename = $cookieFile; + $this->storeSessionCookies = $storeSessionCookies; + + if (\file_exists($cookieFile)) { + $this->load($cookieFile); + } + } + + /** + * Saves the file when shutting down + */ + public function __destruct() + { + $this->save($this->filename); + } + + /** + * Saves the cookies to a file. + * + * @param string $filename File to save + * + * @throws \RuntimeException if the file cannot be found or created + */ + public function save(string $filename): void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $jsonStr = Utils::jsonEncode($json); + if (false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) { + throw new \RuntimeException("Unable to save file {$filename}"); + } + } + + /** + * Load cookies from a JSON formatted file. + * + * Old cookies are kept unless overwritten by newly loaded ones. + * + * @param string $filename Cookie file to load. + * + * @throws \RuntimeException if the file cannot be loaded. + */ + public function load(string $filename): void + { + $json = \file_get_contents($filename); + if (false === $json) { + throw new \RuntimeException("Unable to load file {$filename}"); + } + if ($json === '') { + return; + } + + $data = Utils::jsonDecode($json, true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\is_scalar($data) && !empty($data)) { + throw new \RuntimeException("Invalid cookie file: {$filename}"); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php new file mode 100644 index 0000000000..cb3e67c6aa --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -0,0 +1,77 @@ +sessionKey = $sessionKey; + $this->storeSessionCookies = $storeSessionCookies; + $this->load(); + } + + /** + * Saves cookies to session when shutting down + */ + public function __destruct() + { + $this->save(); + } + + /** + * Save cookies to the client session + */ + public function save(): void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $_SESSION[$this->sessionKey] = \json_encode($json); + } + + /** + * Load the contents of the client session into the data array + */ + protected function load(): void + { + if (!isset($_SESSION[$this->sessionKey])) { + return; + } + $data = \json_decode($_SESSION[$this->sessionKey], true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\strlen($data)) { + throw new \RuntimeException('Invalid cookie data'); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SetCookie.php new file mode 100644 index 0000000000..c9806da882 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -0,0 +1,488 @@ + null, + 'Value' => null, + 'Domain' => null, + 'Path' => '/', + 'Max-Age' => null, + 'Expires' => null, + 'Secure' => false, + 'Discard' => false, + 'HttpOnly' => false, + ]; + + /** + * @var array Cookie data + */ + private $data; + + /** + * Create a new SetCookie object from a string. + * + * @param string $cookie Set-Cookie header string + */ + public static function fromString(string $cookie): self + { + // Create the default return array + $data = self::$defaults; + // Explode the cookie string using a series of semicolons + $pieces = \array_filter(\array_map('trim', \explode(';', $cookie))); + // The name of the cookie (first kvp) must exist and include an equal sign. + if (!isset($pieces[0]) || \strpos($pieces[0], '=') === false) { + return new self($data); + } + + // Add the cookie pieces into the parsed data array + foreach ($pieces as $part) { + $cookieParts = \explode('=', $part, 2); + $key = \trim($cookieParts[0]); + $value = isset($cookieParts[1]) + ? \trim($cookieParts[1], " \n\r\t\0\x0B") + : true; + + // Only check for non-cookies when cookies have been found + if (!isset($data['Name'])) { + $data['Name'] = $key; + $data['Value'] = $value; + } else { + foreach (\array_keys(self::$defaults) as $search) { + if (!\strcasecmp($search, $key)) { + if ($search === 'Max-Age') { + if (is_numeric($value)) { + $data[$search] = (int) $value; + } + } else { + $data[$search] = $value; + } + continue 2; + } + } + $data[$key] = $value; + } + } + + return new self($data); + } + + /** + * @param array $data Array of cookie data provided by a Cookie parser + */ + public function __construct(array $data = []) + { + $this->data = self::$defaults; + + if (isset($data['Name'])) { + $this->setName($data['Name']); + } + + if (isset($data['Value'])) { + $this->setValue($data['Value']); + } + + if (isset($data['Domain'])) { + $this->setDomain($data['Domain']); + } + + if (isset($data['Path'])) { + $this->setPath($data['Path']); + } + + if (isset($data['Max-Age'])) { + $this->setMaxAge($data['Max-Age']); + } + + if (isset($data['Expires'])) { + $this->setExpires($data['Expires']); + } + + if (isset($data['Secure'])) { + $this->setSecure($data['Secure']); + } + + if (isset($data['Discard'])) { + $this->setDiscard($data['Discard']); + } + + if (isset($data['HttpOnly'])) { + $this->setHttpOnly($data['HttpOnly']); + } + + // Set the remaining values that don't have extra validation logic + foreach (array_diff(array_keys($data), array_keys(self::$defaults)) as $key) { + $this->data[$key] = $data[$key]; + } + + // Extract the Expires value and turn it into a UNIX timestamp if needed + if (!$this->getExpires() && $this->getMaxAge()) { + // Calculate the Expires date + $this->setExpires(\time() + $this->getMaxAge()); + } elseif (null !== ($expires = $this->getExpires()) && !\is_numeric($expires)) { + $this->setExpires($expires); + } + } + + public function __toString() + { + $str = $this->data['Name'].'='.($this->data['Value'] ?? '').'; '; + foreach ($this->data as $k => $v) { + if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { + if ($k === 'Expires') { + $str .= 'Expires='.\gmdate('D, d M Y H:i:s \G\M\T', $v).'; '; + } else { + $str .= ($v === true ? $k : "{$k}={$v}").'; '; + } + } + } + + return \rtrim($str, '; '); + } + + public function toArray(): array + { + return $this->data; + } + + /** + * Get the cookie name. + * + * @return string + */ + public function getName() + { + return $this->data['Name']; + } + + /** + * Set the cookie name. + * + * @param string $name Cookie name + */ + public function setName($name): void + { + if (!is_string($name)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Name'] = (string) $name; + } + + /** + * Get the cookie value. + * + * @return string|null + */ + public function getValue() + { + return $this->data['Value']; + } + + /** + * Set the cookie value. + * + * @param string $value Cookie value + */ + public function setValue($value): void + { + if (!is_string($value)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Value'] = (string) $value; + } + + /** + * Get the domain. + * + * @return string|null + */ + public function getDomain() + { + return $this->data['Domain']; + } + + /** + * Set the domain of the cookie. + * + * @param string|null $domain + */ + public function setDomain($domain): void + { + if (!is_string($domain) && null !== $domain) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Domain'] = null === $domain ? null : (string) $domain; + } + + /** + * Get the path. + * + * @return string + */ + public function getPath() + { + return $this->data['Path']; + } + + /** + * Set the path of the cookie. + * + * @param string $path Path of the cookie + */ + public function setPath($path): void + { + if (!is_string($path)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Path'] = (string) $path; + } + + /** + * Maximum lifetime of the cookie in seconds. + * + * @return int|null + */ + public function getMaxAge() + { + return null === $this->data['Max-Age'] ? null : (int) $this->data['Max-Age']; + } + + /** + * Set the max-age of the cookie. + * + * @param int|null $maxAge Max age of the cookie in seconds + */ + public function setMaxAge($maxAge): void + { + if (!is_int($maxAge) && null !== $maxAge) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Max-Age'] = $maxAge === null ? null : (int) $maxAge; + } + + /** + * The UNIX timestamp when the cookie Expires. + * + * @return string|int|null + */ + public function getExpires() + { + return $this->data['Expires']; + } + + /** + * Set the unix timestamp for which the cookie will expire. + * + * @param int|string|null $timestamp Unix timestamp or any English textual datetime description. + */ + public function setExpires($timestamp): void + { + if (!is_int($timestamp) && !is_string($timestamp) && null !== $timestamp) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int, string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Expires'] = null === $timestamp ? null : (\is_numeric($timestamp) ? (int) $timestamp : \strtotime((string) $timestamp)); + } + + /** + * Get whether or not this is a secure cookie. + * + * @return bool + */ + public function getSecure() + { + return $this->data['Secure']; + } + + /** + * Set whether or not the cookie is secure. + * + * @param bool $secure Set to true or false if secure + */ + public function setSecure($secure): void + { + if (!is_bool($secure)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Secure'] = (bool) $secure; + } + + /** + * Get whether or not this is a session cookie. + * + * @return bool|null + */ + public function getDiscard() + { + return $this->data['Discard']; + } + + /** + * Set whether or not this is a session cookie. + * + * @param bool $discard Set to true or false if this is a session cookie + */ + public function setDiscard($discard): void + { + if (!is_bool($discard)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Discard'] = (bool) $discard; + } + + /** + * Get whether or not this is an HTTP only cookie. + * + * @return bool + */ + public function getHttpOnly() + { + return $this->data['HttpOnly']; + } + + /** + * Set whether or not this is an HTTP only cookie. + * + * @param bool $httpOnly Set to true or false if this is HTTP only + */ + public function setHttpOnly($httpOnly): void + { + if (!is_bool($httpOnly)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['HttpOnly'] = (bool) $httpOnly; + } + + /** + * Check if the cookie matches a path value. + * + * A request-path path-matches a given cookie-path if at least one of + * the following conditions holds: + * + * - The cookie-path and the request-path are identical. + * - The cookie-path is a prefix of the request-path, and the last + * character of the cookie-path is %x2F ("/"). + * - The cookie-path is a prefix of the request-path, and the first + * character of the request-path that is not included in the cookie- + * path is a %x2F ("/") character. + * + * @param string $requestPath Path to check against + */ + public function matchesPath(string $requestPath): bool + { + $cookiePath = $this->getPath(); + + // Match on exact matches or when path is the default empty "/" + if ($cookiePath === '/' || $cookiePath == $requestPath) { + return true; + } + + // Ensure that the cookie-path is a prefix of the request path. + if (0 !== \strpos($requestPath, $cookiePath)) { + return false; + } + + // Match if the last character of the cookie-path is "/" + if (\substr($cookiePath, -1, 1) === '/') { + return true; + } + + // Match if the first character not included in cookie path is "/" + return \substr($requestPath, \strlen($cookiePath), 1) === '/'; + } + + /** + * Check if the cookie matches a domain value. + * + * @param string $domain Domain to check against + */ + public function matchesDomain(string $domain): bool + { + $cookieDomain = $this->getDomain(); + if (null === $cookieDomain) { + return true; + } + + // Remove the leading '.' as per spec in RFC 6265. + // https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.3 + $cookieDomain = \ltrim(\strtolower($cookieDomain), '.'); + + $domain = \strtolower($domain); + + // Domain not set or exact match. + if ('' === $cookieDomain || $domain === $cookieDomain) { + return true; + } + + // Matching the subdomain according to RFC 6265. + // https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3 + if (\filter_var($domain, \FILTER_VALIDATE_IP)) { + return false; + } + + return (bool) \preg_match('/\.'.\preg_quote($cookieDomain, '/').'$/', $domain); + } + + /** + * Check if the cookie is expired. + */ + public function isExpired(): bool + { + return $this->getExpires() !== null && \time() > $this->getExpires(); + } + + /** + * Check if the cookie is valid according to RFC 6265. + * + * @return bool|string Returns true if valid or an error message if invalid + */ + public function validate() + { + $name = $this->getName(); + if ($name === '') { + return 'The cookie name must not be empty'; + } + + // Check if any of the invalid characters are present in the cookie name + if (\preg_match( + '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', + $name + )) { + return 'Cookie name must not contain invalid characters: ASCII ' + .'Control characters (0-31;127), space, tab and the ' + .'following characters: ()<>@,;:\"/?={}'; + } + + // Value must not be null. 0 and empty string are valid. Empty strings + // are technically against RFC 6265, but known to happen in the wild. + $value = $this->getValue(); + if ($value === null) { + return 'The cookie value must not be empty'; + } + + // Domains must not be empty, but can be 0. "0" is not a valid internet + // domain, but may be used as server name in a private network. + $domain = $this->getDomain(); + if ($domain === null || $domain === '') { + return 'The cookie domain must not be empty'; + } + + return true; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/BadResponseException.php new file mode 100644 index 0000000000..ba67ad498c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -0,0 +1,39 @@ +request = $request; + $this->handlerContext = $handlerContext; + } + + /** + * Get the request that caused the exception + */ + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + */ + public function getHandlerContext(): array + { + return $this->handlerContext; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/GuzzleException.php new file mode 100644 index 0000000000..fa3ed6998c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/GuzzleException.php @@ -0,0 +1,9 @@ +getStatusCode() : 0; + parent::__construct($message, $code, $previous); + $this->request = $request; + $this->response = $response; + $this->handlerContext = $handlerContext; + } + + /** + * Wrap non-RequestExceptions with a RequestException + */ + public static function wrapException(RequestInterface $request, \Throwable $e): RequestException + { + return $e instanceof RequestException ? $e : new RequestException($e->getMessage(), $request, null, $e); + } + + /** + * Factory method to create a new exception with a normalized error message + * + * @param RequestInterface $request Request sent + * @param ResponseInterface $response Response received + * @param \Throwable|null $previous Previous exception + * @param array $handlerContext Optional handler context + * @param BodySummarizerInterface|null $bodySummarizer Optional body summarizer + */ + public static function create( + RequestInterface $request, + ?ResponseInterface $response = null, + ?\Throwable $previous = null, + array $handlerContext = [], + ?BodySummarizerInterface $bodySummarizer = null + ): self { + if (!$response) { + return new self( + 'Error completing request', + $request, + null, + $previous, + $handlerContext + ); + } + + $level = (int) \floor($response->getStatusCode() / 100); + if ($level === 4) { + $label = 'Client error'; + $className = ClientException::class; + } elseif ($level === 5) { + $label = 'Server error'; + $className = ServerException::class; + } else { + $label = 'Unsuccessful request'; + $className = __CLASS__; + } + + $uri = \GuzzleHttp\Psr7\Utils::redactUserInfo($request->getUri()); + + // Client Error: `GET /` resulted in a `404 Not Found` response: + // ... (truncated) + $message = \sprintf( + '%s: `%s %s` resulted in a `%s %s` response', + $label, + $request->getMethod(), + $uri->__toString(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + $summary = ($bodySummarizer ?? new BodySummarizer())->summarize($response); + + if ($summary !== null) { + $message .= ":\n{$summary}\n"; + } + + return new $className($message, $request, $response, $previous, $handlerContext); + } + + /** + * Get the request that caused the exception + */ + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Get the associated response + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * Check if a response was received + */ + public function hasResponse(): bool + { + return $this->response !== null; + } + + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + */ + public function getHandlerContext(): array + { + return $this->handlerContext; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/ServerException.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/ServerException.php new file mode 100644 index 0000000000..8055e067c0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -0,0 +1,10 @@ +maxHandles = $maxHandles; + } + + public function create(RequestInterface $request, array $options): EasyHandle + { + $protocolVersion = $request->getProtocolVersion(); + + if ('2' === $protocolVersion || '2.0' === $protocolVersion) { + if (!self::supportsHttp2()) { + throw new ConnectException('HTTP/2 is supported by the cURL handler, however libcurl is built without HTTP/2 support.', $request); + } + } elseif ('1.0' !== $protocolVersion && '1.1' !== $protocolVersion) { + throw new ConnectException(sprintf('HTTP/%s is not supported by the cURL handler.', $protocolVersion), $request); + } + + if (isset($options['curl']['body_as_string'])) { + $options['_body_as_string'] = $options['curl']['body_as_string']; + unset($options['curl']['body_as_string']); + } + + $easy = new EasyHandle(); + $easy->request = $request; + $easy->options = $options; + $conf = $this->getDefaultConf($easy); + $this->applyMethod($easy, $conf); + $this->applyHandlerOptions($easy, $conf); + $this->applyHeaders($easy, $conf); + unset($conf['_headers']); + + // Add handler options from the request configuration options + if (isset($options['curl'])) { + $conf = \array_replace($conf, $options['curl']); + } + + $conf[\CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + $easy->handle = $this->handles ? \array_pop($this->handles) : \curl_init(); + curl_setopt_array($easy->handle, $conf); + + return $easy; + } + + private static function supportsHttp2(): bool + { + static $supportsHttp2 = null; + + if (null === $supportsHttp2) { + $supportsHttp2 = self::supportsTls12() + && defined('CURL_VERSION_HTTP2') + && (\CURL_VERSION_HTTP2 & \curl_version()['features']); + } + + return $supportsHttp2; + } + + private static function supportsTls12(): bool + { + static $supportsTls12 = null; + + if (null === $supportsTls12) { + $supportsTls12 = \CURL_SSLVERSION_TLSv1_2 & \curl_version()['features']; + } + + return $supportsTls12; + } + + private static function supportsTls13(): bool + { + static $supportsTls13 = null; + + if (null === $supportsTls13) { + $supportsTls13 = defined('CURL_SSLVERSION_TLSv1_3') + && (\CURL_SSLVERSION_TLSv1_3 & \curl_version()['features']); + } + + return $supportsTls13; + } + + public function release(EasyHandle $easy): void + { + $resource = $easy->handle; + unset($easy->handle); + + if (\count($this->handles) >= $this->maxHandles) { + \curl_close($resource); + } else { + // Remove all callback functions as they can hold onto references + // and are not cleaned up by curl_reset. Using curl_setopt_array + // does not work for some reason, so removing each one + // individually. + \curl_setopt($resource, \CURLOPT_HEADERFUNCTION, null); + \curl_setopt($resource, \CURLOPT_READFUNCTION, null); + \curl_setopt($resource, \CURLOPT_WRITEFUNCTION, null); + \curl_setopt($resource, \CURLOPT_PROGRESSFUNCTION, null); + \curl_reset($resource); + $this->handles[] = $resource; + } + } + + /** + * Completes a cURL transaction, either returning a response promise or a + * rejected promise. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + * @param CurlFactoryInterface $factory Dictates how the handle is released + */ + public static function finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface + { + if (isset($easy->options['on_stats'])) { + self::invokeStats($easy); + } + + if (!$easy->response || $easy->errno) { + return self::finishError($handler, $easy, $factory); + } + + // Return the response if it is present and there is no error. + $factory->release($easy); + + // Rewind the body of the response if possible. + $body = $easy->response->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + + return new FulfilledPromise($easy->response); + } + + private static function invokeStats(EasyHandle $easy): void + { + $curlStats = \curl_getinfo($easy->handle); + $curlStats['appconnect_time'] = \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME); + $stats = new TransferStats( + $easy->request, + $easy->response, + $curlStats['total_time'], + $easy->errno, + $curlStats + ); + ($easy->options['on_stats'])($stats); + } + + /** + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface + { + // Get error information and release the handle to the factory. + $ctx = [ + 'errno' => $easy->errno, + 'error' => \curl_error($easy->handle), + 'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME), + ] + \curl_getinfo($easy->handle); + $ctx[self::CURL_VERSION_STR] = self::getCurlVersion(); + $factory->release($easy); + + // Retry when nothing is present or when curl failed to rewind. + if (empty($easy->options['_err_message']) && (!$easy->errno || $easy->errno == 65)) { + return self::retryFailedRewind($handler, $easy, $ctx); + } + + return self::createRejection($easy, $ctx); + } + + private static function getCurlVersion(): string + { + static $curlVersion = null; + + if (null === $curlVersion) { + $curlVersion = \curl_version()['version']; + } + + return $curlVersion; + } + + private static function createRejection(EasyHandle $easy, array $ctx): PromiseInterface + { + static $connectionErrors = [ + \CURLE_OPERATION_TIMEOUTED => true, + \CURLE_COULDNT_RESOLVE_HOST => true, + \CURLE_COULDNT_CONNECT => true, + \CURLE_SSL_CONNECT_ERROR => true, + \CURLE_GOT_NOTHING => true, + ]; + + if ($easy->createResponseException) { + return P\Create::rejectionFor( + new RequestException( + 'An error was encountered while creating the response', + $easy->request, + $easy->response, + $easy->createResponseException, + $ctx + ) + ); + } + + // If an exception was encountered during the onHeaders event, then + // return a rejected promise that wraps that exception. + if ($easy->onHeadersException) { + return P\Create::rejectionFor( + new RequestException( + 'An error was encountered during the on_headers event', + $easy->request, + $easy->response, + $easy->onHeadersException, + $ctx + ) + ); + } + + $uri = $easy->request->getUri(); + + $sanitizedError = self::sanitizeCurlError($ctx['error'] ?? '', $uri); + + $message = \sprintf( + 'cURL error %s: %s (%s)', + $ctx['errno'], + $sanitizedError, + 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' + ); + + if ('' !== $sanitizedError) { + $redactedUriString = \GuzzleHttp\Psr7\Utils::redactUserInfo($uri)->__toString(); + if ($redactedUriString !== '' && false === \strpos($sanitizedError, $redactedUriString)) { + $message .= \sprintf(' for %s', $redactedUriString); + } + } + + // Create a connection exception if it was a specific error code. + $error = isset($connectionErrors[$easy->errno]) + ? new ConnectException($message, $easy->request, null, $ctx) + : new RequestException($message, $easy->request, $easy->response, null, $ctx); + + return P\Create::rejectionFor($error); + } + + private static function sanitizeCurlError(string $error, UriInterface $uri): string + { + if ('' === $error) { + return $error; + } + + $baseUri = $uri->withQuery('')->withFragment(''); + $baseUriString = $baseUri->__toString(); + + if ('' === $baseUriString) { + return $error; + } + + $redactedUriString = \GuzzleHttp\Psr7\Utils::redactUserInfo($baseUri)->__toString(); + + return str_replace($baseUriString, $redactedUriString, $error); + } + + /** + * @return array + */ + private function getDefaultConf(EasyHandle $easy): array + { + $conf = [ + '_headers' => $easy->request->getHeaders(), + \CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), + \CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), + \CURLOPT_RETURNTRANSFER => false, + \CURLOPT_HEADER => false, + \CURLOPT_CONNECTTIMEOUT => 300, + ]; + + if (\defined('CURLOPT_PROTOCOLS')) { + $conf[\CURLOPT_PROTOCOLS] = \CURLPROTO_HTTP | \CURLPROTO_HTTPS; + } + + $version = $easy->request->getProtocolVersion(); + + if ('2' === $version || '2.0' === $version) { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0; + } elseif ('1.1' === $version) { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; + } else { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0; + } + + return $conf; + } + + private function applyMethod(EasyHandle $easy, array &$conf): void + { + $body = $easy->request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size > 0) { + $this->applyBody($easy->request, $easy->options, $conf); + + return; + } + + $method = $easy->request->getMethod(); + if ($method === 'PUT' || $method === 'POST') { + // See https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2 + if (!$easy->request->hasHeader('Content-Length')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + } elseif ($method === 'HEAD') { + $conf[\CURLOPT_NOBODY] = true; + unset( + $conf[\CURLOPT_WRITEFUNCTION], + $conf[\CURLOPT_READFUNCTION], + $conf[\CURLOPT_FILE], + $conf[\CURLOPT_INFILE] + ); + } + } + + private function applyBody(RequestInterface $request, array $options, array &$conf): void + { + $size = $request->hasHeader('Content-Length') + ? (int) $request->getHeaderLine('Content-Length') + : null; + + // Send the body as a string if the size is less than 1MB OR if the + // [curl][body_as_string] request value is set. + if (($size !== null && $size < 1000000) || !empty($options['_body_as_string'])) { + $conf[\CURLOPT_POSTFIELDS] = (string) $request->getBody(); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $conf); + $this->removeHeader('Transfer-Encoding', $conf); + } else { + $conf[\CURLOPT_UPLOAD] = true; + if ($size !== null) { + $conf[\CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $conf); + } + $body = $request->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + $conf[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) { + return $body->read($length); + }; + } + + // If the Expect header is not present, prevent curl from adding it + if (!$request->hasHeader('Expect')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + // cURL sometimes adds a content-type by default. Prevent this. + if (!$request->hasHeader('Content-Type')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function applyHeaders(EasyHandle $easy, array &$conf): void + { + foreach ($conf['_headers'] as $name => $values) { + foreach ($values as $value) { + $value = (string) $value; + if ($value === '') { + // cURL requires a special format for empty headers. + // See https://github.com/guzzle/guzzle/issues/1882 for more details. + $conf[\CURLOPT_HTTPHEADER][] = "$name;"; + } else { + $conf[\CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + } + + // Remove the Accept header if one was not set + if (!$easy->request->hasHeader('Accept')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader(string $name, array &$options): void + { + foreach (\array_keys($options['_headers']) as $key) { + if (!\strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + + return; + } + } + } + + private function applyHandlerOptions(EasyHandle $easy, array &$conf): void + { + $options = $easy->options; + if (isset($options['verify'])) { + if ($options['verify'] === false) { + unset($conf[\CURLOPT_CAINFO]); + $conf[\CURLOPT_SSL_VERIFYHOST] = 0; + $conf[\CURLOPT_SSL_VERIFYPEER] = false; + } else { + $conf[\CURLOPT_SSL_VERIFYHOST] = 2; + $conf[\CURLOPT_SSL_VERIFYPEER] = true; + if (\is_string($options['verify'])) { + // Throw an error if the file/folder/link path is not valid or doesn't exist. + if (!\file_exists($options['verify'])) { + throw new \InvalidArgumentException("SSL CA bundle not found: {$options['verify']}"); + } + // If it's a directory or a link to a directory use CURLOPT_CAPATH. + // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. + if ( + \is_dir($options['verify']) + || ( + \is_link($options['verify']) === true + && ($verifyLink = \readlink($options['verify'])) !== false + && \is_dir($verifyLink) + ) + ) { + $conf[\CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[\CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + + if (!isset($options['curl'][\CURLOPT_ENCODING]) && !empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[\CURLOPT_ENCODING] = $accept; + } else { + // The empty string enables all available decoders and implicitly + // sets a matching 'Accept-Encoding' header. + $conf[\CURLOPT_ENCODING] = ''; + // But as the user did not specify any encoding preference, + // let's leave it up to server by preventing curl from sending + // the header, which will be interpreted as 'Accept-Encoding: *'. + // https://www.rfc-editor.org/rfc/rfc9110#field.accept-encoding + $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + + if (!isset($options['sink'])) { + // Use a default temp stream if no sink was set. + $options['sink'] = \GuzzleHttp\Psr7\Utils::tryFopen('php://temp', 'w+'); + } + $sink = $options['sink']; + if (!\is_string($sink)) { + $sink = \GuzzleHttp\Psr7\Utils::streamFor($sink); + } elseif (!\is_dir(\dirname($sink))) { + // Ensure that the directory exists before failing in curl. + throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink)); + } else { + $sink = new LazyOpenStream($sink, 'w+'); + } + $easy->sink = $sink; + $conf[\CURLOPT_WRITEFUNCTION] = static function ($ch, $write) use ($sink): int { + return $sink->write($write); + }; + + $timeoutRequiresNoSignal = false; + if (isset($options['timeout'])) { + $timeoutRequiresNoSignal |= $options['timeout'] < 1; + $conf[\CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + } + + // CURL default value is CURL_IPRESOLVE_WHATEVER + if (isset($options['force_ip_resolve'])) { + if ('v4' === $options['force_ip_resolve']) { + $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; + } elseif ('v6' === $options['force_ip_resolve']) { + $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V6; + } + } + + if (isset($options['connect_timeout'])) { + $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; + $conf[\CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + } + + if ($timeoutRequiresNoSignal && \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN') { + $conf[\CURLOPT_NOSIGNAL] = true; + } + + if (isset($options['proxy'])) { + if (!\is_array($options['proxy'])) { + $conf[\CURLOPT_PROXY] = $options['proxy']; + } else { + $scheme = $easy->request->getUri()->getScheme(); + if (isset($options['proxy'][$scheme])) { + $host = $easy->request->getUri()->getHost(); + if (isset($options['proxy']['no']) && Utils::isHostInNoProxy($host, $options['proxy']['no'])) { + unset($conf[\CURLOPT_PROXY]); + } else { + $conf[\CURLOPT_PROXY] = $options['proxy'][$scheme]; + } + } + } + } + + if (isset($options['crypto_method'])) { + $protocolVersion = $easy->request->getProtocolVersion(); + + // If HTTP/2, upgrade TLS 1.0 and 1.1 to 1.2 + if ('2' === $protocolVersion || '2.0' === $protocolVersion) { + if ( + \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method'] + || \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method'] + || \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method'] + ) { + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2; + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) { + if (!self::supportsTls13()) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_3; + } else { + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) { + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_0; + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']) { + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_1; + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']) { + if (!self::supportsTls12()) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2; + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) { + if (!self::supportsTls13()) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_3; + } else { + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + } + + if (isset($options['cert'])) { + $cert = $options['cert']; + if (\is_array($cert)) { + $conf[\CURLOPT_SSLCERTPASSWD] = $cert[1]; + $cert = $cert[0]; + } + if (!\file_exists($cert)) { + throw new \InvalidArgumentException("SSL certificate not found: {$cert}"); + } + // OpenSSL (versions 0.9.3 and later) also support "P12" for PKCS#12-encoded files. + // see https://curl.se/libcurl/c/CURLOPT_SSLCERTTYPE.html + $ext = pathinfo($cert, \PATHINFO_EXTENSION); + if (preg_match('#^(der|p12)$#i', $ext)) { + $conf[\CURLOPT_SSLCERTTYPE] = strtoupper($ext); + } + $conf[\CURLOPT_SSLCERT] = $cert; + } + + if (isset($options['ssl_key'])) { + if (\is_array($options['ssl_key'])) { + if (\count($options['ssl_key']) === 2) { + [$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key']; + } else { + [$sslKey] = $options['ssl_key']; + } + } + + $sslKey = $sslKey ?? $options['ssl_key']; + + if (!\file_exists($sslKey)) { + throw new \InvalidArgumentException("SSL private key not found: {$sslKey}"); + } + $conf[\CURLOPT_SSLKEY] = $sslKey; + } + + if (isset($options['progress'])) { + $progress = $options['progress']; + if (!\is_callable($progress)) { + throw new \InvalidArgumentException('progress client option must be callable'); + } + $conf[\CURLOPT_NOPROGRESS] = false; + $conf[\CURLOPT_PROGRESSFUNCTION] = static function ($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use ($progress) { + $progress($downloadSize, $downloaded, $uploadSize, $uploaded); + }; + } + + if (!empty($options['debug'])) { + $conf[\CURLOPT_STDERR] = Utils::debugResource($options['debug']); + $conf[\CURLOPT_VERBOSE] = true; + } + } + + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx): PromiseInterface + { + try { + // Only rewind if the body has been read from. + $body = $easy->request->getBody(); + if ($body->tell() > 0) { + $body->rewind(); + } + } catch (\RuntimeException $e) { + $ctx['error'] = 'The connection unexpectedly failed without ' + .'providing an error. The request would have been retried, ' + .'but attempting to rewind the request body failed. ' + .'Exception: '.$e; + + return self::createRejection($easy, $ctx); + } + + // Retry no more than 3 times before giving up. + if (!isset($easy->options['_curl_retries'])) { + $easy->options['_curl_retries'] = 1; + } elseif ($easy->options['_curl_retries'] == 2) { + $ctx['error'] = 'The cURL request was retried 3 times ' + .'and did not succeed. The most likely reason for the failure ' + .'is that cURL was unable to rewind the body of the request ' + .'and subsequent retries resulted in the same error. Turn on ' + .'the debug option to see what went wrong. See ' + .'https://bugs.php.net/bug.php?id=47204 for more information.'; + + return self::createRejection($easy, $ctx); + } else { + ++$easy->options['_curl_retries']; + } + + return $handler($easy->request, $easy->options); + } + + private function createHeaderFn(EasyHandle $easy): callable + { + if (isset($easy->options['on_headers'])) { + $onHeaders = $easy->options['on_headers']; + + if (!\is_callable($onHeaders)) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + } else { + $onHeaders = null; + } + + return static function ($ch, $h) use ( + $onHeaders, + $easy, + &$startingResponse + ) { + $value = \trim($h); + if ($value === '') { + $startingResponse = true; + try { + $easy->createResponse(); + } catch (\Exception $e) { + $easy->createResponseException = $e; + + return -1; + } + if ($onHeaders !== null) { + try { + $onHeaders($easy->response); + } catch (\Exception $e) { + // Associate the exception with the handle and trigger + // a curl header write error by returning 0. + $easy->onHeadersException = $e; + + return -1; + } + } + } elseif ($startingResponse) { + $startingResponse = false; + $easy->headers = [$value]; + } else { + $easy->headers[] = $value; + } + + return \strlen($h); + }; + } + + public function __destruct() + { + foreach ($this->handles as $id => $handle) { + \curl_close($handle); + unset($this->handles[$id]); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php new file mode 100644 index 0000000000..fe57ed5d57 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -0,0 +1,25 @@ +factory = $options['handle_factory'] + ?? new CurlFactory(3); + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (isset($options['delay'])) { + \usleep($options['delay'] * 1000); + } + + $easy = $this->factory->create($request, $options); + \curl_exec($easy->handle); + $easy->errno = \curl_errno($easy->handle); + + return CurlFactory::finish($this, $easy, $this->factory); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php new file mode 100644 index 0000000000..73a6abe333 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -0,0 +1,284 @@ + An array of delay times, indexed by handle id in `addRequest`. + * + * @see CurlMultiHandler::addRequest + */ + private $delays = []; + + /** + * @var array An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt() + */ + private $options = []; + + /** @var resource|\CurlMultiHandle */ + private $_mh; + + /** + * This handler accepts the following options: + * + * - handle_factory: An optional factory used to create curl handles + * - select_timeout: Optional timeout (in seconds) to block before timing + * out while selecting curl handles. Defaults to 1 second. + * - options: An associative array of CURLMOPT_* options and + * corresponding values for curl_multi_setopt() + */ + public function __construct(array $options = []) + { + $this->factory = $options['handle_factory'] ?? new CurlFactory(50); + + if (isset($options['select_timeout'])) { + $this->selectTimeout = $options['select_timeout']; + } elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { + @trigger_error('Since guzzlehttp/guzzle 7.2.0: Using environment variable GUZZLE_CURL_SELECT_TIMEOUT is deprecated. Use option "select_timeout" instead.', \E_USER_DEPRECATED); + $this->selectTimeout = (int) $selectTimeout; + } else { + $this->selectTimeout = 1; + } + + $this->options = $options['options'] ?? []; + + // unsetting the property forces the first access to go through + // __get(). + unset($this->_mh); + } + + /** + * @param string $name + * + * @return resource|\CurlMultiHandle + * + * @throws \BadMethodCallException when another field as `_mh` will be gotten + * @throws \RuntimeException when curl can not initialize a multi handle + */ + public function __get($name) + { + if ($name !== '_mh') { + throw new \BadMethodCallException("Can not get other property as '_mh'."); + } + + $multiHandle = \curl_multi_init(); + + if (false === $multiHandle) { + throw new \RuntimeException('Can not initialize curl multi handle.'); + } + + $this->_mh = $multiHandle; + + foreach ($this->options as $option => $value) { + // A warning is raised in case of a wrong option. + curl_multi_setopt($this->_mh, $option, $value); + } + + return $this->_mh; + } + + public function __destruct() + { + if (isset($this->_mh)) { + \curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $easy = $this->factory->create($request, $options); + $id = (int) $easy->handle; + + $promise = new Promise( + [$this, 'execute'], + function () use ($id) { + return $this->cancel($id); + } + ); + + $this->addRequest(['easy' => $easy, 'deferred' => $promise]); + + return $promise; + } + + /** + * Ticks the curl event loop. + */ + public function tick(): void + { + // Add any delayed handles if needed. + if ($this->delays) { + $currentTime = Utils::currentTime(); + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + \curl_multi_add_handle( + $this->_mh, + $this->handles[$id]['easy']->handle + ); + } + } + } + + // Run curl_multi_exec in the queue to enable other async tasks to run + P\Utils::queue()->add(Closure::fromCallable([$this, 'tickInQueue'])); + + // Step through the task queue which may add additional requests. + P\Utils::queue()->run(); + + if ($this->active && \curl_multi_select($this->_mh, $this->selectTimeout) === -1) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + \usleep(250); + } + + while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) { + // Prevent busy looping for slow HTTP requests. + \curl_multi_select($this->_mh, $this->selectTimeout); + } + + $this->processMessages(); + } + + /** + * Runs \curl_multi_exec() inside the event loop, to prevent busy looping + */ + private function tickInQueue(): void + { + if (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) { + \curl_multi_select($this->_mh, 0); + P\Utils::queue()->add(Closure::fromCallable([$this, 'tickInQueue'])); + } + } + + /** + * Runs until all outstanding connections have completed. + */ + public function execute(): void + { + $queue = P\Utils::queue(); + + while ($this->handles || !$queue->isEmpty()) { + // If there are no transfers, then sleep for the next delay + if (!$this->active && $this->delays) { + \usleep($this->timeToNext()); + } + $this->tick(); + } + } + + private function addRequest(array $entry): void + { + $easy = $entry['easy']; + $id = (int) $easy->handle; + $this->handles[$id] = $entry; + if (empty($easy->options['delay'])) { + \curl_multi_add_handle($this->_mh, $easy->handle); + } else { + $this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000); + } + } + + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id): bool + { + if (!is_int($id)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an integer to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return false; + } + + $handle = $this->handles[$id]['easy']->handle; + unset($this->delays[$id], $this->handles[$id]); + \curl_multi_remove_handle($this->_mh, $handle); + \curl_close($handle); + + return true; + } + + private function processMessages(): void + { + while ($done = \curl_multi_info_read($this->_mh)) { + if ($done['msg'] !== \CURLMSG_DONE) { + // if it's not done, then it would be premature to remove the handle. ref https://github.com/guzzle/guzzle/pull/2892#issuecomment-945150216 + continue; + } + $id = (int) $done['handle']; + \curl_multi_remove_handle($this->_mh, $done['handle']); + + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + + $entry = $this->handles[$id]; + unset($this->handles[$id], $this->delays[$id]); + $entry['easy']->errno = $done['result']; + $entry['deferred']->resolve( + CurlFactory::finish($this, $entry['easy'], $this->factory) + ); + } + } + + private function timeToNext(): int + { + $currentTime = Utils::currentTime(); + $nextTime = \PHP_INT_MAX; + foreach ($this->delays as $time) { + if ($time < $nextTime) { + $nextTime = $time; + } + } + + return ((int) \max(0, $nextTime - $currentTime)) * 1000000; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/EasyHandle.php new file mode 100644 index 0000000000..1bc39f4b4b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -0,0 +1,112 @@ +headers); + + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + + if (!empty($this->options['decode_content']) && isset($normalizedKeys['content-encoding'])) { + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; + unset($headers[$normalizedKeys['content-encoding']]); + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']]; + + $bodyLength = (int) $this->sink->getSize(); + if ($bodyLength) { + $headers[$normalizedKeys['content-length']] = $bodyLength; + } else { + unset($headers[$normalizedKeys['content-length']]); + } + } + } + + // Attach a response to the easy handle with the parsed headers. + $this->response = new Response( + $status, + $headers, + $this->sink, + $ver, + $reason + ); + } + + /** + * @param string $name + * + * @return void + * + * @throws \BadMethodCallException + */ + public function __get($name) + { + $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: '.$name; + throw new \BadMethodCallException($msg); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php new file mode 100644 index 0000000000..5554b8fa9f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php @@ -0,0 +1,42 @@ +|null $queue The parameters to be passed to the append function, as an indexed array. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. + */ + public function __construct(?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null) + { + $this->onFulfilled = $onFulfilled; + $this->onRejected = $onRejected; + + if ($queue) { + // array_values included for BC + $this->append(...array_values($queue)); + } + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + + if (isset($options['delay']) && \is_numeric($options['delay'])) { + \usleep((int) $options['delay'] * 1000); + } + + $this->lastRequest = $request; + $this->lastOptions = $options; + $response = \array_shift($this->queue); + + if (isset($options['on_headers'])) { + if (!\is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $response = new RequestException($msg, $request, $response, $e); + } + } + + if (\is_callable($response)) { + $response = $response($request, $options); + } + + $response = $response instanceof \Throwable + ? P\Create::rejectionFor($response) + : P\Create::promiseFor($response); + + return $response->then( + function (?ResponseInterface $value) use ($request, $options) { + $this->invokeStats($request, $options, $value); + if ($this->onFulfilled) { + ($this->onFulfilled)($value); + } + + if ($value !== null && isset($options['sink'])) { + $contents = (string) $value->getBody(); + $sink = $options['sink']; + + if (\is_resource($sink)) { + \fwrite($sink, $contents); + } elseif (\is_string($sink)) { + \file_put_contents($sink, $contents); + } elseif ($sink instanceof StreamInterface) { + $sink->write($contents); + } + } + + return $value; + }, + function ($reason) use ($request, $options) { + $this->invokeStats($request, $options, null, $reason); + if ($this->onRejected) { + ($this->onRejected)($reason); + } + + return P\Create::rejectionFor($reason); + } + ); + } + + /** + * Adds one or more variadic requests, exceptions, callables, or promises + * to the queue. + * + * @param mixed ...$values + */ + public function append(...$values): void + { + foreach ($values as $value) { + if ($value instanceof ResponseInterface + || $value instanceof \Throwable + || $value instanceof PromiseInterface + || \is_callable($value) + ) { + $this->queue[] = $value; + } else { + throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found '.Utils::describeType($value)); + } + } + } + + /** + * Get the last received request. + */ + public function getLastRequest(): ?RequestInterface + { + return $this->lastRequest; + } + + /** + * Get the last received request options. + */ + public function getLastOptions(): array + { + return $this->lastOptions; + } + + /** + * Returns the number of remaining items in the queue. + */ + public function count(): int + { + return \count($this->queue); + } + + public function reset(): void + { + $this->queue = []; + } + + /** + * @param mixed $reason Promise or reason. + */ + private function invokeStats( + RequestInterface $request, + array $options, + ?ResponseInterface $response = null, + $reason = null + ): void { + if (isset($options['on_stats'])) { + $transferTime = $options['transfer_time'] ?? 0; + $stats = new TransferStats($request, $response, $transferTime, $reason); + ($options['on_stats'])($stats); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/Proxy.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/Proxy.php new file mode 100644 index 0000000000..f045b526c5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -0,0 +1,51 @@ +getProtocolVersion(); + + if ('1.0' !== $protocolVersion && '1.1' !== $protocolVersion) { + throw new ConnectException(sprintf('HTTP/%s is not supported by the stream handler.', $protocolVersion), $request); + } + + $startTime = isset($options['on_stats']) ? Utils::currentTime() : null; + + try { + // Does not support the expect header. + $request = $request->withoutHeader('Expect'); + + // Append a content-length header if body size is zero to match + // cURL's behavior. + if (0 === $request->getBody()->getSize()) { + $request = $request->withHeader('Content-Length', '0'); + } + + return $this->createResponse( + $request, + $options, + $this->createStream($request, $options), + $startTime + ); + } catch (\InvalidArgumentException $e) { + throw $e; + } catch (\Exception $e) { + // Determine if the error was a networking error. + $message = $e->getMessage(); + // This list can probably get more comprehensive. + if (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed + || false !== \strpos($message, 'Connection refused') + || false !== \strpos($message, "couldn't connect to host") // error on HHVM + || false !== \strpos($message, 'connection attempt failed') + ) { + $e = new ConnectException($e->getMessage(), $request, $e); + } else { + $e = RequestException::wrapException($request, $e); + } + $this->invokeStats($options, $request, $startTime, null, $e); + + return P\Create::rejectionFor($e); + } + } + + private function invokeStats( + array $options, + RequestInterface $request, + ?float $startTime, + ?ResponseInterface $response = null, + ?\Throwable $error = null + ): void { + if (isset($options['on_stats'])) { + $stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []); + ($options['on_stats'])($stats); + } + } + + /** + * @param resource $stream + */ + private function createResponse(RequestInterface $request, array $options, $stream, ?float $startTime): PromiseInterface + { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + + try { + [$ver, $status, $reason, $headers] = HeaderProcessor::parseHeaders($hdrs); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered while creating the response', $request, null, $e) + ); + } + + [$stream, $headers] = $this->checkDecode($options, $headers, $stream); + $stream = Psr7\Utils::streamFor($stream); + $sink = $stream; + + if (\strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + + try { + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered while creating the response', $request, null, $e) + ); + } + + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered during the on_headers event', $request, $response, $e) + ); + } + } + + // Do not drain when the request is a HEAD request because they have + // no body. + if ($sink !== $stream) { + $this->drain($stream, $sink, $response->getHeaderLine('Content-Length')); + } + + $this->invokeStats($options, $request, $startTime, $response, null); + + return new FulfilledPromise($response); + } + + private function createSink(StreamInterface $stream, array $options): StreamInterface + { + if (!empty($options['stream'])) { + return $stream; + } + + $sink = $options['sink'] ?? Psr7\Utils::tryFopen('php://temp', 'r+'); + + return \is_string($sink) ? new Psr7\LazyOpenStream($sink, 'w+') : Psr7\Utils::streamFor($sink); + } + + /** + * @param resource $stream + */ + private function checkDecode(array $options, array $headers, $stream): array + { + // Automatically decode responses when instructed. + if (!empty($options['decode_content'])) { + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + $stream = new Psr7\InflateStream(Psr7\Utils::streamFor($stream)); + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; + + // Remove content-encoding header + unset($headers[$normalizedKeys['content-encoding']]); + + // Fix content-length header + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']]; + $length = (int) $stream->getSize(); + if ($length === 0) { + unset($headers[$normalizedKeys['content-length']]); + } else { + $headers[$normalizedKeys['content-length']] = [$length]; + } + } + } + } + } + + return [$stream, $headers]; + } + + /** + * Drains the source stream into the "sink" client option. + * + * @param string $contentLength Header specifying the amount of + * data to read. + * + * @throws \RuntimeException when the sink option is invalid. + */ + private function drain(StreamInterface $source, StreamInterface $sink, string $contentLength): StreamInterface + { + // If a content-length header is provided, then stop reading once + // that number of bytes has been read. This can prevent infinitely + // reading from a stream when dealing with servers that do not honor + // Connection: Close headers. + Psr7\Utils::copyToStream( + $source, + $sink, + (\strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 + ); + + $sink->seek(0); + $source->close(); + + return $sink; + } + + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = []; + \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line, + ]; + + return true; + }); + + try { + $resource = $callback(); + } finally { + \restore_error_handler(); + } + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value".\PHP_EOL; + } + } + throw new \RuntimeException(\trim($message)); + } + + return $resource; + } + + /** + * @return resource + */ + private function createStream(RequestInterface $request, array $options) + { + static $methods; + if (!$methods) { + $methods = \array_flip(\get_class_methods(__CLASS__)); + } + + if (!\in_array($request->getUri()->getScheme(), ['http', 'https'])) { + throw new RequestException(\sprintf("The scheme '%s' is not supported.", $request->getUri()->getScheme()), $request); + } + + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ($request->getProtocolVersion() === '1.1' + && !$request->hasHeader('Connection') + ) { + $request = $request->withHeader('Connection', 'close'); + } + + // Ensure SSL is verified by default + if (!isset($options['verify'])) { + $options['verify'] = true; + } + + $params = []; + $context = $this->getDefaultContext($request); + + if (isset($options['on_headers']) && !\is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + + if (!empty($options)) { + foreach ($options as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $context, $value, $params); + } + } + } + + if (isset($options['stream_context'])) { + if (!\is_array($options['stream_context'])) { + throw new \InvalidArgumentException('stream_context must be an array'); + } + $context = \array_replace_recursive($context, $options['stream_context']); + } + + // Microsoft NTLM authentication only supported with curl handler + if (isset($options['auth'][2]) && 'ntlm' === $options['auth'][2]) { + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + + $uri = $this->resolveHost($request, $options); + + $contextResource = $this->createResource( + static function () use ($context, $params) { + return \stream_context_create($context, $params); + } + ); + + return $this->createResource( + function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { + $resource = @\fopen((string) $uri, 'r', false, $contextResource); + $this->lastHeaders = $http_response_header ?? []; + + if (false === $resource) { + throw new ConnectException(sprintf('Connection refused for URI %s', $uri), $request, null, $context); + } + + if (isset($options['read_timeout'])) { + $readTimeout = $options['read_timeout']; + $sec = (int) $readTimeout; + $usec = ($readTimeout - $sec) * 100000; + \stream_set_timeout($resource, $sec, $usec); + } + + return $resource; + } + ); + } + + private function resolveHost(RequestInterface $request, array $options): UriInterface + { + $uri = $request->getUri(); + + if (isset($options['force_ip_resolve']) && !\filter_var($uri->getHost(), \FILTER_VALIDATE_IP)) { + if ('v4' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_A); + if (false === $records || !isset($records[0]['ip'])) { + throw new ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + } + + return $uri->withHost($records[0]['ip']); + } + if ('v6' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_AAAA); + if (false === $records || !isset($records[0]['ipv6'])) { + throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + } + + return $uri->withHost('['.$records[0]['ipv6'].']'); + } + } + + return $uri; + } + + private function getDefaultContext(RequestInterface $request): array + { + $headers = ''; + foreach ($request->getHeaders() as $name => $value) { + foreach ($value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request->getMethod(), + 'header' => $headers, + 'protocol_version' => $request->getProtocolVersion(), + 'ignore_errors' => true, + 'follow_location' => 0, + ], + 'ssl' => [ + 'peer_name' => $request->getUri()->getHost(), + ], + ]; + + $body = (string) $request->getBody(); + + if ('' !== $body) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!$request->hasHeader('Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = \rtrim($context['http']['header']); + + return $context; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_proxy(RequestInterface $request, array &$options, $value, array &$params): void + { + $uri = null; + + if (!\is_array($value)) { + $uri = $value; + } else { + $scheme = $request->getUri()->getScheme(); + if (isset($value[$scheme])) { + if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) { + $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, + ]; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_timeout(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value > 0) { + $options['http']['timeout'] = $value; + } + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_crypto_method(RequestInterface $request, array &$options, $value, array &$params): void + { + if ( + $value === \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT + || $value === \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT + || $value === \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT + || (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && $value === \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT) + ) { + $options['http']['crypto_method'] = $value; + + return; + } + + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_verify(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['verify_peer_name'] = false; + + return; + } + + if (\is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!\file_exists($value)) { + throw new \RuntimeException("SSL CA bundle not found: $value"); + } + } elseif ($value !== true) { + throw new \InvalidArgumentException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['verify_peer_name'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_cert(RequestInterface $request, array &$options, $value, array &$params): void + { + if (\is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + + if (!\file_exists($value)) { + throw new \RuntimeException("SSL certificate not found: {$value}"); + } + + $options['ssl']['local_cert'] = $value; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_progress(RequestInterface $request, array &$options, $value, array &$params): void + { + self::addNotification( + $params, + static function ($code, $a, $b, $c, $transferred, $total) use ($value) { + if ($code == \STREAM_NOTIFY_PROGRESS) { + // The upload progress cannot be determined. Use 0 for cURL compatibility: + // https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html + $value($total, $transferred, 0, 0); + } + } + ); + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_debug(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value === false) { + return; + } + + static $map = [ + \STREAM_NOTIFY_CONNECT => 'CONNECT', + \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', + \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', + \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', + \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', + \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', + \STREAM_NOTIFY_PROGRESS => 'PROGRESS', + \STREAM_NOTIFY_FAILURE => 'FAILURE', + \STREAM_NOTIFY_COMPLETED => 'COMPLETED', + \STREAM_NOTIFY_RESOLVE => 'RESOLVE', + ]; + static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max']; + + $value = Utils::debugResource($value); + $ident = $request->getMethod().' '.$request->getUri()->withFragment(''); + self::addNotification( + $params, + static function (int $code, ...$passed) use ($ident, $value, $map, $args): void { + \fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (\array_filter($passed) as $i => $v) { + \fwrite($value, $args[$i].': "'.$v.'" '); + } + \fwrite($value, "\n"); + } + ); + } + + private static function addNotification(array &$params, callable $notify): void + { + // Wrap the existing function if needed. + if (!isset($params['notification'])) { + $params['notification'] = $notify; + } else { + $params['notification'] = self::callArray([ + $params['notification'], + $notify, + ]); + } + } + + private static function callArray(array $functions): callable + { + return static function (...$args) use ($functions) { + foreach ($functions as $fn) { + $fn(...$args); + } + }; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/HandlerStack.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/HandlerStack.php new file mode 100644 index 0000000000..03f9a18ffd --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/HandlerStack.php @@ -0,0 +1,275 @@ +push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::redirect(), 'allow_redirects'); + $stack->push(Middleware::cookies(), 'cookies'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); + + return $stack; + } + + /** + * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler. + */ + public function __construct(?callable $handler = null) + { + $this->handler = $handler; + } + + /** + * Invokes the handler stack as a composed handler + * + * @return ResponseInterface|PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $handler = $this->resolve(); + + return $handler($request, $options); + } + + /** + * Dumps a string representation of the stack. + * + * @return string + */ + public function __toString() + { + $depth = 0; + $stack = []; + + if ($this->handler !== null) { + $stack[] = '0) Handler: '.$this->debugCallable($this->handler); + } + + $result = ''; + foreach (\array_reverse($this->stack) as $tuple) { + ++$depth; + $str = "{$depth}) Name: '{$tuple[1]}', "; + $str .= 'Function: '.$this->debugCallable($tuple[0]); + $result = "> {$str}\n{$result}"; + $stack[] = $str; + } + + foreach (\array_keys($stack) as $k) { + $result .= "< {$stack[$k]}\n"; + } + + return $result; + } + + /** + * Set the HTTP handler that actually returns a promise. + * + * @param callable(RequestInterface, array): PromiseInterface $handler Accepts a request and array of options and + * returns a Promise. + */ + public function setHandler(callable $handler): void + { + $this->handler = $handler; + $this->cached = null; + } + + /** + * Returns true if the builder has a handler. + */ + public function hasHandler(): bool + { + return $this->handler !== null; + } + + /** + * Unshift a middleware to the bottom of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function unshift(callable $middleware, ?string $name = null): void + { + \array_unshift($this->stack, [$middleware, $name]); + $this->cached = null; + } + + /** + * Push a middleware to the top of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function push(callable $middleware, string $name = ''): void + { + $this->stack[] = [$middleware, $name]; + $this->cached = null; + } + + /** + * Add a middleware before another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function before(string $findName, callable $middleware, string $withName = ''): void + { + $this->splice($findName, $withName, $middleware, true); + } + + /** + * Add a middleware after another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function after(string $findName, callable $middleware, string $withName = ''): void + { + $this->splice($findName, $withName, $middleware, false); + } + + /** + * Remove a middleware by instance or name from the stack. + * + * @param callable|string $remove Middleware to remove by instance or name. + */ + public function remove($remove): void + { + if (!is_string($remove) && !is_callable($remove)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a callable or string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->cached = null; + $idx = \is_callable($remove) ? 0 : 1; + $this->stack = \array_values(\array_filter( + $this->stack, + static function ($tuple) use ($idx, $remove) { + return $tuple[$idx] !== $remove; + } + )); + } + + /** + * Compose the middleware and handler into a single callable function. + * + * @return callable(RequestInterface, array): PromiseInterface + */ + public function resolve(): callable + { + if ($this->cached === null) { + if (($prev = $this->handler) === null) { + throw new \LogicException('No handler has been specified'); + } + + foreach (\array_reverse($this->stack) as $fn) { + /** @var callable(RequestInterface, array): PromiseInterface $prev */ + $prev = $fn[0]($prev); + } + + $this->cached = $prev; + } + + return $this->cached; + } + + private function findByName(string $name): int + { + foreach ($this->stack as $k => $v) { + if ($v[1] === $name) { + return $k; + } + } + + throw new \InvalidArgumentException("Middleware not found: $name"); + } + + /** + * Splices a function into the middleware list at a specific position. + */ + private function splice(string $findName, string $withName, callable $middleware, bool $before): void + { + $this->cached = null; + $idx = $this->findByName($findName); + $tuple = [$middleware, $withName]; + + if ($before) { + if ($idx === 0) { + \array_unshift($this->stack, $tuple); + } else { + $replacement = [$tuple, $this->stack[$idx]]; + \array_splice($this->stack, $idx, 1, $replacement); + } + } elseif ($idx === \count($this->stack) - 1) { + $this->stack[] = $tuple; + } else { + $replacement = [$this->stack[$idx], $tuple]; + \array_splice($this->stack, $idx, 1, $replacement); + } + } + + /** + * Provides a debug string for a given callable. + * + * @param callable|string $fn Function to write as a string. + */ + private function debugCallable($fn): string + { + if (\is_string($fn)) { + return "callable({$fn})"; + } + + if (\is_array($fn)) { + return \is_string($fn[0]) + ? "callable({$fn[0]}::{$fn[1]})" + : "callable(['".\get_class($fn[0])."', '{$fn[1]}'])"; + } + + /** @var object $fn */ + return 'callable('.\spl_object_hash($fn).')'; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatter.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatter.php new file mode 100644 index 0000000000..9b77eee832 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatter.php @@ -0,0 +1,199 @@ +>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; + public const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; + + /** + * @var string Template used to format log messages + */ + private $template; + + /** + * @param string $template Log message template + */ + public function __construct(?string $template = self::CLF) + { + $this->template = $template ?: self::CLF; + } + + /** + * Returns a formatted message string. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface|null $response Response that was received + * @param \Throwable|null $error Exception that was received + */ + public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string + { + $cache = []; + + /** @var string */ + return \preg_replace_callback( + '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', + function (array $matches) use ($request, $response, $error, &$cache) { + if (isset($cache[$matches[1]])) { + return $cache[$matches[1]]; + } + + $result = ''; + switch ($matches[1]) { + case 'request': + $result = Psr7\Message::toString($request); + break; + case 'response': + $result = $response ? Psr7\Message::toString($response) : ''; + break; + case 'req_headers': + $result = \trim($request->getMethod() + .' '.$request->getRequestTarget()) + .' HTTP/'.$request->getProtocolVersion()."\r\n" + .$this->headers($request); + break; + case 'res_headers': + $result = $response ? + \sprintf( + 'HTTP/%s %d %s', + $response->getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + )."\r\n".$this->headers($response) + : 'NULL'; + break; + case 'req_body': + $result = $request->getBody()->__toString(); + break; + case 'res_body': + if (!$response instanceof ResponseInterface) { + $result = 'NULL'; + break; + } + + $body = $response->getBody(); + + if (!$body->isSeekable()) { + $result = 'RESPONSE_NOT_LOGGEABLE'; + break; + } + + $result = $response->getBody()->__toString(); + break; + case 'ts': + case 'date_iso_8601': + $result = \gmdate('c'); + break; + case 'date_common_log': + $result = \date('d/M/Y:H:i:s O'); + break; + case 'method': + $result = $request->getMethod(); + break; + case 'version': + $result = $request->getProtocolVersion(); + break; + case 'uri': + case 'url': + $result = $request->getUri()->__toString(); + break; + case 'target': + $result = $request->getRequestTarget(); + break; + case 'req_version': + $result = $request->getProtocolVersion(); + break; + case 'res_version': + $result = $response + ? $response->getProtocolVersion() + : 'NULL'; + break; + case 'host': + $result = $request->getHeaderLine('Host'); + break; + case 'hostname': + $result = \gethostname(); + break; + case 'code': + $result = $response ? $response->getStatusCode() : 'NULL'; + break; + case 'phrase': + $result = $response ? $response->getReasonPhrase() : 'NULL'; + break; + case 'error': + $result = $error ? $error->getMessage() : 'NULL'; + break; + default: + // handle prefixed dynamic headers + if (\strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(\substr($matches[1], 11)); + } elseif (\strpos($matches[1], 'res_header_') === 0) { + $result = $response + ? $response->getHeaderLine(\substr($matches[1], 11)) + : 'NULL'; + } + } + + $cache[$matches[1]] = $result; + + return $result; + }, + $this->template + ); + } + + /** + * Get headers from message as string + */ + private function headers(MessageInterface $message): string + { + $result = ''; + foreach ($message->getHeaders() as $name => $values) { + $result .= $name.': '.\implode(', ', $values)."\r\n"; + } + + return \trim($result); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatterInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatterInterface.php new file mode 100644 index 0000000000..a39ac248ee --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/MessageFormatterInterface.php @@ -0,0 +1,18 @@ +withCookieHeader($request); + + return $handler($request, $options) + ->then( + static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface { + $cookieJar->extractCookies($request, $response); + + return $response; + } + ); + }; + }; + } + + /** + * Middleware that throws exceptions for 4xx or 5xx responses when the + * "http_errors" request option is set to true. + * + * @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages. + * + * @return callable(callable): callable Returns a function that accepts the next handler. + */ + public static function httpErrors(?BodySummarizerInterface $bodySummarizer = null): callable + { + return static function (callable $handler) use ($bodySummarizer): callable { + return static function ($request, array $options) use ($handler, $bodySummarizer) { + if (empty($options['http_errors'])) { + return $handler($request, $options); + } + + return $handler($request, $options)->then( + static function (ResponseInterface $response) use ($request, $bodySummarizer) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + throw RequestException::create($request, $response, null, [], $bodySummarizer); + } + ); + }; + }; + } + + /** + * Middleware that pushes history data to an ArrayAccess container. + * + * @param array|\ArrayAccess $container Container to hold the history (by reference). + * + * @return callable(callable): callable Returns a function that accepts the next handler. + * + * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + */ + public static function history(&$container): callable + { + if (!\is_array($container) && !$container instanceof \ArrayAccess) { + throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + } + + return static function (callable $handler) use (&$container): callable { + return static function (RequestInterface $request, array $options) use ($handler, &$container) { + return $handler($request, $options)->then( + static function ($value) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => $value, + 'error' => null, + 'options' => $options, + ]; + + return $value; + }, + static function ($reason) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => null, + 'error' => $reason, + 'options' => $options, + ]; + + return P\Create::rejectionFor($reason); + } + ); + }; + }; + } + + /** + * Middleware that invokes a callback before and after sending a request. + * + * The provided listener cannot modify or alter the response. It simply + * "taps" into the chain to be notified before returning the promise. The + * before listener accepts a request and options array, and the after + * listener accepts a request, options array, and response promise. + * + * @param callable $before Function to invoke before forwarding the request. + * @param callable $after Function invoked after forwarding. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function tap(?callable $before = null, ?callable $after = null): callable + { + return static function (callable $handler) use ($before, $after): callable { + return static function (RequestInterface $request, array $options) use ($handler, $before, $after) { + if ($before) { + $before($request, $options); + } + $response = $handler($request, $options); + if ($after) { + $after($request, $options, $response); + } + + return $response; + }; + }; + } + + /** + * Middleware that handles request redirects. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function redirect(): callable + { + return static function (callable $handler): RedirectMiddleware { + return new RedirectMiddleware($handler); + }; + } + + /** + * Middleware that retries requests based on the boolean result of + * invoking the provided "decider" function. + * + * If no delay function is provided, a simple implementation of exponential + * backoff will be utilized. + * + * @param callable $decider Function that accepts the number of retries, + * a request, [response], and [exception] and + * returns true if the request is to be retried. + * @param callable $delay Function that accepts the number of retries and + * returns the number of milliseconds to delay. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function retry(callable $decider, ?callable $delay = null): callable + { + return static function (callable $handler) use ($decider, $delay): RetryMiddleware { + return new RetryMiddleware($decider, $handler, $delay); + }; + } + + /** + * Middleware that logs requests, responses, and errors using a message + * formatter. + * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * + * @param LoggerInterface $logger Logs messages. + * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. + * @param string $logLevel Level at which to log requests. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable + { + // To be compatible with Guzzle 7.1.x we need to allow users to pass a MessageFormatter + if (!$formatter instanceof MessageFormatter && !$formatter instanceof MessageFormatterInterface) { + throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class)); + } + + return static function (callable $handler) use ($logger, $formatter, $logLevel): callable { + return static function (RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) { + return $handler($request, $options)->then( + static function ($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface { + $message = $formatter->format($request, $response); + $logger->log($logLevel, $message); + + return $response; + }, + static function ($reason) use ($logger, $request, $formatter): PromiseInterface { + $response = $reason instanceof RequestException ? $reason->getResponse() : null; + $message = $formatter->format($request, $response, P\Create::exceptionFor($reason)); + $logger->error($message); + + return P\Create::rejectionFor($reason); + } + ); + }; + }; + } + + /** + * This middleware adds a default content-type if possible, a default + * content-length or transfer-encoding header, and the expect header. + */ + public static function prepareBody(): callable + { + return static function (callable $handler): PrepareBodyMiddleware { + return new PrepareBodyMiddleware($handler); + }; + } + + /** + * Middleware that applies a map function to the request before passing to + * the next handler. + * + * @param callable $fn Function that accepts a RequestInterface and returns + * a RequestInterface. + */ + public static function mapRequest(callable $fn): callable + { + return static function (callable $handler) use ($fn): callable { + return static function (RequestInterface $request, array $options) use ($handler, $fn) { + return $handler($fn($request), $options); + }; + }; + } + + /** + * Middleware that applies a map function to the resolved promise's + * response. + * + * @param callable $fn Function that accepts a ResponseInterface and + * returns a ResponseInterface. + */ + public static function mapResponse(callable $fn): callable + { + return static function (callable $handler) use ($fn): callable { + return static function (RequestInterface $request, array $options) use ($handler, $fn) { + return $handler($request, $options)->then($fn); + }; + }; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Pool.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Pool.php new file mode 100644 index 0000000000..6277c61fbc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Pool.php @@ -0,0 +1,125 @@ + $rfn) { + if ($rfn instanceof RequestInterface) { + yield $key => $client->sendAsync($rfn, $opts); + } elseif (\is_callable($rfn)) { + yield $key => $rfn($opts); + } else { + throw new \InvalidArgumentException('Each value yielded by the iterator must be a Psr7\Http\Message\RequestInterface or a callable that returns a promise that fulfills with a Psr7\Message\Http\ResponseInterface object.'); + } + } + }; + + $this->each = new EachPromise($requests(), $config); + } + + /** + * Get promise + */ + public function promise(): PromiseInterface + { + return $this->each->promise(); + } + + /** + * Sends multiple requests concurrently and returns an array of responses + * and exceptions that uses the same ordering as the provided requests. + * + * IMPORTANT: This method keeps every request and response in memory, and + * as such, is NOT recommended when sending a large number or an + * indeterminate number of requests concurrently. + * + * @param ClientInterface $client Client used to send the requests + * @param array|\Iterator $requests Requests to send concurrently. + * @param array $options Passes through the options available in + * {@see \GuzzleHttp\Pool::__construct} + * + * @return array Returns an array containing the response or an exception + * in the same order that the requests were sent. + * + * @throws \InvalidArgumentException if the event format is incorrect. + */ + public static function batch(ClientInterface $client, $requests, array $options = []): array + { + $res = []; + self::cmpCallback($options, 'fulfilled', $res); + self::cmpCallback($options, 'rejected', $res); + $pool = new static($client, $requests, $options); + $pool->promise()->wait(); + \ksort($res); + + return $res; + } + + /** + * Execute callback(s) + */ + private static function cmpCallback(array &$options, string $name, array &$results): void + { + if (!isset($options[$name])) { + $options[$name] = static function ($v, $k) use (&$results) { + $results[$k] = $v; + }; + } else { + $currentFn = $options[$name]; + $options[$name] = static function ($v, $k) use (&$results, $currentFn) { + $currentFn($v, $k); + $results[$k] = $v; + }; + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php new file mode 100644 index 0000000000..7dde6c5f46 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -0,0 +1,105 @@ +nextHandler = $nextHandler; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $fn = $this->nextHandler; + + // Don't do anything if the request has no body. + if ($request->getBody()->getSize() === 0) { + return $fn($request, $options); + } + + $modify = []; + + // Add a default content-type if possible. + if (!$request->hasHeader('Content-Type')) { + if ($uri = $request->getBody()->getMetadata('uri')) { + if (is_string($uri) && $type = Psr7\MimeType::fromFilename($uri)) { + $modify['set_headers']['Content-Type'] = $type; + } + } + } + + // Add a default content-length or transfer-encoding header. + if (!$request->hasHeader('Content-Length') + && !$request->hasHeader('Transfer-Encoding') + ) { + $size = $request->getBody()->getSize(); + if ($size !== null) { + $modify['set_headers']['Content-Length'] = $size; + } else { + $modify['set_headers']['Transfer-Encoding'] = 'chunked'; + } + } + + // Add the expect header if needed. + $this->addExpectHeader($request, $options, $modify); + + return $fn(Psr7\Utils::modifyRequest($request, $modify), $options); + } + + /** + * Add expect header + */ + private function addExpectHeader(RequestInterface $request, array $options, array &$modify): void + { + // Determine if the Expect header should be used + if ($request->hasHeader('Expect')) { + return; + } + + $expect = $options['expect'] ?? null; + + // Return if disabled or using HTTP/1.0 + if ($expect === false || $request->getProtocolVersion() === '1.0') { + return; + } + + // The expect header is unconditionally enabled + if ($expect === true) { + $modify['set_headers']['Expect'] = '100-Continue'; + + return; + } + + // By default, send the expect header when the payload is > 1mb + if ($expect === null) { + $expect = 1048576; + } + + // Always add if the body cannot be rewound, the size cannot be + // determined, or the size is greater than the cutoff threshold + $body = $request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { + $modify['set_headers']['Expect'] = '100-Continue'; + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RedirectMiddleware.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RedirectMiddleware.php new file mode 100644 index 0000000000..7aa21a6232 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -0,0 +1,228 @@ + 5, + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => false, + 'track_redirects' => false, + ]; + + /** + * @var callable(RequestInterface, array): PromiseInterface + */ + private $nextHandler; + + /** + * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke. + */ + public function __construct(callable $nextHandler) + { + $this->nextHandler = $nextHandler; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $fn = $this->nextHandler; + + if (empty($options['allow_redirects'])) { + return $fn($request, $options); + } + + if ($options['allow_redirects'] === true) { + $options['allow_redirects'] = self::$defaultSettings; + } elseif (!\is_array($options['allow_redirects'])) { + throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); + } else { + // Merge the default settings with the provided settings + $options['allow_redirects'] += self::$defaultSettings; + } + + if (empty($options['allow_redirects']['max'])) { + return $fn($request, $options); + } + + return $fn($request, $options) + ->then(function (ResponseInterface $response) use ($request, $options) { + return $this->checkRedirect($request, $options, $response); + }); + } + + /** + * @return ResponseInterface|PromiseInterface + */ + public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) + { + if (\strpos((string) $response->getStatusCode(), '3') !== 0 + || !$response->hasHeader('Location') + ) { + return $response; + } + + $this->guardMax($request, $response, $options); + $nextRequest = $this->modifyRequest($request, $options, $response); + + // If authorization is handled by curl, unset it if URI is cross-origin. + if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $nextRequest->getUri()) && defined('\CURLOPT_HTTPAUTH')) { + unset( + $options['curl'][\CURLOPT_HTTPAUTH], + $options['curl'][\CURLOPT_USERPWD] + ); + } + + if (isset($options['allow_redirects']['on_redirect'])) { + ($options['allow_redirects']['on_redirect'])( + $request, + $response, + $nextRequest->getUri() + ); + } + + $promise = $this($nextRequest, $options); + + // Add headers to be able to track history of redirects. + if (!empty($options['allow_redirects']['track_redirects'])) { + return $this->withTracking( + $promise, + (string) $nextRequest->getUri(), + $response->getStatusCode() + ); + } + + return $promise; + } + + /** + * Enable tracking on promise. + */ + private function withTracking(PromiseInterface $promise, string $uri, int $statusCode): PromiseInterface + { + return $promise->then( + static function (ResponseInterface $response) use ($uri, $statusCode) { + // Note that we are pushing to the front of the list as this + // would be an earlier response than what is currently present + // in the history header. + $historyHeader = $response->getHeader(self::HISTORY_HEADER); + $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); + \array_unshift($historyHeader, $uri); + \array_unshift($statusHeader, (string) $statusCode); + + return $response->withHeader(self::HISTORY_HEADER, $historyHeader) + ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); + } + ); + } + + /** + * Check for too many redirects. + * + * @throws TooManyRedirectsException Too many redirects. + */ + private function guardMax(RequestInterface $request, ResponseInterface $response, array &$options): void + { + $current = $options['__redirect_count'] + ?? 0; + $options['__redirect_count'] = $current + 1; + $max = $options['allow_redirects']['max']; + + if ($options['__redirect_count'] > $max) { + throw new TooManyRedirectsException("Will not follow more than {$max} redirects", $request, $response); + } + } + + public function modifyRequest(RequestInterface $request, array $options, ResponseInterface $response): RequestInterface + { + // Request modifications to apply. + $modify = []; + $protocols = $options['allow_redirects']['protocols']; + + // Use a GET request if this is an entity enclosing request and we are + // not forcing RFC compliance, but rather emulating what all browsers + // would do. + $statusCode = $response->getStatusCode(); + if ($statusCode == 303 + || ($statusCode <= 302 && !$options['allow_redirects']['strict']) + ) { + $safeMethods = ['GET', 'HEAD', 'OPTIONS']; + $requestMethod = $request->getMethod(); + + $modify['method'] = in_array($requestMethod, $safeMethods) ? $requestMethod : 'GET'; + $modify['body'] = ''; + } + + $uri = self::redirectUri($request, $response, $protocols); + if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) { + $idnOptions = ($options['idn_conversion'] === true) ? \IDNA_DEFAULT : $options['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + + $modify['uri'] = $uri; + Psr7\Message::rewindBody($request); + + // Add the Referer header if it is told to do so and only + // add the header if we are not redirecting from https to http. + if ($options['allow_redirects']['referer'] + && $modify['uri']->getScheme() === $request->getUri()->getScheme() + ) { + $uri = $request->getUri()->withUserInfo(''); + $modify['set_headers']['Referer'] = (string) $uri; + } else { + $modify['remove_headers'][] = 'Referer'; + } + + // Remove Authorization and Cookie headers if URI is cross-origin. + if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $modify['uri'])) { + $modify['remove_headers'][] = 'Authorization'; + $modify['remove_headers'][] = 'Cookie'; + } + + return Psr7\Utils::modifyRequest($request, $modify); + } + + /** + * Set the appropriate URL on the request based on the location header. + */ + private static function redirectUri( + RequestInterface $request, + ResponseInterface $response, + array $protocols + ): UriInterface { + $location = Psr7\UriResolver::resolve( + $request->getUri(), + new Psr7\Uri($response->getHeaderLine('Location')) + ); + + // Ensure that the redirect URI is allowed based on the protocols. + if (!\in_array($location->getScheme(), $protocols)) { + throw new BadResponseException(\sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, \implode(', ', $protocols)), $request, $response); + } + + return $location; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RequestOptions.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RequestOptions.php new file mode 100644 index 0000000000..84a3500e44 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/RequestOptions.php @@ -0,0 +1,274 @@ +decider = $decider; + $this->nextHandler = $nextHandler; + $this->delay = $delay ?: __CLASS__.'::exponentialDelay'; + } + + /** + * Default exponential backoff delay function. + * + * @return int milliseconds. + */ + public static function exponentialDelay(int $retries): int + { + return (int) 2 ** ($retries - 1) * 1000; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (!isset($options['retries'])) { + $options['retries'] = 0; + } + + $fn = $this->nextHandler; + + return $fn($request, $options) + ->then( + $this->onFulfilled($request, $options), + $this->onRejected($request, $options) + ); + } + + /** + * Execute fulfilled closure + */ + private function onFulfilled(RequestInterface $request, array $options): callable + { + return function ($value) use ($request, $options) { + if (!($this->decider)( + $options['retries'], + $request, + $value, + null + )) { + return $value; + } + + return $this->doRetry($request, $options, $value); + }; + } + + /** + * Execute rejected closure + */ + private function onRejected(RequestInterface $req, array $options): callable + { + return function ($reason) use ($req, $options) { + if (!($this->decider)( + $options['retries'], + $req, + null, + $reason + )) { + return P\Create::rejectionFor($reason); + } + + return $this->doRetry($req, $options); + }; + } + + private function doRetry(RequestInterface $request, array $options, ?ResponseInterface $response = null): PromiseInterface + { + $options['delay'] = ($this->delay)(++$options['retries'], $response, $request); + + return $this($request, $options); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/TransferStats.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/TransferStats.php new file mode 100644 index 0000000000..93fa334c8d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/TransferStats.php @@ -0,0 +1,133 @@ +request = $request; + $this->response = $response; + $this->transferTime = $transferTime; + $this->handlerErrorData = $handlerErrorData; + $this->handlerStats = $handlerStats; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Returns the response that was received (if any). + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * Returns true if a response was received. + */ + public function hasResponse(): bool + { + return $this->response !== null; + } + + /** + * Gets handler specific error data. + * + * This might be an exception, a integer representing an error code, or + * anything else. Relying on this value assumes that you know what handler + * you are using. + * + * @return mixed + */ + public function getHandlerErrorData() + { + return $this->handlerErrorData; + } + + /** + * Get the effective URI the request was sent to. + */ + public function getEffectiveUri(): UriInterface + { + return $this->request->getUri(); + } + + /** + * Get the estimated time the request was being transferred by the handler. + * + * @return float|null Time in seconds. + */ + public function getTransferTime(): ?float + { + return $this->transferTime; + } + + /** + * Gets an array of all of the handler specific transfer data. + */ + public function getHandlerStats(): array + { + return $this->handlerStats; + } + + /** + * Get a specific handler statistic from the handler by name. + * + * @param string $stat Handler specific transfer stat to retrieve. + * + * @return mixed|null + */ + public function getHandlerStat(string $stat) + { + return $this->handlerStats[$stat] ?? null; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Utils.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Utils.php new file mode 100644 index 0000000000..df529270e1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/Utils.php @@ -0,0 +1,384 @@ += 0) { + if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) { + $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler()); + } elseif (\function_exists('curl_exec')) { + $handler = new CurlHandler(); + } elseif (\function_exists('curl_multi_exec')) { + $handler = new CurlMultiHandler(); + } + } + + if (\ini_get('allow_url_fopen')) { + $handler = $handler + ? Proxy::wrapStreaming($handler, new StreamHandler()) + : new StreamHandler(); + } elseif (!$handler) { + throw new \RuntimeException('GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler.'); + } + + return $handler; + } + + /** + * Get the default User-Agent string to use with Guzzle. + */ + public static function defaultUserAgent(): string + { + return sprintf('GuzzleHttp/%d', ClientInterface::MAJOR_VERSION); + } + + /** + * Returns the default cacert bundle for the current system. + * + * First, the openssl.cafile and curl.cainfo php.ini settings are checked. + * If those settings are not configured, then the common locations for + * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X + * and Windows are checked. If any of these file locations are found on + * disk, they will be utilized. + * + * Note: the result of this function is cached for subsequent calls. + * + * @throws \RuntimeException if no bundle can be found. + * + * @deprecated Utils::defaultCaBundle will be removed in guzzlehttp/guzzle:8.0. This method is not needed in PHP 5.6+. + */ + public static function defaultCaBundle(): string + { + static $cached = null; + static $cafiles = [ + // Red Hat, CentOS, Fedora (provided by the ca-certificates package) + '/etc/pki/tls/certs/ca-bundle.crt', + // Ubuntu, Debian (provided by the ca-certificates package) + '/etc/ssl/certs/ca-certificates.crt', + // FreeBSD (provided by the ca_root_nss package) + '/usr/local/share/certs/ca-root-nss.crt', + // SLES 12 (provided by the ca-certificates package) + '/var/lib/ca-certificates/ca-bundle.pem', + // OS X provided by homebrew (using the default path) + '/usr/local/etc/openssl/cert.pem', + // Google app engine + '/etc/ca-certificates.crt', + // Windows? + 'C:\\windows\\system32\\curl-ca-bundle.crt', + 'C:\\windows\\curl-ca-bundle.crt', + ]; + + if ($cached) { + return $cached; + } + + if ($ca = \ini_get('openssl.cafile')) { + return $cached = $ca; + } + + if ($ca = \ini_get('curl.cainfo')) { + return $cached = $ca; + } + + foreach ($cafiles as $filename) { + if (\file_exists($filename)) { + return $cached = $filename; + } + } + + throw new \RuntimeException( + <<< EOT +No system CA bundle could be found in any of the the common system locations. +PHP versions earlier than 5.6 are not properly configured to use the system's +CA bundle by default. In order to verify peer certificates, you will need to +supply the path on disk to a certificate bundle to the 'verify' request +option: https://docs.guzzlephp.org/en/latest/request-options.html#verify. If +you do not need a specific certificate bundle, then Mozilla provides a commonly +used CA bundle which can be downloaded here (provided by the maintainer of +cURL): https://curl.haxx.se/ca/cacert.pem. Once you have a CA bundle available +on disk, you can set the 'openssl.cafile' PHP ini setting to point to the path +to the file, allowing you to omit the 'verify' request option. See +https://curl.haxx.se/docs/sslcerts.html for more information. +EOT + ); + } + + /** + * Creates an associative array of lowercase header names to the actual + * header casing. + */ + public static function normalizeHeaderKeys(array $headers): array + { + $result = []; + foreach (\array_keys($headers) as $key) { + $result[\strtolower($key)] = $key; + } + + return $result; + } + + /** + * Returns true if the provided host matches any of the no proxy areas. + * + * This method will strip a port from the host if it is present. Each pattern + * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a + * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == + * "baz.foo.com", but ".foo.com" != "foo.com"). + * + * Areas are matched in the following cases: + * 1. "*" (without quotes) always matches any hosts. + * 2. An exact match. + * 3. The area starts with "." and the area is the last part of the host. e.g. + * '.mit.edu' will match any host that ends with '.mit.edu'. + * + * @param string $host Host to check against the patterns. + * @param string[] $noProxyArray An array of host patterns. + * + * @throws InvalidArgumentException + */ + public static function isHostInNoProxy(string $host, array $noProxyArray): bool + { + if (\strlen($host) === 0) { + throw new InvalidArgumentException('Empty host provided'); + } + + // Strip port if present. + [$host] = \explode(':', $host, 2); + + foreach ($noProxyArray as $area) { + // Always match on wildcards. + if ($area === '*') { + return true; + } + + if (empty($area)) { + // Don't match on empty values. + continue; + } + + if ($area === $host) { + // Exact matches. + return true; + } + // Special match if the area when prefixed with ".". Remove any + // existing leading "." and add a new leading ".". + $area = '.'.\ltrim($area, '.'); + if (\substr($host, -\strlen($area)) === $area) { + return true; + } + } + + return false; + } + + /** + * Wrapper for json_decode that throws when an error occurs. + * + * @param string $json JSON data to parse + * @param bool $assoc When true, returned objects will be converted + * into associative arrays. + * @param int $depth User specified recursion depth. + * @param int $options Bitmask of JSON decode options. + * + * @return object|array|string|int|float|bool|null + * + * @throws InvalidArgumentException if the JSON cannot be decoded. + * + * @see https://www.php.net/manual/en/function.json-decode.php + */ + public static function jsonDecode(string $json, bool $assoc = false, int $depth = 512, int $options = 0) + { + $data = \json_decode($json, $assoc, $depth, $options); + if (\JSON_ERROR_NONE !== \json_last_error()) { + throw new InvalidArgumentException('json_decode error: '.\json_last_error_msg()); + } + + return $data; + } + + /** + * Wrapper for JSON encoding that throws when an error occurs. + * + * @param mixed $value The value being encoded + * @param int $options JSON encode option bitmask + * @param int $depth Set the maximum depth. Must be greater than zero. + * + * @throws InvalidArgumentException if the JSON cannot be encoded. + * + * @see https://www.php.net/manual/en/function.json-encode.php + */ + public static function jsonEncode($value, int $options = 0, int $depth = 512): string + { + $json = \json_encode($value, $options, $depth); + if (\JSON_ERROR_NONE !== \json_last_error()) { + throw new InvalidArgumentException('json_encode error: '.\json_last_error_msg()); + } + + /** @var string */ + return $json; + } + + /** + * Wrapper for the hrtime() or microtime() functions + * (depending on the PHP version, one of the two is used) + * + * @return float UNIX timestamp + * + * @internal + */ + public static function currentTime(): float + { + return (float) \function_exists('hrtime') ? \hrtime(true) / 1e9 : \microtime(true); + } + + /** + * @throws InvalidArgumentException + * + * @internal + */ + public static function idnUriConvert(UriInterface $uri, int $options = 0): UriInterface + { + if ($uri->getHost()) { + $asciiHost = self::idnToAsci($uri->getHost(), $options, $info); + if ($asciiHost === false) { + $errorBitSet = $info['errors'] ?? 0; + + $errorConstants = array_filter(array_keys(get_defined_constants()), static function (string $name): bool { + return substr($name, 0, 11) === 'IDNA_ERROR_'; + }); + + $errors = []; + foreach ($errorConstants as $errorConstant) { + if ($errorBitSet & constant($errorConstant)) { + $errors[] = $errorConstant; + } + } + + $errorMessage = 'IDN conversion failed'; + if ($errors) { + $errorMessage .= ' (errors: '.implode(', ', $errors).')'; + } + + throw new InvalidArgumentException($errorMessage); + } + if ($uri->getHost() !== $asciiHost) { + // Replace URI only if the ASCII version is different + $uri = $uri->withHost($asciiHost); + } + } + + return $uri; + } + + /** + * @internal + */ + public static function getenv(string $name): ?string + { + if (isset($_SERVER[$name])) { + return (string) $_SERVER[$name]; + } + + if (\PHP_SAPI === 'cli' && ($value = \getenv($name)) !== false && $value !== null) { + return (string) $value; + } + + return null; + } + + /** + * @return string|false + */ + private static function idnToAsci(string $domain, int $options, ?array &$info = []) + { + if (\function_exists('idn_to_ascii') && \defined('INTL_IDNA_VARIANT_UTS46')) { + return \idn_to_ascii($domain, $options, \INTL_IDNA_VARIANT_UTS46, $info); + } + + throw new \Error('ext-idn or symfony/polyfill-intl-idn not loaded or too old'); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/functions.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/functions.php new file mode 100644 index 0000000000..5edc66ab1c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/src/functions.php @@ -0,0 +1,167 @@ + 0])]); + $response = $client->get(Server::$url); + self::assertSame(200, $response->getStatusCode()); + } + + public function testValidatesArgsForMagicMethods() + { + $client = new Client(); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Magic request methods require a URI and optional options array'); + $client->options(); + } + + public function testCanSendAsyncGetRequests() + { + $client = new Client(); + Server::flush(); + Server::enqueue([new Response(200, ['Content-Length' => 2], 'hi')]); + $p = $client->getAsync(Server::$url, ['query' => ['test' => 'foo']]); + self::assertInstanceOf(PromiseInterface::class, $p); + self::assertSame(200, $p->wait()->getStatusCode()); + $received = Server::received(true); + self::assertCount(1, $received); + self::assertSame('test=foo', $received[0]->getUri()->getQuery()); + } + + public function testCanSendSynchronously() + { + $client = new Client(['handler' => new MockHandler([new Response()])]); + $request = new Request('GET', 'http://example.com'); + $r = $client->send($request); + self::assertInstanceOf(ResponseInterface::class, $r); + self::assertSame(200, $r->getStatusCode()); + } + + public function testClientHasOptions() + { + $client = new Client([ + 'base_uri' => 'http://foo.com', + 'timeout' => 2, + 'headers' => ['bar' => 'baz'], + 'handler' => new MockHandler(), + ]); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertArrayHasKey('base_uri', $config); + self::assertInstanceOf(Uri::class, $config['base_uri']); + self::assertSame('http://foo.com', (string) $config['base_uri']); + self::assertArrayHasKey('handler', $config); + self::assertNotNull($config['handler']); + self::assertArrayHasKey('timeout', $config); + self::assertSame(2, $config['timeout']); + } + + public function testCanMergeOnBaseUri() + { + $mock = new MockHandler([new Response()]); + $client = new Client([ + 'base_uri' => 'http://foo.com/bar/', + 'handler' => $mock, + ]); + $client->get('baz'); + self::assertSame( + 'http://foo.com/bar/baz', + (string) $mock->getLastRequest()->getUri() + ); + } + + public function testCanMergeOnBaseUriWithRequest() + { + $mock = new MockHandler([new Response(), new Response()]); + $client = new Client([ + 'handler' => $mock, + 'base_uri' => 'http://foo.com/bar/', + ]); + $client->request('GET', new Uri('baz')); + self::assertSame( + 'http://foo.com/bar/baz', + (string) $mock->getLastRequest()->getUri() + ); + + $client->request('GET', new Uri('baz'), ['base_uri' => 'http://example.com/foo/']); + self::assertSame( + 'http://example.com/foo/baz', + (string) $mock->getLastRequest()->getUri(), + 'Can overwrite the base_uri through the request options' + ); + } + + public function testCanUseRelativeUriWithSend() + { + $mock = new MockHandler([new Response()]); + $client = new Client([ + 'handler' => $mock, + 'base_uri' => 'http://bar.com', + ]); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertSame('http://bar.com', (string) $config['base_uri']); + $request = new Request('GET', '/baz'); + $client->send($request); + self::assertSame( + 'http://bar.com/baz', + (string) $mock->getLastRequest()->getUri() + ); + } + + public function testMergesDefaultOptionsAndDoesNotOverwriteUa() + { + $client = new Client(['headers' => ['User-agent' => 'foo']]); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertSame(['User-agent' => 'foo'], $config['headers']); + self::assertIsArray($config['allow_redirects']); + self::assertTrue($config['http_errors']); + self::assertTrue($config['decode_content']); + self::assertTrue($config['verify']); + } + + public function testDoesNotOverwriteHeaderWithDefault() + { + $mock = new MockHandler([new Response()]); + $c = new Client([ + 'headers' => ['User-agent' => 'foo'], + 'handler' => $mock, + ]); + $c->get('http://example.com', ['headers' => ['User-Agent' => 'bar']]); + self::assertSame('bar', $mock->getLastRequest()->getHeaderLine('User-Agent')); + } + + public function testDoesNotOverwriteHeaderWithDefaultInRequest() + { + $mock = new MockHandler([new Response()]); + $c = new Client([ + 'headers' => ['User-agent' => 'foo'], + 'handler' => $mock, + ]); + $request = new Request('GET', Server::$url, ['User-Agent' => 'bar']); + $c->send($request); + self::assertSame('bar', $mock->getLastRequest()->getHeaderLine('User-Agent')); + } + + public function testDoesOverwriteHeaderWithSetRequestOption() + { + $mock = new MockHandler([new Response()]); + $c = new Client([ + 'headers' => ['User-agent' => 'foo'], + 'handler' => $mock, + ]); + $request = new Request('GET', Server::$url, ['User-Agent' => 'bar']); + $c->send($request, ['headers' => ['User-Agent' => 'YO']]); + self::assertSame('YO', $mock->getLastRequest()->getHeaderLine('User-Agent')); + } + + public function testCanUnsetRequestOptionWithNull() + { + $mock = new MockHandler([new Response()]); + $c = new Client([ + 'headers' => ['foo' => 'bar'], + 'handler' => $mock, + ]); + $c->get('http://example.com', ['headers' => null]); + self::assertFalse($mock->getLastRequest()->hasHeader('foo')); + } + + public function testAllowRedirectsCanBeTrue() + { + $mock = new MockHandler([new Response(200, [], 'foo')]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('http://foo.com', ['allow_redirects' => true]); + self::assertIsArray($mock->getLastOptions()['allow_redirects']); + } + + public function testValidatesAllowRedirects() + { + $mock = new MockHandler([new Response(200, [], 'foo')]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('allow_redirects must be true, false, or array'); + $client->get('http://foo.com', ['allow_redirects' => 'foo']); + } + + public function testThrowsHttpErrorsByDefault() + { + $mock = new MockHandler([new Response(404)]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + + $this->expectException(\GuzzleHttp\Exception\ClientException::class); + $client->get('http://foo.com'); + } + + public function testValidatesCookies() + { + $mock = new MockHandler([new Response(200, [], 'foo')]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('cookies must be an instance of GuzzleHttp\\Cookie\\CookieJarInterface'); + $client->get('http://foo.com', ['cookies' => 'foo']); + } + + public function testSetCookieToTrueUsesSharedJar() + { + $mock = new MockHandler([ + new Response(200, ['Set-Cookie' => 'foo=bar']), + new Response(), + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler, 'cookies' => true]); + $client->get('http://foo.com'); + $client->get('http://foo.com'); + self::assertSame('foo=bar', $mock->getLastRequest()->getHeaderLine('Cookie')); + } + + public function testSetCookieToJar() + { + $mock = new MockHandler([ + new Response(200, ['Set-Cookie' => 'foo=bar']), + new Response(), + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $jar = new CookieJar(); + $client->get('http://foo.com', ['cookies' => $jar]); + $client->get('http://foo.com', ['cookies' => $jar]); + self::assertSame('foo=bar', $mock->getLastRequest()->getHeaderLine('Cookie')); + } + + public function testCanDisableContentDecoding() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['decode_content' => false]); + $last = $mock->getLastRequest(); + self::assertFalse($last->hasHeader('Accept-Encoding')); + self::assertFalse($mock->getLastOptions()['decode_content']); + } + + public function testCanSetContentDecodingToValue() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['decode_content' => 'gzip']); + $last = $mock->getLastRequest(); + self::assertSame('gzip', $last->getHeaderLine('Accept-Encoding')); + self::assertSame('gzip', $mock->getLastOptions()['decode_content']); + } + + public function testAddsAcceptEncodingbyCurl() + { + $client = new Client(['curl' => [\CURLOPT_ENCODING => '']]); + + Server::flush(); + Server::enqueue([new Response()]); + $client->get(Server::$url); + $sent = Server::received()[0]; + self::assertTrue($sent->hasHeader('Accept-Encoding')); + + $mock = new MockHandler([new Response()]); + $client->get('http://foo.com', ['handler' => $mock]); + self::assertSame([\CURLOPT_ENCODING => ''], $mock->getLastOptions()['curl']); + } + + public function testValidatesHeaders() + { + $mock = new MockHandler(); + $client = new Client(['handler' => $mock]); + + $this->expectException(\InvalidArgumentException::class); + $client->get('http://foo.com', ['headers' => 'foo']); + } + + public function testAddsBody() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, ['body' => 'foo']); + $last = $mock->getLastRequest(); + self::assertSame('foo', (string) $last->getBody()); + } + + public function testValidatesQuery() + { + $mock = new MockHandler(); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + + $this->expectException(\InvalidArgumentException::class); + $client->send($request, ['query' => false]); + } + + public function testQueryCanBeString() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, ['query' => 'foo']); + self::assertSame('foo', $mock->getLastRequest()->getUri()->getQuery()); + } + + public function testQueryCanBeArray() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, ['query' => ['foo' => 'bar baz']]); + self::assertSame('foo=bar%20baz', $mock->getLastRequest()->getUri()->getQuery()); + } + + public function testCanAddJsonData() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, ['json' => ['foo' => 'bar']]); + $last = $mock->getLastRequest(); + self::assertSame('{"foo":"bar"}', (string) $mock->getLastRequest()->getBody()); + self::assertSame('application/json', $last->getHeaderLine('Content-Type')); + } + + public function testCanAddJsonDataWithoutOverwritingContentType() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, [ + 'headers' => ['content-type' => 'foo'], + 'json' => 'a', + ]); + $last = $mock->getLastRequest(); + self::assertSame('"a"', (string) $mock->getLastRequest()->getBody()); + self::assertSame('foo', $last->getHeaderLine('Content-Type')); + } + + public function testCanAddJsonDataWithNullHeader() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, [ + 'headers' => null, + 'json' => 'a', + ]); + $last = $mock->getLastRequest(); + self::assertSame('"a"', (string) $mock->getLastRequest()->getBody()); + self::assertSame('application/json', $last->getHeaderLine('Content-Type')); + } + + public function testAuthCanBeTrue() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['auth' => false]); + $last = $mock->getLastRequest(); + self::assertFalse($last->hasHeader('Authorization')); + } + + public function testAuthCanBeArrayForBasicAuth() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['auth' => ['a', 'b']]); + $last = $mock->getLastRequest(); + self::assertSame('Basic YTpi', $last->getHeaderLine('Authorization')); + } + + public function testAuthCanBeArrayForDigestAuth() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['auth' => ['a', 'b', 'digest']]); + $last = $mock->getLastOptions(); + self::assertSame([ + \CURLOPT_HTTPAUTH => 2, + \CURLOPT_USERPWD => 'a:b', + ], $last['curl']); + } + + public function testAuthCanBeArrayForNtlmAuth() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['auth' => ['a', 'b', 'ntlm']]); + $last = $mock->getLastOptions(); + self::assertSame([ + \CURLOPT_HTTPAUTH => 8, + \CURLOPT_USERPWD => 'a:b', + ], $last['curl']); + } + + public function testAuthCanBeCustomType() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->get('http://foo.com', ['auth' => 'foo']); + $last = $mock->getLastOptions(); + self::assertSame('foo', $last['auth']); + } + + public function testCanAddFormParams() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->post('http://foo.com', [ + 'form_params' => [ + 'foo' => 'bar bam', + 'baz' => ['boo' => 'qux'], + ], + ]); + $last = $mock->getLastRequest(); + self::assertSame( + 'application/x-www-form-urlencoded', + $last->getHeaderLine('Content-Type') + ); + self::assertSame( + 'foo=bar+bam&baz%5Bboo%5D=qux', + (string) $last->getBody() + ); + } + + public function testFormParamsEncodedProperly() + { + $separator = \ini_get('arg_separator.output'); + \ini_set('arg_separator.output', '&'); + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->post('http://foo.com', [ + 'form_params' => [ + 'foo' => 'bar bam', + 'baz' => ['boo' => 'qux'], + ], + ]); + $last = $mock->getLastRequest(); + self::assertSame( + 'foo=bar+bam&baz%5Bboo%5D=qux', + (string) $last->getBody() + ); + + \ini_set('arg_separator.output', $separator); + } + + public function testEnsuresThatFormParamsAndMultipartAreExclusive() + { + $client = new Client(['handler' => static function () { + }]); + + $this->expectException(\InvalidArgumentException::class); + $client->post('http://foo.com', [ + 'form_params' => ['foo' => 'bar bam'], + 'multipart' => [], + ]); + } + + public function testCanSendMultipart() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->post('http://foo.com', [ + 'multipart' => [ + [ + 'name' => 'foo', + 'contents' => 'bar', + ], + [ + 'name' => 'test', + 'contents' => \fopen(__FILE__, 'r'), + ], + ], + ]); + + $last = $mock->getLastRequest(); + self::assertStringContainsString( + 'multipart/form-data; boundary=', + $last->getHeaderLine('Content-Type') + ); + + self::assertStringContainsString( + 'Content-Disposition: form-data; name="foo"', + (string) $last->getBody() + ); + + self::assertStringContainsString('bar', (string) $last->getBody()); + self::assertStringContainsString( + 'Content-Disposition: form-data; name="foo"'."\r\n", + (string) $last->getBody() + ); + self::assertStringContainsString( + 'Content-Disposition: form-data; name="test"; filename="ClientTest.php"', + (string) $last->getBody() + ); + } + + public function testCanSendMultipartWithExplicitBody() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->send( + new Request( + 'POST', + 'http://foo.com', + [], + new Psr7\MultipartStream( + [ + [ + 'name' => 'foo', + 'contents' => 'bar', + ], + [ + 'name' => 'test', + 'contents' => \fopen(__FILE__, 'r'), + ], + ] + ) + ) + ); + + $last = $mock->getLastRequest(); + self::assertStringContainsString( + 'multipart/form-data; boundary=', + $last->getHeaderLine('Content-Type') + ); + + self::assertStringContainsString( + 'Content-Disposition: form-data; name="foo"', + (string) $last->getBody() + ); + + self::assertStringContainsString('bar', (string) $last->getBody()); + self::assertStringContainsString( + 'Content-Disposition: form-data; name="foo"'."\r\n", + (string) $last->getBody() + ); + self::assertStringContainsString( + 'Content-Disposition: form-data; name="test"; filename="ClientTest.php"', + (string) $last->getBody() + ); + } + + public function testUsesProxyEnvironmentVariables() + { + unset($_SERVER['HTTP_PROXY'], $_SERVER['HTTPS_PROXY'], $_SERVER['NO_PROXY']); + \putenv('HTTP_PROXY='); + \putenv('HTTPS_PROXY='); + \putenv('NO_PROXY='); + + try { + $client = new Client(); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertArrayNotHasKey('proxy', $config); + + \putenv('HTTP_PROXY=127.0.0.1'); + $client = new Client(); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertArrayHasKey('proxy', $config); + self::assertSame(['http' => '127.0.0.1'], $config['proxy']); + + \putenv('HTTPS_PROXY=127.0.0.2'); + \putenv('NO_PROXY=127.0.0.3, 127.0.0.4'); + $client = new Client(); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertArrayHasKey('proxy', $config); + self::assertSame( + ['http' => '127.0.0.1', 'https' => '127.0.0.2', 'no' => ['127.0.0.3', '127.0.0.4']], + $config['proxy'] + ); + } finally { + \putenv('HTTP_PROXY='); + \putenv('HTTPS_PROXY='); + \putenv('NO_PROXY='); + } + } + + public function testRequestSendsWithSync() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->request('GET', 'http://foo.com'); + self::assertTrue($mock->getLastOptions()['synchronous']); + } + + public function testSendSendsWithSync() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $client->send(new Request('GET', 'http://foo.com')); + self::assertTrue($mock->getLastOptions()['synchronous']); + } + + public function testSendWithInvalidHeader() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('GET', 'http://foo.com'); + + $this->expectException(\GuzzleHttp\Exception\InvalidArgumentException::class); + $client->send($request, ['headers' => ['X-Foo: Bar']]); + } + + public function testSendWithInvalidHeaders() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('GET', 'http://foo.com'); + + $this->expectException(\GuzzleHttp\Exception\InvalidArgumentException::class); + $client->send($request, ['headers' => ['X-Foo: Bar', 'X-Test: Fail']]); + } + + public function testCanSetCustomHandler() + { + $mock = new MockHandler([new Response(500)]); + $client = new Client(['handler' => $mock]); + $mock2 = new MockHandler([new Response(200)]); + self::assertSame( + 200, + $client->send(new Request('GET', 'http://foo.com'), [ + 'handler' => $mock2, + ])->getStatusCode() + ); + } + + public function testProperlyBuildsQuery() + { + $mock = new MockHandler([new Response()]); + $client = new Client(['handler' => $mock]); + $request = new Request('PUT', 'http://foo.com'); + $client->send($request, ['query' => ['foo' => 'bar', 'john' => 'doe']]); + self::assertSame('foo=bar&john=doe', $mock->getLastRequest()->getUri()->getQuery()); + } + + public function testSendSendsWithIpAddressAndPortAndHostHeaderInRequestTheHostShouldBePreserved() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['base_uri' => 'http://127.0.0.1:8585', 'handler' => $mockHandler]); + $request = new Request('GET', '/test', ['Host' => 'foo.com']); + + $client->send($request); + + self::assertSame('foo.com', $mockHandler->getLastRequest()->getHeader('Host')[0]); + } + + public function testSendSendsWithDomainAndHostHeaderInRequestTheHostShouldBePreserved() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['base_uri' => 'http://foo2.com', 'handler' => $mockHandler]); + $request = new Request('GET', '/test', ['Host' => 'foo.com']); + + $client->send($request); + + self::assertSame('foo.com', $mockHandler->getLastRequest()->getHeader('Host')[0]); + } + + public function testValidatesSink() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $this->expectException(\InvalidArgumentException::class); + $client->get('http://test.com', ['sink' => true]); + } + + public function testHttpDefaultSchemeIfUriHasNone() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $client->request('GET', '//example.org/test'); + + self::assertSame('http://example.org/test', (string) $mockHandler->getLastRequest()->getUri()); + } + + public function testOnlyAddSchemeWhenHostIsPresent() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $client->request('GET', 'baz'); + self::assertSame( + 'baz', + (string) $mockHandler->getLastRequest()->getUri() + ); + } + + public function testThatVersionIsOverwrittenWhenSendingARequest() + { + $mockHandler = new MockHandler([new Response(), new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $request = new Request('get', '/bar', [], null, '1.1'); + $client->send($request, [RequestOptions::VERSION => '1.0']); + self::assertSame( + '1.0', + $mockHandler->getLastRequest()->getProtocolVersion() + ); + + $request = new Request('get', '/bar', [], null, '1.0'); + $client->send($request, [RequestOptions::VERSION => '1.1']); + self::assertSame( + '1.1', + $mockHandler->getLastRequest()->getProtocolVersion() + ); + } + + public function testHandlerIsCallable() + { + $this->expectException(\InvalidArgumentException::class); + + new Client(['handler' => 'not_cllable']); + } + + public function testResponseBodyAsString() + { + $responseBody = '{ "package": "guzzle" }'; + $mock = new MockHandler([new Response(200, ['Content-Type' => 'application/json'], $responseBody)]); + $client = new Client(['handler' => $mock]); + $request = new Request('GET', 'http://foo.com'); + $response = $client->send($request, ['json' => ['a' => 'b']]); + + self::assertSame($responseBody, (string) $response->getBody()); + } + + public function testResponseContent() + { + $responseBody = '{ "package": "guzzle" }'; + $mock = new MockHandler([new Response(200, ['Content-Type' => 'application/json'], $responseBody)]); + $client = new Client(['handler' => $mock]); + $request = new Request('POST', 'http://foo.com'); + $response = $client->send($request, ['json' => ['a' => 'b']]); + + self::assertSame($responseBody, $response->getBody()->getContents()); + } + + public function testIdnSupportDefaultValue() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $config = Helpers::readObjectAttribute($client, 'config'); + + self::assertFalse($config['idn_conversion']); + } + + /** + * @requires extension idn + */ + public function testIdnIsTranslatedToAsciiWhenConversionIsEnabled() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $client->request('GET', 'https://яндекс.рф/images', ['idn_conversion' => true]); + + $request = $mockHandler->getLastRequest(); + + self::assertSame('https://xn--d1acpjx3f.xn--p1ai/images', (string) $request->getUri()); + self::assertSame('xn--d1acpjx3f.xn--p1ai', (string) $request->getHeaderLine('Host')); + } + + public function testIdnStaysTheSameWhenConversionIsDisabled() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $client->request('GET', 'https://яндекс.рф/images', ['idn_conversion' => false]); + + $request = $mockHandler->getLastRequest(); + + self::assertSame('https://яндекс.рф/images', (string) $request->getUri()); + self::assertSame('яндекс.рф', (string) $request->getHeaderLine('Host')); + } + + /** + * @requires extension idn + */ + public function testExceptionOnInvalidIdn() + { + $mockHandler = new MockHandler([new Response()]); + $client = new Client(['handler' => $mockHandler]); + + $this->expectException(\GuzzleHttp\Exception\InvalidArgumentException::class); + $this->expectExceptionMessage('IDN conversion failed'); + $client->request('GET', 'https://-яндекс.рф/images', ['idn_conversion' => true]); + } + + /** + * @depends testCanUseRelativeUriWithSend + * + * @requires extension idn + */ + public function testIdnBaseUri() + { + $mock = new MockHandler([new Response()]); + $client = new Client([ + 'handler' => $mock, + 'base_uri' => 'http://яндекс.рф', + 'idn_conversion' => true, + ]); + $config = Helpers::readObjectAttribute($client, 'config'); + self::assertSame('http://яндекс.рф', (string) $config['base_uri']); + $request = new Request('GET', '/baz'); + $client->send($request); + self::assertSame('http://xn--d1acpjx3f.xn--p1ai/baz', (string) $mock->getLastRequest()->getUri()); + self::assertSame('xn--d1acpjx3f.xn--p1ai', (string) $mock->getLastRequest()->getHeaderLine('Host')); + } + + /** + * @requires extension idn + */ + public function testIdnWithRedirect() + { + $mockHandler = new MockHandler([ + new Response(302, ['Location' => 'http://www.tést.com/whatever']), + new Response(), + ]); + $handler = HandlerStack::create($mockHandler); + $requests = []; + $handler->push(Middleware::history($requests)); + $client = new Client(['handler' => $handler]); + + $client->request('GET', 'https://яндекс.рф/images', [ + RequestOptions::ALLOW_REDIRECTS => [ + 'referer' => true, + 'track_redirects' => true, + ], + 'idn_conversion' => true, + ]); + + $request = $mockHandler->getLastRequest(); + + self::assertSame('http://www.xn--tst-bma.com/whatever', (string) $request->getUri()); + self::assertSame('www.xn--tst-bma.com', (string) $request->getHeaderLine('Host')); + + $request = $requests[0]['request']; + self::assertSame('https://xn--d1acpjx3f.xn--p1ai/images', (string) $request->getUri()); + self::assertSame('xn--d1acpjx3f.xn--p1ai', (string) $request->getHeaderLine('Host')); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/CookieJarTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/CookieJarTest.php new file mode 100644 index 0000000000..87d95bd9c4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/CookieJarTest.php @@ -0,0 +1,507 @@ +jar = new CookieJar(); + } + + protected function getTestCookies() + { + return [ + new SetCookie(['Name' => 'foo', 'Value' => 'bar', 'Domain' => 'foo.com', 'Path' => '/', 'Discard' => true]), + new SetCookie(['Name' => 'test', 'Value' => '123', 'Domain' => 'baz.com', 'Path' => '/foo', 'Expires' => 2]), + new SetCookie(['Name' => 'you', 'Value' => '123', 'Domain' => 'bar.com', 'Path' => '/boo', 'Expires' => \time() + 1000]), + ]; + } + + public function testCreatesFromArray() + { + $jar = CookieJar::fromArray([ + 'foo' => 'bar', + 'baz' => 'bam', + ], 'example.com'); + self::assertCount(2, $jar); + } + + public function testEmptyJarIsCountable() + { + self::assertCount(0, new CookieJar()); + } + + public function testGetsCookiesByName() + { + $cookies = $this->getTestCookies(); + foreach ($this->getTestCookies() as $cookie) { + $this->jar->setCookie($cookie); + } + + $testCookie = $cookies[0]; + self::assertEquals($testCookie, $this->jar->getCookieByName($testCookie->getName())); + self::assertNull($this->jar->getCookieByName('doesnotexist')); + self::assertNull($this->jar->getCookieByName('')); + } + + /** + * Provides test data for cookie cookieJar retrieval + */ + public function getCookiesDataProvider() + { + return [ + [['foo', 'baz', 'test', 'muppet', 'googoo'], '', '', '', false], + [['foo', 'baz', 'muppet', 'googoo'], '', '', '', true], + [['googoo'], 'www.example.com', '', '', false], + [['muppet', 'googoo'], 'test.y.example.com', '', '', false], + [['foo', 'baz'], 'example.com', '', '', false], + [['muppet'], 'x.y.example.com', '/acme/', '', false], + [['muppet'], 'x.y.example.com', '/acme/test/', '', false], + [['googoo'], 'x.y.example.com', '/test/acme/test/', '', false], + [['foo', 'baz'], 'example.com', '', '', false], + [['baz'], 'example.com', '', 'baz', false], + ]; + } + + public function testStoresAndRetrievesCookies() + { + $cookies = $this->getTestCookies(); + foreach ($cookies as $cookie) { + self::assertTrue($this->jar->setCookie($cookie)); + } + + self::assertCount(3, $this->jar); + self::assertCount(3, $this->jar->getIterator()); + self::assertEquals($cookies, $this->jar->getIterator()->getArrayCopy()); + } + + public function testRemovesTemporaryCookies() + { + $cookies = $this->getTestCookies(); + foreach ($this->getTestCookies() as $cookie) { + $this->jar->setCookie($cookie); + } + $this->jar->clearSessionCookies(); + self::assertEquals( + [$cookies[1], $cookies[2]], + $this->jar->getIterator()->getArrayCopy() + ); + } + + public function testRemovesSelectively() + { + foreach ($this->getTestCookies() as $cookie) { + $this->jar->setCookie($cookie); + } + + // Remove foo.com cookies + $this->jar->clear('foo.com'); + self::assertCount(2, $this->jar); + // Try again, removing no further cookies + $this->jar->clear('foo.com'); + self::assertCount(2, $this->jar); + + // Remove bar.com cookies with path of /boo + $this->jar->clear('bar.com', '/boo'); + self::assertCount(1, $this->jar); + + // Remove cookie by name + $this->jar->clear(null, null, 'test'); + self::assertCount(0, $this->jar); + } + + public static function providesIncompleteCookies(): array + { + return [ + [ + [], + ], + [ + [ + 'Name' => 'foo', + ], + ], + [ + [ + 'Name' => false, + ], + ], + [ + [ + 'Name' => true, + ], + ], + [ + [ + 'Name' => 'foo', + 'Domain' => 'foo.com', + ], + ], + ]; + } + + /** + * @dataProvider providesIncompleteCookies + */ + public function testDoesNotAddIncompleteCookies(array $cookie) + { + self::assertFalse($this->jar->setCookie(new SetCookie($cookie))); + } + + public static function providesEmptyCookies(): array + { + return [ + [ + [ + 'Name' => '', + 'Domain' => 'foo.com', + 'Value' => 0, + ], + ], + [ + [ + 'Name' => null, + 'Domain' => 'foo.com', + 'Value' => 0, + ], + ], + ]; + } + + /** + * @dataProvider providesEmptyCookies + */ + public function testDoesNotAddEmptyCookies(array $cookie) + { + self::assertFalse($this->jar->setCookie(new SetCookie($cookie))); + } + + public static function providesValidCookies(): array + { + return [ + [ + [ + 'Name' => '0', + 'Domain' => 'foo.com', + 'Value' => 0, + ], + ], + [ + [ + 'Name' => 'foo', + 'Domain' => 'foo.com', + 'Value' => 0, + ], + ], + [ + [ + 'Name' => 'foo', + 'Domain' => 'foo.com', + 'Value' => 0.0, + ], + ], + [ + [ + 'Name' => 'foo', + 'Domain' => 'foo.com', + 'Value' => '0', + ], + ], + ]; + } + + /** + * @dataProvider providesValidCookies + */ + public function testDoesAddValidCookies(array $cookie) + { + self::assertTrue($this->jar->setCookie(new SetCookie($cookie))); + } + + public function testOverwritesCookiesThatAreOlderOrDiscardable() + { + $t = \time() + 1000; + $data = [ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => '.example.com', + 'Path' => '/', + 'Max-Age' => '86400', + 'Secure' => true, + 'Discard' => true, + 'Expires' => $t, + ]; + + // Make sure that the discard cookie is overridden with the non-discard + self::assertTrue($this->jar->setCookie(new SetCookie($data))); + self::assertCount(1, $this->jar); + + $data['Discard'] = false; + self::assertTrue($this->jar->setCookie(new SetCookie($data))); + self::assertCount(1, $this->jar); + + $c = $this->jar->getIterator()->getArrayCopy(); + self::assertFalse($c[0]->getDiscard()); + + // Make sure it doesn't duplicate the cookie + $this->jar->setCookie(new SetCookie($data)); + self::assertCount(1, $this->jar); + + // Make sure the more future-ful expiration date supersede the other + $data['Expires'] = \time() + 2000; + self::assertTrue($this->jar->setCookie(new SetCookie($data))); + self::assertCount(1, $this->jar); + $c = $this->jar->getIterator()->getArrayCopy(); + self::assertNotEquals($t, $c[0]->getExpires()); + } + + public function testOverwritesCookiesThatHaveChanged() + { + $t = \time() + 1000; + $data = [ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => '.example.com', + 'Path' => '/', + 'Max-Age' => '86400', + 'Secure' => true, + 'Discard' => true, + 'Expires' => $t, + ]; + + // Make sure that the discard cookie is overridden with the non-discard + self::assertTrue($this->jar->setCookie(new SetCookie($data))); + + $data['Value'] = 'boo'; + self::assertTrue($this->jar->setCookie(new SetCookie($data))); + self::assertCount(1, $this->jar); + + // Changing the value plus a parameter also must overwrite the existing one + $data['Value'] = 'zoo'; + $data['Secure'] = false; + self::assertTrue($this->jar->setCookie(new SetCookie($data))); + self::assertCount(1, $this->jar); + + $c = $this->jar->getIterator()->getArrayCopy(); + self::assertSame('zoo', $c[0]->getValue()); + } + + public function testAddsCookiesFromResponseWithRequest() + { + $response = new Response(200, [ + 'Set-Cookie' => 'fpc=d=.Hm.yh4.1XmJWjJfs4orLQzKzPImxklQoxXSHOZATHUSEFciRueW_7704iYUtsXNEXq0M92Px2glMdWypmJ7HIQl6XIUvrZimWjQ3vIdeuRbI.FNQMAfcxu_XN1zSx7l.AcPdKL6guHc2V7hIQFhnjRW0rxm2oHY1P4bGQxFNz7f.tHm12ZD3DbdMDiDy7TBXsuP4DM-&v=2; expires=Fri, 02-Mar-2019 02:17:40 GMT;', + ]); + $request = new Request('GET', 'http://www.example.com'); + $this->jar->extractCookies($request, $response); + self::assertCount(1, $this->jar); + } + + public function getMatchingCookiesDataProvider() + { + return [ + ['https://example.com', 'foo=bar; baz=foobar'], + ['http://example.com', ''], + ['https://example.com:8912', 'foo=bar; baz=foobar'], + ['https://foo.example.com', 'foo=bar; baz=foobar'], + ['http://foo.example.com/test/acme/', 'googoo=gaga'], + ]; + } + + /** + * @dataProvider getMatchingCookiesDataProvider + */ + public function testReturnsCookiesMatchingRequests(string $url, string $cookies) + { + $bag = [ + new SetCookie([ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => 'example.com', + 'Path' => '/', + 'Max-Age' => '86400', + 'Secure' => true, + ]), + new SetCookie([ + 'Name' => 'baz', + 'Value' => 'foobar', + 'Domain' => 'example.com', + 'Path' => '/', + 'Max-Age' => '86400', + 'Secure' => true, + ]), + new SetCookie([ + 'Name' => 'test', + 'Value' => '123', + 'Domain' => 'www.foobar.com', + 'Path' => '/path/', + 'Discard' => true, + ]), + new SetCookie([ + 'Name' => 'muppet', + 'Value' => 'cookie_monster', + 'Domain' => '.y.example.com', + 'Path' => '/acme/', + 'Expires' => \time() + 86400, + ]), + new SetCookie([ + 'Name' => 'googoo', + 'Value' => 'gaga', + 'Domain' => '.example.com', + 'Path' => '/test/acme/', + 'Max-Age' => 1500, + ]), + ]; + + foreach ($bag as $cookie) { + $this->jar->setCookie($cookie); + } + + $request = new Request('GET', $url); + $request = $this->jar->withCookieHeader($request); + self::assertSame($cookies, $request->getHeaderLine('Cookie')); + } + + public function testThrowsExceptionWithStrictMode() + { + $a = new CookieJar(true); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Invalid cookie: Cookie name must not contain invalid characters: ASCII Control characters (0-31;127), space, tab and the following characters: ()<>@,;:\\"/?={}'); + $a->setCookie(new SetCookie(['Name' => "abc\n", 'Value' => 'foo', 'Domain' => 'bar'])); + } + + public function testDeletesCookiesByName() + { + $cookies = $this->getTestCookies(); + $cookies[] = new SetCookie([ + 'Name' => 'other', + 'Value' => '123', + 'Domain' => 'bar.com', + 'Path' => '/boo', + 'Expires' => \time() + 1000, + ]); + $jar = new CookieJar(); + foreach ($cookies as $cookie) { + $jar->setCookie($cookie); + } + self::assertCount(4, $jar); + $jar->clear('bar.com', '/boo', 'other'); + self::assertCount(3, $jar); + $names = \array_map(static function (SetCookie $c) { + return $c->getName(); + }, $jar->getIterator()->getArrayCopy()); + self::assertSame(['foo', 'test', 'you'], $names); + } + + public function testCanConvertToAndLoadFromArray() + { + $jar = new CookieJar(true); + foreach ($this->getTestCookies() as $cookie) { + $jar->setCookie($cookie); + } + self::assertCount(3, $jar); + $arr = $jar->toArray(); + self::assertCount(3, $arr); + $newCookieJar = new CookieJar(false, $arr); + self::assertCount(3, $newCookieJar); + self::assertSame($jar->toArray(), $newCookieJar->toArray()); + } + + public function testAddsCookiesWithEmptyPathFromResponse() + { + $response = new Response(200, [ + 'Set-Cookie' => "fpc=foobar; expires={$this->futureExpirationDate()}; path=;", + ]); + $request = new Request('GET', 'http://www.example.com'); + $this->jar->extractCookies($request, $response); + $newRequest = $this->jar->withCookieHeader(new Request('GET', 'http://www.example.com/foo')); + self::assertTrue($newRequest->hasHeader('Cookie')); + } + + public function getCookiePathsDataProvider() + { + return [ + ['', '/'], + ['/', '/'], + ['/foo', '/'], + ['/foo/bar', '/foo'], + ['/foo/bar/', '/foo/bar'], + ]; + } + + /** + * @dataProvider getCookiePathsDataProvider + */ + public function testCookiePathWithEmptySetCookiePath(string $uriPath, string $cookiePath) + { + $response = (new Response(200)) + ->withAddedHeader( + 'Set-Cookie', + "foo=bar; expires={$this->futureExpirationDate()}; domain=www.example.com; path=;" + ) + ->withAddedHeader( + 'Set-Cookie', + "bar=foo; expires={$this->futureExpirationDate()}; domain=www.example.com; path=foobar;" + ) + ; + $request = (new Request('GET', "https://www.example.com{$uriPath}")); + $this->jar->extractCookies($request, $response); + + self::assertSame($cookiePath, $this->jar->toArray()[0]['Path']); + self::assertSame($cookiePath, $this->jar->toArray()[1]['Path']); + } + + public function getDomainMatchesProvider() + { + return [ + ['www.example.com', 'www.example.com', true], + ['www.example.com', 'www.EXAMPLE.com', true], + ['www.example.com', 'www.example.net', false], + ['www.example.com', 'ftp.example.com', false], + ['www.example.com', 'example.com', true], + ['www.example.com', 'EXAMPLE.com', true], + ['fra.de.example.com', 'EXAMPLE.com', true], + ['www.EXAMPLE.com', 'www.example.com', true], + ['www.EXAMPLE.com', 'www.example.COM', true], + ]; + } + + /** + * @dataProvider getDomainMatchesProvider + */ + public function testIgnoresCookiesForMismatchingDomains(string $requestHost, string $domainAttribute, bool $matches) + { + $response = (new Response(200)) + ->withAddedHeader( + 'Set-Cookie', + "foo=bar; expires={$this->futureExpirationDate()}; domain={$domainAttribute}; path=/;" + ) + ; + $request = (new Request('GET', "https://{$requestHost}/")); + $this->jar->extractCookies($request, $response); + + self::assertCount($matches ? 1 : 0, $this->jar->toArray()); + } + + private function futureExpirationDate() + { + return (new DateTimeImmutable())->add(new DateInterval('P1D'))->format(DateTime::COOKIE); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/FileCookieJarTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/FileCookieJarTest.php new file mode 100644 index 0000000000..3ee2dd09fe --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/FileCookieJarTest.php @@ -0,0 +1,148 @@ +file = \tempnam(\sys_get_temp_dir(), 'file-cookies'); + } + + /** + * @dataProvider invalidCookieJarContent + */ + public function testValidatesCookieFile($invalidCookieJarContent) + { + \file_put_contents($this->file, json_encode($invalidCookieJarContent)); + + $this->expectException(\RuntimeException::class); + new FileCookieJar($this->file); + } + + public function testLoadsFromFile() + { + $jar = new FileCookieJar($this->file); + self::assertSame([], $jar->getIterator()->getArrayCopy()); + \unlink($this->file); + } + + /** + * @dataProvider providerPersistsToFileFileParameters + */ + public function testPersistsToFile($testSaveSessionCookie = false) + { + $jar = new FileCookieJar($this->file, $testSaveSessionCookie); + $jar->setCookie(new SetCookie([ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + $jar->setCookie(new SetCookie([ + 'Name' => 'baz', + 'Value' => 'bar', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + $jar->setCookie(new SetCookie([ + 'Name' => 'boo', + 'Value' => 'bar', + 'Domain' => 'foo.com', + ])); + + self::assertCount(3, $jar); + unset($jar); + + // Make sure it wrote to the file + $contents = \file_get_contents($this->file); + self::assertNotEmpty($contents); + + // Load the cookieJar from the file + $jar = new FileCookieJar($this->file); + + if ($testSaveSessionCookie) { + self::assertCount(3, $jar); + } else { + // Weeds out temporary and session cookies + self::assertCount(2, $jar); + } + + unset($jar); + \unlink($this->file); + } + + public function testRemovesCookie() + { + $jar = new FileCookieJar($this->file); + $jar->setCookie(new SetCookie([ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + + self::assertCount(1, $jar); + + // Remove the cookie. + $jar->clear('foo.com', '/', 'foo'); + + // Confirm that the cookie was removed. + self::assertCount(0, $jar); + + \unlink($this->file); + } + + public function testUpdatesCookie() + { + $jar = new FileCookieJar($this->file); + $jar->setCookie(new SetCookie([ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + + self::assertCount(1, $jar); + + // Update the cookie value. + $jar->setCookie(new SetCookie([ + 'Name' => 'foo', + 'Value' => 'new_value', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + + $cookies = $jar->getIterator()->getArrayCopy(); + + // Confirm that the cookie was updated. + self::assertEquals('new_value', $cookies[0]->getValue()); + + \unlink($this->file); + } + + public function providerPersistsToFileFileParameters() + { + return [ + [false], + [true], + ]; + } + + public function invalidCookieJarContent(): array + { + return [ + [true], + ['invalid-data'], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SessionCookieJarTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SessionCookieJarTest.php new file mode 100644 index 0000000000..30a4b10175 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SessionCookieJarTest.php @@ -0,0 +1,92 @@ +sessionVar = 'sessionKey'; + + if (!isset($_SESSION)) { + $_SESSION = []; + } + } + + public function testValidatesCookieSession() + { + $_SESSION[$this->sessionVar] = 'true'; + + $this->expectException(\RuntimeException::class); + new SessionCookieJar($this->sessionVar); + } + + public function testLoadsFromSession() + { + $jar = new SessionCookieJar($this->sessionVar); + self::assertSame([], $jar->getIterator()->getArrayCopy()); + unset($_SESSION[$this->sessionVar]); + } + + /** + * @dataProvider providerPersistsToSessionParameters + */ + public function testPersistsToSession($testSaveSessionCookie = false) + { + $jar = new SessionCookieJar($this->sessionVar, $testSaveSessionCookie); + $jar->setCookie(new SetCookie([ + 'Name' => 'foo', + 'Value' => 'bar', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + $jar->setCookie(new SetCookie([ + 'Name' => 'baz', + 'Value' => 'bar', + 'Domain' => 'foo.com', + 'Expires' => \time() + 1000, + ])); + $jar->setCookie(new SetCookie([ + 'Name' => 'boo', + 'Value' => 'bar', + 'Domain' => 'foo.com', + ])); + + self::assertCount(3, $jar); + unset($jar); + + // Make sure it wrote to the sessionVar in $_SESSION + $contents = $_SESSION[$this->sessionVar]; + self::assertNotEmpty($contents); + + // Load the cookieJar from the file + $jar = new SessionCookieJar($this->sessionVar); + + if ($testSaveSessionCookie) { + self::assertCount(3, $jar); + } else { + // Weeds out temporary and session cookies + self::assertCount(2, $jar); + } + + unset($jar); + unset($_SESSION[$this->sessionVar]); + } + + public function providerPersistsToSessionParameters() + { + return [ + [false], + [true], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SetCookieTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SetCookieTest.php new file mode 100644 index 0000000000..55d4e7fc3a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Cookie/SetCookieTest.php @@ -0,0 +1,492 @@ +getPath()); + } + + public function testConvertsDateTimeMaxAgeToUnixTimestamp() + { + $cookie = new SetCookie(['Expires' => 'November 20, 1984']); + self::assertIsInt($cookie->getExpires()); + } + + public function testAddsExpiresBasedOnMaxAge() + { + $t = \time(); + $cookie = new SetCookie(['Max-Age' => 100]); + self::assertEquals($t + 100, $cookie->getExpires()); + } + + public function testHoldsValues() + { + $t = \time(); + $data = [ + 'Name' => 'foo', + 'Value' => 'baz', + 'Path' => '/bar', + 'Domain' => 'baz.com', + 'Expires' => $t, + 'Max-Age' => 100, + 'Secure' => true, + 'Discard' => true, + 'HttpOnly' => true, + 'foo' => 'baz', + 'bar' => 'bam', + ]; + + $cookie = new SetCookie($data); + self::assertEquals($data, $cookie->toArray()); + + self::assertSame('foo', $cookie->getName()); + self::assertSame('baz', $cookie->getValue()); + self::assertSame('baz.com', $cookie->getDomain()); + self::assertSame('/bar', $cookie->getPath()); + self::assertSame($t, $cookie->getExpires()); + self::assertSame(100, $cookie->getMaxAge()); + self::assertTrue($cookie->getSecure()); + self::assertTrue($cookie->getDiscard()); + self::assertTrue($cookie->getHttpOnly()); + self::assertSame('baz', $cookie->toArray()['foo']); + self::assertSame('bam', $cookie->toArray()['bar']); + + $cookie->setName('a'); + $cookie->setValue('b'); + $cookie->setPath('c'); + $cookie->setDomain('bar.com'); + $cookie->setExpires(10); + $cookie->setMaxAge(200); + $cookie->setSecure(false); + $cookie->setHttpOnly(false); + $cookie->setDiscard(false); + + self::assertSame('a', $cookie->getName()); + self::assertSame('b', $cookie->getValue()); + self::assertSame('c', $cookie->getPath()); + self::assertSame('bar.com', $cookie->getDomain()); + self::assertSame(10, $cookie->getExpires()); + self::assertSame(200, $cookie->getMaxAge()); + self::assertFalse($cookie->getSecure()); + self::assertFalse($cookie->getDiscard()); + self::assertFalse($cookie->getHttpOnly()); + } + + public function testDeterminesIfExpired() + { + $c = new SetCookie(); + $c->setExpires(10); + self::assertTrue($c->isExpired()); + $c->setExpires(\time() + 10000); + self::assertFalse($c->isExpired()); + } + + public function testMatchesDomain() + { + $cookie = new SetCookie(); + self::assertTrue($cookie->matchesDomain('baz.com')); + + $cookie->setDomain('baz.com'); + self::assertTrue($cookie->matchesDomain('baz.com')); + self::assertFalse($cookie->matchesDomain('bar.com')); + + $cookie->setDomain('.baz.com'); + self::assertTrue($cookie->matchesDomain('.baz.com')); + self::assertTrue($cookie->matchesDomain('foo.baz.com')); + self::assertFalse($cookie->matchesDomain('baz.bar.com')); + self::assertTrue($cookie->matchesDomain('baz.com')); + + $cookie->setDomain('.127.0.0.1'); + self::assertTrue($cookie->matchesDomain('127.0.0.1')); + + $cookie->setDomain('127.0.0.1'); + self::assertTrue($cookie->matchesDomain('127.0.0.1')); + + $cookie->setDomain('.com.'); + self::assertFalse($cookie->matchesDomain('baz.com')); + + $cookie->setDomain('.local'); + self::assertTrue($cookie->matchesDomain('example.local')); + + $cookie->setDomain('example.com/'); // malformed domain + self::assertFalse($cookie->matchesDomain('example.com')); + } + + public function pathMatchProvider() + { + return [ + ['/foo', '/foo', true], + ['/foo', '/Foo', false], + ['/foo', '/fo', false], + ['/foo', '/foo/bar', true], + ['/foo', '/foo/bar/baz', true], + ['/foo', '/foo/bar//baz', true], + ['/foo', '/foobar', false], + ['/foo/bar', '/foo', false], + ['/foo/bar', '/foobar', false], + ['/foo/bar', '/foo/bar', true], + ['/foo/bar', '/foo/bar/', true], + ['/foo/bar', '/foo/bar/baz', true], + ['/foo/bar/', '/foo/bar', false], + ['/foo/bar/', '/foo/bar/', true], + ['/foo/bar/', '/foo/bar/baz', true], + ]; + } + + /** + * @dataProvider pathMatchProvider + */ + public function testMatchesPath($cookiePath, $requestPath, $isMatch) + { + $cookie = new SetCookie(); + $cookie->setPath($cookiePath); + self::assertSame($isMatch, $cookie->matchesPath($requestPath)); + } + + public function cookieValidateProvider() + { + return [ + ['foo', 'baz', 'bar', true], + ['0', '0', '0', true], + ['foo[bar]', 'baz', 'bar', true], + ['foo', '', 'bar', true], + ['', 'baz', 'bar', 'The cookie name must not be empty'], + ['foo', null, 'bar', 'The cookie value must not be empty'], + ['foo', 'baz', '', 'The cookie domain must not be empty'], + ["foo\r", 'baz', '0', 'Cookie name must not contain invalid characters: ASCII Control characters (0-31;127), space, tab and the following characters: ()<>@,;:\"/?={}'], + ]; + } + + /** + * @dataProvider cookieValidateProvider + */ + public function testValidatesCookies($name, $value, $domain, $result) + { + $cookie = new SetCookie([ + 'Name' => $name, + 'Value' => $value, + 'Domain' => $domain, + ]); + self::assertSame($result, $cookie->validate()); + } + + public function testDoesNotMatchIp() + { + $cookie = new SetCookie(['Domain' => '192.168.16.']); + self::assertFalse($cookie->matchesDomain('192.168.16.121')); + } + + public function testConvertsToString() + { + $t = 1382916008; + $cookie = new SetCookie([ + 'Name' => 'test', + 'Value' => '123', + 'Domain' => 'foo.com', + 'Expires' => $t, + 'Path' => '/abc', + 'HttpOnly' => true, + 'Secure' => true, + ]); + self::assertSame( + 'test=123; Domain=foo.com; Path=/abc; Expires=Sun, 27 Oct 2013 23:20:08 GMT; Secure; HttpOnly', + (string) $cookie + ); + } + + /** + * Provides the parsed information from a cookie + * + * @return array + */ + public function cookieParserDataProvider() + { + return [ + [ + 'ASIHTTPRequestTestCookie=This+is+the+value; expires=Sat, 26-Jul-2008 17:00:42 GMT; path=/tests; domain=allseeing-i.com; PHPSESSID=6c951590e7a9359bcedde25cda73e43c; path=/;', + [ + 'Domain' => 'allseeing-i.com', + 'Path' => '/', + 'PHPSESSID' => '6c951590e7a9359bcedde25cda73e43c', + 'Max-Age' => null, + 'Expires' => 'Sat, 26-Jul-2008 17:00:42 GMT', + 'Secure' => null, + 'Discard' => null, + 'Name' => 'ASIHTTPRequestTestCookie', + 'Value' => 'This+is+the+value', + 'HttpOnly' => false, + ], + ], + ['', []], + ['foo', []], + ['; foo', []], + [ + 'foo="bar"', + [ + 'Name' => 'foo', + 'Value' => '"bar"', + 'Discard' => null, + 'Domain' => null, + 'Expires' => null, + 'Max-Age' => null, + 'Path' => '/', + 'Secure' => null, + 'HttpOnly' => false, + ], + ], + // Test setting a blank value for a cookie + [[ + 'foo=', 'foo =', 'foo =;', 'foo= ;', 'foo =', 'foo= ', ], + [ + 'Name' => 'foo', + 'Value' => '', + 'Discard' => null, + 'Domain' => null, + 'Expires' => null, + 'Max-Age' => null, + 'Path' => '/', + 'Secure' => null, + 'HttpOnly' => false, + ], + ], + // Test setting a value and removing quotes + [[ + 'foo=1', 'foo =1', 'foo =1;', 'foo=1 ;', 'foo =1', 'foo= 1', 'foo = 1 ;', ], + [ + 'Name' => 'foo', + 'Value' => '1', + 'Discard' => null, + 'Domain' => null, + 'Expires' => null, + 'Max-Age' => null, + 'Path' => '/', + 'Secure' => null, + 'HttpOnly' => false, + ], + ], + // Some of the following tests are based on https://github.com/zendframework/zf1/blob/master/tests/Zend/Http/CookieTest.php + [ + 'justacookie=foo; domain=example.com', + [ + 'Name' => 'justacookie', + 'Value' => 'foo', + 'Domain' => 'example.com', + 'Discard' => null, + 'Expires' => null, + 'Max-Age' => null, + 'Path' => '/', + 'Secure' => null, + 'HttpOnly' => false, + ], + ], + [ + 'expires=tomorrow; secure; path=/Space Out/; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=.example.com', + [ + 'Name' => 'expires', + 'Value' => 'tomorrow', + 'Domain' => '.example.com', + 'Path' => '/Space Out/', + 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', + 'Discard' => null, + 'Secure' => true, + 'Max-Age' => null, + 'HttpOnly' => false, + ], + ], + [ + 'domain=unittests; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=example.com; path=/some value/', + [ + 'Name' => 'domain', + 'Value' => 'unittests', + 'Domain' => 'example.com', + 'Path' => '/some value/', + 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', + 'Secure' => false, + 'Discard' => null, + 'Max-Age' => null, + 'HttpOnly' => false, + ], + ], + [ + 'path=indexAction; path=/; domain=.foo.com; expires=Tue, 21-Nov-2006 08:33:44 GMT', + [ + 'Name' => 'path', + 'Value' => 'indexAction', + 'Domain' => '.foo.com', + 'Path' => '/', + 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', + 'Secure' => false, + 'Discard' => null, + 'Max-Age' => null, + 'HttpOnly' => false, + ], + ], + [ + 'secure=sha1; secure; SECURE; domain=some.really.deep.domain.com; version=1; Max-Age=86400', + [ + 'Name' => 'secure', + 'Value' => 'sha1', + 'Domain' => 'some.really.deep.domain.com', + 'Path' => '/', + 'Secure' => true, + 'Discard' => null, + 'Expires' => \time() + 86400, + 'Max-Age' => 86400, + 'HttpOnly' => false, + 'version' => '1', + ], + ], + [ + 'PHPSESSID=123456789+abcd%2Cef; secure; discard; domain=.localdomain; path=/foo/baz; expires=Tue, 21-Nov-2006 08:33:44 GMT;', + [ + 'Name' => 'PHPSESSID', + 'Value' => '123456789+abcd%2Cef', + 'Domain' => '.localdomain', + 'Path' => '/foo/baz', + 'Expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', + 'Secure' => true, + 'Discard' => true, + 'Max-Age' => null, + 'HttpOnly' => false, + ], + ], + [ + 'fr=synced; Max-Age=604800 Expires=Mon, 12 Dec 2022 13:27:50 GMT; Domain=.example.com; Path=/; SameSite=None; Secure; HttpOnly', + [ + 'Name' => 'fr', + 'Value' => 'synced', + 'Domain' => '.example.com', + 'Path' => '/', + 'Expires' => null, + 'Secure' => true, + 'Discard' => false, + 'Max-Age' => null, + 'HttpOnly' => true, + 'SameSite' => 'None', + ], + ], + [ + 'SESS3a6f27284c4d8b34b6f4ff98cb87703e=Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH; expires=Wed, 07-Jun-2023 15:56:35 GMT; Max-Age=2000000; path=/; domain=.example.com; HttpOnly; SameSite=Lax', + [ + 'Name' => 'SESS3a6f27284c4d8b34b6f4ff98cb87703e', + 'Value' => 'Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH', + 'Domain' => '.example.com', + 'Path' => '/', + 'Expires' => 'Wed, 07-Jun-2023 15:56:35 GMT', + 'Secure' => false, + 'Discard' => false, + 'Max-Age' => 2000000, + 'HttpOnly' => true, + 'SameSite' => 'Lax', + ], + ], + [ + 'SESS3a6f27284c4d8b34b6f4ff98cb87703e=Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH; expires=Wed, 07-Jun-2023 15:56:35 GMT; Max-Age=qwerty; path=/; domain=.example.com; HttpOnly; SameSite=Lax', + [ + 'Name' => 'SESS3a6f27284c4d8b34b6f4ff98cb87703e', + 'Value' => 'Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH', + 'Domain' => '.example.com', + 'Path' => '/', + 'Expires' => 'Wed, 07-Jun-2023 15:56:35 GMT', + 'Secure' => false, + 'Discard' => false, + 'Max-Age' => null, + 'HttpOnly' => true, + 'SameSite' => 'Lax', + ], + ], + ]; + } + + /** + * @dataProvider cookieParserDataProvider + */ + public function testParseCookie($cookie, $parsed) + { + foreach ((array) $cookie as $v) { + $c = SetCookie::fromString($v); + $p = $c->toArray(); + + if (isset($p['Expires'])) { + $delta = 40; + $parsedExpires = \is_numeric($parsed['Expires']) ? $parsed['Expires'] : \strtotime($parsed['Expires']); + self::assertLessThan($delta, \abs($p['Expires'] - $parsedExpires), 'Comparing Expires '.\var_export($p['Expires'], true).' : '.\var_export($parsed, true).' | '.\var_export($p, true)); + unset($p['Expires']); + unset($parsed['Expires']); + } + + if (!empty($parsed)) { + foreach ($parsed as $key => $value) { + self::assertEquals($parsed[$key], $p[$key], 'Comparing '.$key.' '.\var_export($value, true).' : '.\var_export($parsed, true).' | '.\var_export($p, true)); + } + foreach ($p as $key => $value) { + self::assertEquals($p[$key], $parsed[$key], 'Comparing '.$key.' '.\var_export($value, true).' : '.\var_export($parsed, true).' | '.\var_export($p, true)); + } + } else { + self::assertSame([ + 'Name' => null, + 'Value' => null, + 'Domain' => null, + 'Path' => '/', + 'Max-Age' => null, + 'Expires' => null, + 'Secure' => false, + 'Discard' => false, + 'HttpOnly' => false, + ], $p); + } + } + } + + /** + * Provides the data for testing isExpired + * + * @return array + */ + public function isExpiredProvider() + { + return [ + [ + 'FOO=bar; expires=Thu, 01 Jan 1970 00:00:00 GMT;', + true, + ], + [ + 'FOO=bar; expires=Thu, 01 Jan 1970 00:00:01 GMT;', + true, + ], + [ + 'FOO=bar; expires='.\date(\DateTime::RFC1123, \time() + 10).';', + false, + ], + [ + 'FOO=bar; expires='.\date(\DateTime::RFC1123, \time() - 10).';', + true, + ], + [ + 'FOO=bar;', + false, + ], + ]; + } + + /** + * @dataProvider isExpiredProvider + */ + public function testIsExpired($cookie, $expired) + { + self::assertSame( + $expired, + SetCookie::fromString($cookie)->isExpired() + ); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/BadResponseExceptionTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/BadResponseExceptionTest.php new file mode 100644 index 0000000000..dced34d1de --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/BadResponseExceptionTest.php @@ -0,0 +1,24 @@ +getRequest()); + self::assertSame($response, $e->getResponse()); + self::assertTrue($e->hasResponse()); + self::assertSame('foo', $e->getMessage()); + self::assertSame($prev, $e->getPrevious()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/ConnectExceptionTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/ConnectExceptionTest.php new file mode 100644 index 0000000000..5b9d06e134 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/ConnectExceptionTest.php @@ -0,0 +1,28 @@ + 'bar']); + self::assertInstanceOf(NetworkExceptionInterface::class, $e); + self::assertNotInstanceOf(RequestExceptionInterface::class, $e); + self::assertSame($req, $e->getRequest()); + self::assertSame('foo', $e->getMessage()); + self::assertSame('bar', $e->getHandlerContext()['foo']); + self::assertSame($prev, $e->getPrevious()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/RequestExceptionTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/RequestExceptionTest.php new file mode 100644 index 0000000000..a17ff7fab0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Exception/RequestExceptionTest.php @@ -0,0 +1,196 @@ +getRequest()); + self::assertSame($res, $e->getResponse()); + self::assertTrue($e->hasResponse()); + self::assertSame('foo', $e->getMessage()); + } + + public function testCreatesGenerateException() + { + $e = RequestException::create(new Request('GET', '/')); + self::assertSame('Error completing request', $e->getMessage()); + self::assertInstanceOf(RequestException::class, $e); + } + + public function testCreatesClientErrorResponseException() + { + $e = RequestException::create(new Request('GET', '/'), new Response(400)); + self::assertStringContainsString( + 'GET /', + $e->getMessage() + ); + self::assertStringContainsString( + '400 Bad Request', + $e->getMessage() + ); + self::assertInstanceOf(ClientException::class, $e); + } + + public function testCreatesServerErrorResponseException() + { + $e = RequestException::create(new Request('GET', '/'), new Response(500)); + self::assertStringContainsString( + 'GET /', + $e->getMessage() + ); + self::assertStringContainsString( + '500 Internal Server Error', + $e->getMessage() + ); + self::assertInstanceOf(ServerException::class, $e); + } + + public function testCreatesGenericErrorResponseException() + { + $e = RequestException::create(new Request('GET', '/'), new Response(300)); + self::assertStringContainsString( + 'GET /', + $e->getMessage() + ); + self::assertStringContainsString( + '300 ', + $e->getMessage() + ); + self::assertInstanceOf(RequestException::class, $e); + } + + public function testThrowsInvalidArgumentExceptionOnOutOfBoundsResponseCode() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Status code must be an integer value between 1xx and 5xx.'); + + throw RequestException::create(new Request('GET', '/'), new Response(600)); + } + + public function dataPrintableResponses() + { + return [ + ['You broke the test!'], + ['

zlomený zkouška

'], + ['{"tester": "Philépe Gonzalez"}'], + ["\n\tYour friendly test\n"], + ['document.body.write("here comes a test");'], + ["body:before {\n\tcontent: 'test style';\n}"], + ]; + } + + /** + * @dataProvider dataPrintableResponses + */ + public function testCreatesExceptionWithPrintableBodySummary($content) + { + $response = new Response( + 500, + [], + $content + ); + $e = RequestException::create(new Request('GET', '/'), $response); + self::assertStringContainsString( + $content, + $e->getMessage() + ); + self::assertInstanceOf(RequestException::class, $e); + } + + public function testCreatesExceptionWithTruncatedSummary() + { + $content = \str_repeat('+', 121); + $response = new Response(500, [], $content); + $e = RequestException::create(new Request('GET', '/'), $response); + $expected = \str_repeat('+', 120).' (truncated...)'; + self::assertStringContainsString($expected, $e->getMessage()); + } + + public function testExceptionMessageIgnoresEmptyBody() + { + $e = RequestException::create(new Request('GET', '/'), new Response(500)); + self::assertStringEndsWith('response', $e->getMessage()); + } + + public function testHasStatusCodeAsExceptionCode() + { + $e = RequestException::create(new Request('GET', '/'), new Response(442)); + self::assertSame(442, $e->getCode()); + } + + public function testWrapsRequestExceptions() + { + $e = new \Exception('foo'); + $r = new Request('GET', 'http://www.oo.com'); + $ex = RequestException::wrapException($r, $e); + self::assertInstanceOf(RequestException::class, $ex); + self::assertSame($e, $ex->getPrevious()); + } + + public function testDoesNotWrapExistingRequestExceptions() + { + $r = new Request('GET', 'http://www.oo.com'); + $e = new RequestException('foo', $r); + $e2 = RequestException::wrapException($r, $e); + self::assertSame($e, $e2); + } + + public function testCanProvideHandlerContext() + { + $r = new Request('GET', 'http://www.oo.com'); + $e = new RequestException('foo', $r, null, null, ['bar' => 'baz']); + self::assertSame(['bar' => 'baz'], $e->getHandlerContext()); + } + + public function testObfuscateUrlWithUsername() + { + $r = new Request('GET', 'http://username@www.oo.com'); + $e = RequestException::create($r, new Response(500)); + self::assertStringContainsString('http://username@www.oo.com', $e->getMessage()); + } + + public function testObfuscateUrlWithUsernameAndPassword() + { + $r = new Request('GET', 'http://user:password@www.oo.com'); + $e = RequestException::create($r, new Response(500)); + self::assertStringContainsString('http://user:***@www.oo.com', $e->getMessage()); + } +} + +final class ReadSeekOnlyStream extends Stream +{ + public function __construct() + { + parent::__construct(\fopen('php://memory', 'wb')); + } + + public function isSeekable(): bool + { + return true; + } + + public function isReadable(): bool + { + return false; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlFactoryTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlFactoryTest.php new file mode 100644 index 0000000000..a5b8f3f68e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlFactoryTest.php @@ -0,0 +1,946 @@ + 'Bar', + 'Baz' => 'bam', + 'Content-Length' => 2, + ], 'hi'), + ]); + $stream = Psr7\Utils::streamFor(); + $request = new Psr7\Request('PUT', Server::$url, [ + 'Hi' => ' 123', + 'Content-Length' => '7', + ], 'testing'); + $f = new CurlFactory(3); + $result = $f->create($request, ['sink' => $stream]); + self::assertInstanceOf(EasyHandle::class, $result); + if (\PHP_VERSION_ID >= 80000) { + self::assertInstanceOf(\CurlHandle::class, $result->handle); + } else { + self::assertIsResource($result->handle); + } + self::assertIsArray($result->headers); + self::assertSame($stream, $result->sink); + \curl_close($result->handle); + self::assertSame('PUT', $_SERVER['_curl'][\CURLOPT_CUSTOMREQUEST]); + self::assertSame( + 'http://127.0.0.1:8126/', + $_SERVER['_curl'][\CURLOPT_URL] + ); + // Sends via post fields when the request is small enough + self::assertSame('testing', $_SERVER['_curl'][\CURLOPT_POSTFIELDS]); + self::assertEquals(0, $_SERVER['_curl'][\CURLOPT_RETURNTRANSFER]); + self::assertEquals(0, $_SERVER['_curl'][\CURLOPT_HEADER]); + self::assertSame(300, $_SERVER['_curl'][\CURLOPT_CONNECTTIMEOUT]); + self::assertInstanceOf('Closure', $_SERVER['_curl'][\CURLOPT_HEADERFUNCTION]); + if (\defined('CURLOPT_PROTOCOLS')) { + self::assertSame( + \CURLPROTO_HTTP | \CURLPROTO_HTTPS, + $_SERVER['_curl'][\CURLOPT_PROTOCOLS] + ); + } + self::assertContains('Expect:', $_SERVER['_curl'][\CURLOPT_HTTPHEADER]); + self::assertContains('Accept:', $_SERVER['_curl'][\CURLOPT_HTTPHEADER]); + self::assertContains('Content-Type:', $_SERVER['_curl'][\CURLOPT_HTTPHEADER]); + self::assertContains('Hi: 123', $_SERVER['_curl'][\CURLOPT_HTTPHEADER]); + self::assertContains('Host: 127.0.0.1:8126', $_SERVER['_curl'][\CURLOPT_HTTPHEADER]); + } + + public function testSendsHeadRequests() + { + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $a = new Handler\CurlMultiHandler(); + $response = $a(new Psr7\Request('HEAD', Server::$url), []); + $response->wait(); + self::assertTrue($_SERVER['_curl'][\CURLOPT_NOBODY]); + $checks = [\CURLOPT_READFUNCTION, \CURLOPT_FILE, \CURLOPT_INFILE]; + foreach ($checks as $check) { + self::assertArrayNotHasKey($check, $_SERVER['_curl']); + } + self::assertEquals('HEAD', Server::received()[0]->getMethod()); + } + + public function testCanAddCustomCurlOptions() + { + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $a = new Handler\CurlMultiHandler(); + $req = new Psr7\Request('GET', Server::$url); + $a($req, ['curl' => [\CURLOPT_LOW_SPEED_LIMIT => 10]]); + self::assertEquals(10, $_SERVER['_curl'][\CURLOPT_LOW_SPEED_LIMIT]); + } + + public function testCanChangeCurlOptions() + { + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $a = new Handler\CurlMultiHandler(); + $req = new Psr7\Request('GET', Server::$url); + $a($req, ['curl' => [\CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_1_0]]); + self::assertEquals(\CURL_HTTP_VERSION_1_0, $_SERVER['_curl'][\CURLOPT_HTTP_VERSION]); + } + + public function testValidatesVerify() + { + $f = new CurlFactory(3); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('SSL CA bundle not found: /does/not/exist'); + $f->create(new Psr7\Request('GET', Server::$url), ['verify' => '/does/not/exist']); + } + + public function testCanSetVerifyToFile() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', 'http://foo.com'), ['verify' => __FILE__]); + self::assertEquals(__FILE__, $_SERVER['_curl'][\CURLOPT_CAINFO]); + self::assertEquals(2, $_SERVER['_curl'][\CURLOPT_SSL_VERIFYHOST]); + self::assertTrue($_SERVER['_curl'][\CURLOPT_SSL_VERIFYPEER]); + } + + public function testCanSetVerifyToDir() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', 'http://foo.com'), ['verify' => __DIR__]); + self::assertEquals(__DIR__, $_SERVER['_curl'][\CURLOPT_CAPATH]); + self::assertEquals(2, $_SERVER['_curl'][\CURLOPT_SSL_VERIFYHOST]); + self::assertTrue($_SERVER['_curl'][\CURLOPT_SSL_VERIFYPEER]); + } + + public function testAddsVerifyAsTrue() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['verify' => true]); + self::assertEquals(2, $_SERVER['_curl'][\CURLOPT_SSL_VERIFYHOST]); + self::assertTrue($_SERVER['_curl'][\CURLOPT_SSL_VERIFYPEER]); + self::assertArrayNotHasKey(\CURLOPT_CAINFO, $_SERVER['_curl']); + } + + public function testCanDisableVerify() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['verify' => false]); + self::assertEquals(0, $_SERVER['_curl'][\CURLOPT_SSL_VERIFYHOST]); + self::assertFalse($_SERVER['_curl'][\CURLOPT_SSL_VERIFYPEER]); + } + + public function testAddsProxy() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['proxy' => 'http://bar.com']); + self::assertEquals('http://bar.com', $_SERVER['_curl'][\CURLOPT_PROXY]); + } + + public function testAddsViaScheme() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), [ + 'proxy' => ['http' => 'http://bar.com', 'https' => 'https://t'], + ]); + self::assertEquals('http://bar.com', $_SERVER['_curl'][\CURLOPT_PROXY]); + $this->checkNoProxyForHost('http://test.test.com', ['test.test.com'], false); + $this->checkNoProxyForHost('http://test.test.com', ['.test.com'], false); + $this->checkNoProxyForHost('http://test.test.com', ['*.test.com'], true); + $this->checkNoProxyForHost('http://test.test.com', ['*'], false); + $this->checkNoProxyForHost('http://127.0.0.1', ['127.0.0.*'], true); + } + + private function checkNoProxyForHost($url, $noProxy, $assertUseProxy) + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', $url), [ + 'proxy' => [ + 'http' => 'http://bar.com', + 'https' => 'https://t', + 'no' => $noProxy, + ], + ]); + if ($assertUseProxy) { + self::assertArrayHasKey(\CURLOPT_PROXY, $_SERVER['_curl']); + } else { + self::assertArrayNotHasKey(\CURLOPT_PROXY, $_SERVER['_curl']); + } + } + + public function testUsesProxy() + { + Server::flush(); + Server::enqueue([ + new Psr7\Response(200, [ + 'Foo' => 'Bar', + 'Baz' => 'bam', + 'Content-Length' => 2, + ], 'hi'), + ]); + + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', 'http://www.example.com', [], null, '1.0'); + $promise = $handler($request, [ + 'proxy' => Server::$url, + ]); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('2', $response->getHeaderLine('Content-Length')); + self::assertSame('hi', (string) $response->getBody()); + } + + public function testValidatesCryptoMethodInvalidMethod() + { + $f = new CurlFactory(3); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid crypto_method request option: unknown version provided'); + $f->create(new Psr7\Request('GET', Server::$url), ['crypto_method' => 123]); + } + + public function testAddsCryptoMethodTls10() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT]); + self::assertEquals(\CURL_SSLVERSION_TLSv1_0, $_SERVER['_curl'][\CURLOPT_SSLVERSION]); + } + + public function testAddsCryptoMethodTls11() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT]); + self::assertEquals(\CURL_SSLVERSION_TLSv1_1, $_SERVER['_curl'][\CURLOPT_SSLVERSION]); + } + + public function testAddsCryptoMethodTls12() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT]); + self::assertEquals(\CURL_SSLVERSION_TLSv1_2, $_SERVER['_curl'][\CURLOPT_SSLVERSION]); + } + + /** + * @requires PHP >= 7.4 + */ + public function testAddsCryptoMethodTls13() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT]); + self::assertEquals(\CURL_SSLVERSION_TLSv1_3, $_SERVER['_curl'][\CURLOPT_SSLVERSION]); + } + + public function testValidatesSslKey() + { + $f = new CurlFactory(3); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('SSL private key not found: /does/not/exist'); + $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => '/does/not/exist']); + } + + public function testAddsSslKey() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => __FILE__]); + self::assertEquals(__FILE__, $_SERVER['_curl'][\CURLOPT_SSLKEY]); + } + + public function testAddsSslKeyWithPassword() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => [__FILE__, 'test']]); + self::assertEquals(__FILE__, $_SERVER['_curl'][\CURLOPT_SSLKEY]); + self::assertEquals('test', $_SERVER['_curl'][\CURLOPT_SSLKEYPASSWD]); + } + + public function testAddsSslKeyWhenUsingArraySyntaxButNoPassword() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['ssl_key' => [__FILE__]]); + + self::assertEquals(__FILE__, $_SERVER['_curl'][\CURLOPT_SSLKEY]); + } + + public function testValidatesCert() + { + $f = new CurlFactory(3); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('SSL certificate not found: /does/not/exist'); + $f->create(new Psr7\Request('GET', Server::$url), ['cert' => '/does/not/exist']); + } + + public function testAddsCert() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['cert' => __FILE__]); + self::assertEquals(__FILE__, $_SERVER['_curl'][\CURLOPT_SSLCERT]); + } + + public function testAddsCertWithPassword() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['cert' => [__FILE__, 'test']]); + self::assertEquals(__FILE__, $_SERVER['_curl'][\CURLOPT_SSLCERT]); + self::assertEquals('test', $_SERVER['_curl'][\CURLOPT_SSLCERTPASSWD]); + } + + public function testAddsDerCert() + { + $certFile = tempnam(sys_get_temp_dir(), 'mock_test_cert'); + rename($certFile, $certFile .= '.der'); + try { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['cert' => $certFile]); + self::assertArrayHasKey(\CURLOPT_SSLCERTTYPE, $_SERVER['_curl']); + self::assertEquals('DER', $_SERVER['_curl'][\CURLOPT_SSLCERTTYPE]); + } finally { + @\unlink($certFile); + } + } + + public function testAddsP12Cert() + { + $certFile = tempnam(sys_get_temp_dir(), 'mock_test_cert'); + rename($certFile, $certFile .= '.p12'); + try { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), ['cert' => $certFile]); + self::assertArrayHasKey(\CURLOPT_SSLCERTTYPE, $_SERVER['_curl']); + self::assertEquals('P12', $_SERVER['_curl'][\CURLOPT_SSLCERTTYPE]); + } finally { + @\unlink($certFile); + } + } + + public function testValidatesProgress() + { + $f = new CurlFactory(3); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('progress client option must be callable'); + $f->create(new Psr7\Request('GET', Server::$url), ['progress' => 'foo']); + } + + public function testEmitsDebugInfoToStream() + { + $res = \fopen('php://temp', 'r+'); + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $a = new Handler\CurlMultiHandler(); + $response = $a(new Psr7\Request('HEAD', Server::$url), ['debug' => $res]); + $response->wait(); + \rewind($res); + $output = \str_replace("\r", '', \stream_get_contents($res)); + self::assertStringContainsString('> HEAD / HTTP/1.1', $output); + self::assertStringContainsString('< HTTP/1.1 200', $output); + \fclose($res); + } + + public function testEmitsProgressToFunction() + { + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $a = new Handler\CurlMultiHandler(); + $called = []; + $request = new Psr7\Request('HEAD', Server::$url); + $response = $a($request, [ + 'progress' => static function (...$args) use (&$called) { + $called[] = $args; + }, + ]); + $response->wait(); + self::assertNotEmpty($called); + foreach ($called as $call) { + self::assertCount(4, $call); + } + } + + private function addDecodeResponse($withEncoding = true) + { + $content = \gzencode('test'); + $headers = ['Content-Length' => \strlen($content)]; + if ($withEncoding) { + $headers['Content-Encoding'] = 'gzip'; + } + $response = new Psr7\Response(200, $headers, $content); + Server::flush(); + Server::enqueue([$response]); + + return $content; + } + + public function testDecodesGzippedResponses() + { + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $response = $handler($request, ['decode_content' => true]); + $response = $response->wait(); + self::assertEquals('test', (string) $response->getBody()); + self::assertEquals('', $_SERVER['_curl'][\CURLOPT_ENCODING]); + $sent = Server::received()[0]; + self::assertFalse($sent->hasHeader('Accept-Encoding')); + } + + public function testReportsOriginalSizeAndContentEncodingAfterDecoding() + { + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $response = $handler($request, ['decode_content' => true]); + $response = $response->wait(); + self::assertSame( + 'gzip', + $response->getHeaderLine('x-encoded-content-encoding') + ); + self::assertSame( + \strlen(\gzencode('test')), + (int) $response->getHeaderLine('x-encoded-content-length') + ); + } + + public function testDecodesGzippedResponsesWithHeader() + { + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url, ['Accept-Encoding' => 'gzip']); + $response = $handler($request, ['decode_content' => true]); + $response = $response->wait(); + self::assertEquals('gzip', $_SERVER['_curl'][\CURLOPT_ENCODING]); + $sent = Server::received()[0]; + self::assertEquals('gzip', $sent->getHeaderLine('Accept-Encoding')); + self::assertEquals('test', (string) $response->getBody()); + self::assertFalse($response->hasHeader('content-encoding')); + self::assertTrue( + !$response->hasHeader('content-length') + || $response->getHeaderLine('content-length') == $response->getBody()->getSize() + ); + } + + /** + * https://github.com/guzzle/guzzle/issues/2799 + */ + public function testDecodesGzippedResponsesWithHeaderForHeadRequest() + { + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('HEAD', Server::$url, ['Accept-Encoding' => 'gzip']); + $response = $handler($request, ['decode_content' => true]); + $response = $response->wait(); + self::assertEquals('gzip', $_SERVER['_curl'][\CURLOPT_ENCODING]); + $sent = Server::received()[0]; + self::assertEquals('gzip', $sent->getHeaderLine('Accept-Encoding')); + + // Verify that the content-length matches the encoded size. + self::assertTrue( + !$response->hasHeader('content-length') + || $response->getHeaderLine('content-length') == \strlen(\gzencode('test')) + ); + } + + public function testDoesNotForceDecode() + { + $content = $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $response = $handler($request, ['decode_content' => false]); + $response = $response->wait(); + $sent = Server::received()[0]; + self::assertFalse($sent->hasHeader('Accept-Encoding')); + self::assertEquals($content, (string) $response->getBody()); + } + + public function testProtocolVersion() + { + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $a = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url, [], null, '1.0'); + $a($request, []); + self::assertEquals(\CURL_HTTP_VERSION_1_0, $_SERVER['_curl'][\CURLOPT_HTTP_VERSION]); + } + + public function testSavesToStream() + { + $stream = \fopen('php://memory', 'r+'); + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $response = $handler($request, [ + 'decode_content' => true, + 'sink' => $stream, + ]); + $response->wait(); + \rewind($stream); + self::assertEquals('test', \stream_get_contents($stream)); + } + + public function testSavesToGuzzleStream() + { + $stream = Psr7\Utils::streamFor(); + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $response = $handler($request, [ + 'decode_content' => true, + 'sink' => $stream, + ]); + $response->wait(); + self::assertEquals('test', (string) $stream); + } + + public function testSavesToFileOnDisk() + { + $tmpfile = \tempnam(\sys_get_temp_dir(), 'testfile'); + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $response = $handler($request, [ + 'decode_content' => true, + 'sink' => $tmpfile, + ]); + $response->wait(); + self::assertStringEqualsFile($tmpfile, 'test'); + @\unlink($tmpfile); + } + + public function testDoesNotAddMultipleContentLengthHeaders() + { + $this->addDecodeResponse(); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('PUT', Server::$url, ['Content-Length' => 3], 'foo'); + $response = $handler($request, []); + $response->wait(); + $sent = Server::received()[0]; + self::assertEquals(3, $sent->getHeaderLine('Content-Length')); + self::assertFalse($sent->hasHeader('Transfer-Encoding')); + self::assertEquals('foo', (string) $sent->getBody()); + } + + public function testSendsPostWithNoBodyOrDefaultContentType() + { + Server::flush(); + Server::enqueue([new Psr7\Response()]); + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('POST', Server::$url); + $response = $handler($request, []); + $response->wait(); + $received = Server::received()[0]; + self::assertEquals('POST', $received->getMethod()); + self::assertFalse($received->hasHeader('content-type')); + self::assertSame('0', $received->getHeaderLine('content-length')); + } + + public function testFailsWhenCannotRewindRetryAfterNoResponse() + { + $factory = new CurlFactory(1); + $stream = Psr7\Utils::streamFor('abc'); + $stream->read(1); + $stream = new Psr7\NoSeekStream($stream); + $request = new Psr7\Request('PUT', Server::$url, [], $stream); + $fn = static function ($request, $options) use (&$fn, $factory) { + $easy = $factory->create($request, $options); + + return CurlFactory::finish($fn, $easy, $factory); + }; + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('but attempting to rewind the request body failed'); + $fn($request, [])->wait(); + } + + public function testRetriesWhenBodyCanBeRewound() + { + $callHandler = $called = false; + + $fn = static function ($r, $options) use (&$callHandler) { + $callHandler = true; + + return P\Create::promiseFor(new Psr7\Response()); + }; + + $bd = Psr7\FnStream::decorate(Psr7\Utils::streamFor('test'), [ + 'tell' => static function () { + return 1; + }, + 'rewind' => static function () use (&$called) { + $called = true; + }, + ]); + + $factory = new CurlFactory(1); + $req = new Psr7\Request('PUT', Server::$url, [], $bd); + $easy = $factory->create($req, []); + $res = CurlFactory::finish($fn, $easy, $factory); + $res = $res->wait(); + self::assertTrue($callHandler); + self::assertTrue($called); + self::assertEquals('200', $res->getStatusCode()); + } + + public function testFailsWhenRetryMoreThanThreeTimes() + { + $factory = new CurlFactory(1); + $call = 0; + $fn = static function ($request, $options) use (&$mock, &$call, $factory) { + ++$call; + $easy = $factory->create($request, $options); + + return CurlFactory::finish($mock, $easy, $factory); + }; + $mock = new Handler\MockHandler([$fn, $fn, $fn]); + $p = $mock(new Psr7\Request('PUT', Server::$url, [], 'test'), []); + $p->wait(false); + self::assertEquals(3, $call); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('The cURL request was retried 3 times'); + $p->wait(true); + } + + public function testHandles100Continue() + { + Server::flush(); + Server::enqueue([ + new Psr7\Response(200, ['Test' => 'Hello', 'Content-Length' => 4], 'test'), + ]); + $request = new Psr7\Request('PUT', Server::$url, [ + 'Expect' => '100-Continue', + ], 'test'); + $handler = new Handler\CurlMultiHandler(); + $response = $handler($request, [])->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('Hello', $response->getHeaderLine('Test')); + self::assertSame('4', $response->getHeaderLine('Content-Length')); + self::assertSame('test', (string) $response->getBody()); + } + + public function testCreatesConnectException() + { + $m = new \ReflectionMethod(CurlFactory::class, 'finishError'); + $m->setAccessible(true); + $factory = new CurlFactory(1); + $easy = $factory->create(new Psr7\Request('GET', Server::$url), []); + $easy->errno = \CURLE_COULDNT_CONNECT; + $response = $m->invoke( + null, + static function () { + }, + $easy, + $factory + ); + + $this->expectException(ConnectException::class); + $response->wait(); + } + + public function testAddsTimeouts() + { + $f = new CurlFactory(3); + $f->create(new Psr7\Request('GET', Server::$url), [ + 'timeout' => 0.1, + 'connect_timeout' => 0.2, + ]); + self::assertEquals(100, $_SERVER['_curl'][\CURLOPT_TIMEOUT_MS]); + self::assertEquals(200, $_SERVER['_curl'][\CURLOPT_CONNECTTIMEOUT_MS]); + } + + public function testAddsStreamingBody() + { + $f = new CurlFactory(3); + $bd = Psr7\FnStream::decorate(Psr7\Utils::streamFor('foo'), [ + 'getSize' => static function () { + return null; + }, + ]); + $request = new Psr7\Request('PUT', Server::$url, [], $bd); + $f->create($request, []); + self::assertEquals(1, $_SERVER['_curl'][\CURLOPT_UPLOAD]); + self::assertIsCallable($_SERVER['_curl'][\CURLOPT_READFUNCTION]); + } + + public function testEnsuresDirExistsBeforeThrowingWarning() + { + $f = new CurlFactory(3); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Directory /does/not/exist/so does not exist for sink value of /does/not/exist/so/error.txt'); + $f->create(new Psr7\Request('GET', Server::$url), [ + 'sink' => '/does/not/exist/so/error.txt', + ]); + } + + public function testClosesIdleHandles() + { + $f = new CurlFactory(3); + $req = new Psr7\Request('GET', Server::$url); + $easy = $f->create($req, []); + $h1 = $easy->handle; + $f->release($easy); + self::assertCount(1, Helpers::readObjectAttribute($f, 'handles')); + $easy = $f->create($req, []); + self::assertSame($easy->handle, $h1); + $easy2 = $f->create($req, []); + $easy3 = $f->create($req, []); + $easy4 = $f->create($req, []); + $f->release($easy); + self::assertCount(1, Helpers::readObjectAttribute($f, 'handles')); + $f->release($easy2); + self::assertCount(2, Helpers::readObjectAttribute($f, 'handles')); + $f->release($easy3); + self::assertCount(3, Helpers::readObjectAttribute($f, 'handles')); + $f->release($easy4); + self::assertCount(3, Helpers::readObjectAttribute($f, 'handles')); + } + + public function testRejectsPromiseWhenCreateResponseFails() + { + Server::flush(); + Server::enqueueRaw(999, 'Incorrect', ['X-Foo' => 'bar'], 'abc 123'); + + $req = new Psr7\Request('GET', Server::$url); + $handler = new Handler\CurlHandler(); + $promise = $handler($req, []); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered while creating the response'); + $promise->wait(); + } + + public function testEnsuresOnHeadersIsCallable() + { + $req = new Psr7\Request('GET', Server::$url); + $handler = new Handler\CurlHandler(); + + $this->expectException(\InvalidArgumentException::class); + $handler($req, ['on_headers' => 'error!']); + } + + public function testRejectsPromiseWhenOnHeadersFails() + { + Server::flush(); + Server::enqueue([ + new Psr7\Response(200, ['X-Foo' => 'bar'], 'abc 123'), + ]); + $req = new Psr7\Request('GET', Server::$url); + $handler = new Handler\CurlHandler(); + $promise = $handler($req, [ + 'on_headers' => static function () { + throw new \Exception('test'); + }, + ]); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered during the on_headers event'); + $promise->wait(); + } + + public function testSuccessfullyCallsOnHeadersBeforeWritingToSink() + { + Server::flush(); + Server::enqueue([ + new Psr7\Response(200, ['X-Foo' => 'bar'], 'abc 123'), + ]); + $req = new Psr7\Request('GET', Server::$url); + $got = null; + + $stream = Psr7\Utils::streamFor(); + $stream = Psr7\FnStream::decorate($stream, [ + 'write' => static function ($data) use ($stream, &$got) { + self::assertNotNull($got); + + return $stream->write($data); + }, + ]); + + $handler = new Handler\CurlHandler(); + $promise = $handler($req, [ + 'sink' => $stream, + 'on_headers' => static function (ResponseInterface $res) use (&$got) { + $got = $res; + self::assertEquals('bar', $res->getHeaderLine('X-Foo')); + }, + ]); + + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('bar', $response->getHeaderLine('X-Foo')); + self::assertSame('abc 123', (string) $response->getBody()); + } + + public function testInvokesOnStatsOnSuccess() + { + Server::flush(); + Server::enqueue([new Psr7\Response(200)]); + $req = new Psr7\Request('GET', Server::$url); + $gotStats = null; + $handler = new Handler\CurlHandler(); + $promise = $handler($req, [ + 'on_stats' => static function (TransferStats $stats) use (&$gotStats) { + $gotStats = $stats; + }, + ]); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame(200, $gotStats->getResponse()->getStatusCode()); + self::assertSame( + Server::$url, + (string) $gotStats->getEffectiveUri() + ); + self::assertSame( + Server::$url, + (string) $gotStats->getRequest()->getUri() + ); + self::assertGreaterThan(0, $gotStats->getTransferTime()); + self::assertArrayHasKey('appconnect_time', $gotStats->getHandlerStats()); + } + + public function testInvokesOnStatsOnError() + { + $req = new Psr7\Request('GET', 'http://127.0.0.1:123'); + $gotStats = null; + $handler = new Handler\CurlHandler(); + $promise = $handler($req, [ + 'connect_timeout' => 0.001, + 'timeout' => 0.001, + 'on_stats' => static function (TransferStats $stats) use (&$gotStats) { + $gotStats = $stats; + }, + ]); + $promise->wait(false); + self::assertFalse($gotStats->hasResponse()); + self::assertSame( + 'http://127.0.0.1:123', + (string) $gotStats->getEffectiveUri() + ); + self::assertSame( + 'http://127.0.0.1:123', + (string) $gotStats->getRequest()->getUri() + ); + self::assertIsFloat($gotStats->getTransferTime()); + self::assertIsInt($gotStats->getHandlerErrorData()); + self::assertArrayHasKey('appconnect_time', $gotStats->getHandlerStats()); + } + + public function testRewindsBodyIfPossible() + { + $body = Psr7\Utils::streamFor(\str_repeat('x', 1024 * 1024 * 2)); + $body->seek(1024 * 1024); + self::assertSame(1024 * 1024, $body->tell()); + + $req = new Psr7\Request('POST', 'https://www.example.com', [ + 'Content-Length' => 1024 * 1024 * 2, + ], $body); + $factory = new CurlFactory(1); + $factory->create($req, []); + + self::assertSame(0, $body->tell()); + } + + public function testDoesNotRewindUnseekableBody() + { + $body = Psr7\Utils::streamFor(\str_repeat('x', 1024 * 1024 * 2)); + $body->seek(1024 * 1024); + $body = new Psr7\NoSeekStream($body); + self::assertSame(1024 * 1024, $body->tell()); + + $req = new Psr7\Request('POST', 'https://www.example.com', [ + 'Content-Length' => 1024 * 1024, + ], $body); + $factory = new CurlFactory(1); + $factory->create($req, []); + + self::assertSame(1024 * 1024, $body->tell()); + } + + public function testRelease() + { + $factory = new CurlFactory(1); + $easyHandle = new EasyHandle(); + $easyHandle->handle = \curl_init(); + + self::assertEmpty($factory->release($easyHandle)); + } + + /** + * https://github.com/guzzle/guzzle/issues/2735 + */ + public function testBodyEofOnWindows() + { + $expectedLength = 4097; + + Server::flush(); + Server::enqueue([ + new Psr7\Response(200, [ + 'Content-Length' => $expectedLength, + ], \str_repeat('x', $expectedLength)), + ]); + + $handler = new Handler\CurlMultiHandler(); + $request = new Psr7\Request('GET', Server::$url); + $promise = $handler($request, []); + $response = $promise->wait(); + $body = $response->getBody(); + + $actualLength = 0; + while (!$body->eof()) { + $chunk = $body->read(4096); + $actualLength += \strlen($chunk); + } + self::assertSame($expectedLength, $actualLength); + } + + public function testHandlesGarbageHttpServerGracefully() + { + $a = new Handler\CurlMultiHandler(); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('cURL error 1: Received HTTP/0.9 when not allowed'); + + $a(new Psr7\Request('GET', Server::$url.'guzzle-server/garbage'), [])->wait(); + } + + public function testHandlesInvalidStatusCodeGracefully() + { + $a = new Handler\CurlMultiHandler(); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered while creating the response'); + + $a(new Psr7\Request('GET', Server::$url.'guzzle-server/bad-status'), [])->wait(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlHandlerTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlHandlerTest.php new file mode 100644 index 0000000000..c4a77efffe --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlHandlerTest.php @@ -0,0 +1,101 @@ +expectException(ConnectException::class); + $this->expectExceptionMessage('cURL'); + $handler($request, ['timeout' => 0.001, 'connect_timeout' => 0.001])->wait(); + } + + public function testRedactsUserInfoInErrors() + { + $handler = new CurlHandler(); + $request = new Request('GET', 'http://my_user:secretPass@localhost:123'); + + try { + $handler($request, ['timeout' => 0.001, 'connect_timeout' => 0.001])->wait(); + $this->fail('Must throw an Exception.'); + } catch (\Throwable $e) { + $this->assertStringNotContainsString('secretPass', $e->getMessage()); + } + } + + public function testReusesHandles() + { + Server::flush(); + $response = new Response(200); + Server::enqueue([$response, $response]); + $a = new CurlHandler(); + $request = new Request('GET', Server::$url); + self::assertInstanceOf(FulfilledPromise::class, $a($request, [])); + self::assertInstanceOf(FulfilledPromise::class, $a($request, [])); + } + + public function testDoesSleep() + { + $response = new Response(200); + Server::enqueue([$response]); + $a = new CurlHandler(); + $request = new Request('GET', Server::$url); + $s = Utils::currentTime(); + $a($request, ['delay' => 0.1])->wait(); + self::assertGreaterThan(0.0001, Utils::currentTime() - $s); + } + + public function testCreatesCurlErrorsWithContext() + { + $handler = new CurlHandler(); + $request = new Request('GET', 'http://localhost:123'); + $called = false; + $p = $handler($request, ['timeout' => 0.001, 'connect_timeout' => 0.001]) + ->otherwise(static function (ConnectException $e) use (&$called) { + $called = true; + self::assertArrayHasKey('errno', $e->getHandlerContext()); + }); + $p->wait(); + self::assertTrue($called); + } + + public function testUsesContentLengthWhenOverInMemorySize() + { + Server::flush(); + Server::enqueue([new Response()]); + $stream = Psr7\Utils::streamFor(\str_repeat('.', 1000000)); + $handler = new CurlHandler(); + $request = new Request( + 'PUT', + Server::$url, + ['Content-Length' => 1000000], + $stream + ); + $handler($request, [])->wait(); + $received = Server::received()[0]; + self::assertEquals(1000000, $received->getHeaderLine('Content-Length')); + self::assertFalse($received->hasHeader('Transfer-Encoding')); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlMultiHandlerTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlMultiHandlerTest.php new file mode 100644 index 0000000000..e829af2727 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/CurlMultiHandlerTest.php @@ -0,0 +1,130 @@ + [ + \CURLMOPT_MAXCONNECTS => 5, + ]]); + $request = new Request('GET', Server::$url); + $a($request, []); + self::assertEquals(5, $_SERVER['_curl_multi'][\CURLMOPT_MAXCONNECTS]); + } + + public function testSendsRequest() + { + Server::enqueue([new Response()]); + $a = new CurlMultiHandler(); + $request = new Request('GET', Server::$url); + $response = $a($request, [])->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function testCreatesExceptions() + { + $a = new CurlMultiHandler(); + + $this->expectException(ConnectException::class); + $this->expectExceptionMessage('cURL error'); + $a(new Request('GET', 'http://localhost:123'), [])->wait(); + } + + public function testCanSetSelectTimeout() + { + $a = new CurlMultiHandler(['select_timeout' => 2]); + self::assertEquals(2, Helpers::readObjectAttribute($a, 'selectTimeout')); + } + + public function testCanCancel() + { + Server::flush(); + $response = new Response(200); + Server::enqueue(\array_fill_keys(\range(0, 10), $response)); + $a = new CurlMultiHandler(); + $responses = []; + for ($i = 0; $i < 10; ++$i) { + $response = $a(new Request('GET', Server::$url), []); + $response->cancel(); + $responses[] = $response; + } + + foreach ($responses as $r) { + self::assertTrue(P\Is::rejected($r)); + } + } + + public function testCannotCancelFinished() + { + Server::flush(); + Server::enqueue([new Response(200)]); + $a = new CurlMultiHandler(); + $response = $a(new Request('GET', Server::$url), []); + $response->wait(); + $response->cancel(); + self::assertTrue(P\Is::fulfilled($response)); + } + + public function testDelaysConcurrently() + { + Server::flush(); + Server::enqueue([new Response()]); + $a = new CurlMultiHandler(); + $expected = Utils::currentTime() + (100 / 1000); + $response = $a(new Request('GET', Server::$url), ['delay' => 100]); + $response->wait(); + self::assertGreaterThanOrEqual($expected, Utils::currentTime()); + } + + public function testUsesTimeoutEnvironmentVariables() + { + unset($_SERVER['GUZZLE_CURL_SELECT_TIMEOUT']); + \putenv('GUZZLE_CURL_SELECT_TIMEOUT='); + + try { + $a = new CurlMultiHandler(); + // Default if no options are given and no environment variable is set + self::assertEquals(1, Helpers::readObjectAttribute($a, 'selectTimeout')); + + \putenv('GUZZLE_CURL_SELECT_TIMEOUT=3'); + $a = new CurlMultiHandler(); + // Handler reads from the environment if no options are given + self::assertEquals(3, Helpers::readObjectAttribute($a, 'selectTimeout')); + } finally { + \putenv('GUZZLE_CURL_SELECT_TIMEOUT='); + } + } + + public function throwsWhenAccessingInvalidProperty() + { + $h = new CurlMultiHandler(); + + $this->expectException(\BadMethodCallException::class); + $h->foo; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/EasyHandleTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/EasyHandleTest.php new file mode 100644 index 0000000000..e9ad4e90fa --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/EasyHandleTest.php @@ -0,0 +1,22 @@ +handle); + + $this->expectException(\BadMethodCallException::class); + $this->expectExceptionMessage('The EasyHandle has been released'); + $easy->handle; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/MockHandlerTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/MockHandlerTest.php new file mode 100644 index 0000000000..842c68021e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/MockHandlerTest.php @@ -0,0 +1,262 @@ +wait()); + } + + public function testIsCountable() + { + $res = new Response(); + $mock = new MockHandler([$res, $res]); + self::assertCount(2, $mock); + } + + public function testEmptyHandlerIsCountable() + { + self::assertCount(0, new MockHandler()); + } + + public function testEnsuresEachAppendOnCreationIsValid() + { + $this->expectException(\TypeError::class); + new MockHandler(['a']); + } + + public function testEnsuresEachAppendIsValid() + { + $mock = new MockHandler(); + $this->expectException(\TypeError::class); + $mock->append(['a']); + } + + public function testCanQueueExceptions() + { + $e = new \Exception('a'); + $mock = new MockHandler([$e]); + $request = new Request('GET', 'http://example.com'); + $p = $mock($request, []); + try { + $p->wait(); + self::fail(); + } catch (\Exception $e2) { + self::assertSame($e, $e2); + } + } + + public function testCanGetLastRequestAndOptions() + { + $res = new Response(); + $mock = new MockHandler([$res]); + $request = new Request('GET', 'http://example.com'); + $mock($request, ['foo' => 'bar']); + self::assertSame($request, $mock->getLastRequest()); + self::assertSame(['foo' => 'bar'], $mock->getLastOptions()); + } + + public function testSinkFilename() + { + $filename = \sys_get_temp_dir().'/mock_test_'.\uniqid(); + $res = new Response(200, [], 'TEST CONTENT'); + $mock = new MockHandler([$res]); + $request = new Request('GET', '/'); + $p = $mock($request, ['sink' => $filename]); + $p->wait(); + + self::assertFileExists($filename); + self::assertStringEqualsFile($filename, 'TEST CONTENT'); + + \unlink($filename); + } + + public function testSinkResource() + { + $file = \tmpfile(); + $meta = \stream_get_meta_data($file); + $res = new Response(200, [], 'TEST CONTENT'); + $mock = new MockHandler([$res]); + $request = new Request('GET', '/'); + $p = $mock($request, ['sink' => $file]); + $p->wait(); + + self::assertFileExists($meta['uri']); + self::assertStringEqualsFile($meta['uri'], 'TEST CONTENT'); + } + + public function testSinkStream() + { + $stream = new Stream(\tmpfile()); + $res = new Response(200, [], 'TEST CONTENT'); + $mock = new MockHandler([$res]); + $request = new Request('GET', '/'); + $p = $mock($request, ['sink' => $stream]); + $p->wait(); + + self::assertFileExists($stream->getMetadata('uri')); + self::assertStringEqualsFile($stream->getMetadata('uri'), 'TEST CONTENT'); + } + + public function testCanEnqueueCallables() + { + $r = new Response(); + $fn = static function ($req, $o) use ($r) { + return $r; + }; + $mock = new MockHandler([$fn]); + $request = new Request('GET', 'http://example.com'); + $p = $mock($request, ['foo' => 'bar']); + self::assertSame($r, $p->wait()); + } + + public function testEnsuresOnHeadersIsCallable() + { + $res = new Response(); + $mock = new MockHandler([$res]); + $request = new Request('GET', 'http://example.com'); + + $this->expectException(\InvalidArgumentException::class); + $mock($request, ['on_headers' => 'error!']); + } + + public function testRejectsPromiseWhenOnHeadersFails() + { + $res = new Response(); + $mock = new MockHandler([$res]); + $request = new Request('GET', 'http://example.com'); + $promise = $mock($request, [ + 'on_headers' => static function () { + throw new \Exception('test'); + }, + ]); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered during the on_headers event'); + $promise->wait(); + } + + public function testInvokesOnFulfilled() + { + $res = new Response(); + $mock = new MockHandler([$res], static function ($v) use (&$c) { + $c = $v; + }); + $request = new Request('GET', 'http://example.com'); + $mock($request, [])->wait(); + self::assertSame($res, $c); + } + + public function testInvokesOnRejected() + { + $e = new \Exception('a'); + $c = null; + $mock = new MockHandler([$e], null, static function ($v) use (&$c) { + $c = $v; + }); + $request = new Request('GET', 'http://example.com'); + $mock($request, [])->wait(false); + self::assertSame($e, $c); + } + + public function testThrowsWhenNoMoreResponses() + { + $mock = new MockHandler(); + $request = new Request('GET', 'http://example.com'); + + $this->expectException(\OutOfBoundsException::class); + $mock($request, []); + } + + public function testCanCreateWithDefaultMiddleware() + { + $r = new Response(500); + $mock = MockHandler::createWithMiddleware([$r]); + $request = new Request('GET', 'http://example.com'); + + $this->expectException(BadResponseException::class); + $mock($request, ['http_errors' => true])->wait(); + } + + public function testInvokesOnStatsFunctionForResponse() + { + $res = new Response(); + $mock = new MockHandler([$res]); + $request = new Request('GET', 'http://example.com'); + /** @var TransferStats|null $stats */ + $stats = null; + $onStats = static function (TransferStats $s) use (&$stats) { + $stats = $s; + }; + $p = $mock($request, ['on_stats' => $onStats]); + $p->wait(); + self::assertSame($res, $stats->getResponse()); + self::assertSame($request, $stats->getRequest()); + } + + public function testInvokesOnStatsFunctionForError() + { + $e = new \Exception('a'); + $c = null; + $mock = new MockHandler([$e], null, static function ($v) use (&$c) { + $c = $v; + }); + $request = new Request('GET', 'http://example.com'); + + /** @var TransferStats|null $stats */ + $stats = null; + $onStats = static function (TransferStats $s) use (&$stats) { + $stats = $s; + }; + $mock($request, ['on_stats' => $onStats])->wait(false); + self::assertSame($e, $stats->getHandlerErrorData()); + self::assertNull($stats->getResponse()); + self::assertSame($request, $stats->getRequest()); + } + + public function testTransferTime() + { + $e = new \Exception('a'); + $c = null; + $mock = new MockHandler([$e], null, static function ($v) use (&$c) { + $c = $v; + }); + $request = new Request('GET', 'http://example.com'); + $stats = null; + $onStats = static function (TransferStats $s) use (&$stats) { + $stats = $s; + }; + $mock($request, ['on_stats' => $onStats, 'transfer_time' => 0.4])->wait(false); + self::assertEquals(0.4, $stats->getTransferTime()); + } + + public function testResetQueue() + { + $mock = new MockHandler([new Response(200), new Response(204)]); + self::assertCount(2, $mock); + + $mock->reset(); + self::assertEmpty($mock); + + $mock->append(new Response(500)); + self::assertCount(1, $mock); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/Network/StreamHandlerTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/Network/StreamHandlerTest.php new file mode 100644 index 0000000000..c3fc11753a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/Network/StreamHandlerTest.php @@ -0,0 +1,71 @@ + true, + ] + )->wait(); + + self::assertSame(200, $response->getStatusCode()); + self::assertStringContainsString('

Example Domain

', (string) $response->getBody()); + } + + public function testSslRequestWorksWithForceIpResolve() + { + $handler = new StreamHandler(); + + $response = $handler( + new Request('GET', 'https://www.example.com/'), + [ + RequestOptions::STREAM => true, + 'force_ip_resolve' => 'v4', + ] + )->wait(); + + self::assertSame(200, $response->getStatusCode()); + self::assertStringContainsString('

Example Domain

', (string) $response->getBody()); + } + + public function testSslRequestWorksWithForceIpResolveAfterRedirect() + { + $client = new Client(['handler' => HandlerStack::create(new StreamHandler())]); + + $response = $client->send( + // Redirects to https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun. + new Request('GET', 'https://git.io/JvXDl'), + [ + RequestOptions::STREAM => true, + 'force_ip_resolve' => 'v4', + ] + ); + + self::assertSame(200, $response->getStatusCode()); + self::assertStringContainsString('jobsjob_idstepsrun', (string) $response->getBody()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/ProxyTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/ProxyTest.php new file mode 100644 index 0000000000..2575a959e7 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/ProxyTest.php @@ -0,0 +1,75 @@ + true]); + self::assertNull($a); + self::assertNotNull($b); + } + + public function testSendsToStreaming() + { + $a = $b = null; + $m1 = new MockHandler([static function ($v) use (&$a) { + $a = $v; + }]); + $m2 = new MockHandler([static function ($v) use (&$b) { + $b = $v; + }]); + $h = Proxy::wrapStreaming($m1, $m2); + $h(new Request('GET', 'http://foo.com'), []); + self::assertNotNull($a); + self::assertNull($b); + } + + public function testSendsToNonStreaming() + { + $a = $b = null; + $m1 = new MockHandler([static function ($v) use (&$a) { + $a = $v; + }]); + $m2 = new MockHandler([static function ($v) use (&$b) { + $b = $v; + }]); + $h = Proxy::wrapStreaming($m1, $m2); + $h(new Request('GET', 'http://foo.com'), ['stream' => true]); + self::assertNull($a); + self::assertNotNull($b); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/StreamHandlerTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/StreamHandlerTest.php new file mode 100644 index 0000000000..725e6910fa --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Handler/StreamHandlerTest.php @@ -0,0 +1,797 @@ + 'Bar', + 'Content-Length' => 8, + ], 'hi there'), + ]); + } + + public function testReturnsResponseForSuccessfulRequest() + { + $this->queueRes(); + $handler = new StreamHandler(); + $response = $handler( + new Request('GET', Server::$url, ['Foo' => 'Bar']), + [] + )->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('8', $response->getHeaderLine('Content-Length')); + self::assertSame('hi there', (string) $response->getBody()); + $sent = Server::received()[0]; + self::assertSame('GET', $sent->getMethod()); + self::assertSame('/', $sent->getUri()->getPath()); + self::assertSame('127.0.0.1:8126', $sent->getHeaderLine('Host')); + self::assertSame('Bar', $sent->getHeaderLine('foo')); + } + + public function testAddsErrorToResponse() + { + $handler = new StreamHandler(); + + $this->expectException(ConnectException::class); + $handler( + new Request('GET', 'http://localhost:123'), + ['timeout' => 0.01] + )->wait(); + } + + public function testStreamAttributeKeepsStreamOpen() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request( + 'PUT', + Server::$url.'foo?baz=bar', + ['Foo' => 'Bar'], + 'test' + ); + $response = $handler($request, ['stream' => true])->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('8', $response->getHeaderLine('Content-Length')); + $body = $response->getBody(); + $stream = $body->detach(); + self::assertIsResource($stream); + self::assertSame('http', \stream_get_meta_data($stream)['wrapper_type']); + self::assertSame('hi there', \stream_get_contents($stream)); + \fclose($stream); + $sent = Server::received()[0]; + self::assertSame('PUT', $sent->getMethod()); + self::assertSame('http://127.0.0.1:8126/foo?baz=bar', (string) $sent->getUri()); + self::assertSame('Bar', $sent->getHeaderLine('Foo')); + self::assertSame('test', (string) $sent->getBody()); + } + + public function testDrainsResponseIntoTempStream() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, [])->wait(); + $body = $response->getBody(); + $stream = $body->detach(); + self::assertSame('php://temp', \stream_get_meta_data($stream)['uri']); + self::assertSame('hi', \fread($stream, 2)); + \fclose($stream); + } + + public function testDrainsResponseIntoSaveToBody() + { + $r = \fopen('php://temp', 'r+'); + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, ['sink' => $r])->wait(); + $body = $response->getBody()->detach(); + self::assertSame('php://temp', \stream_get_meta_data($body)['uri']); + self::assertSame('hi', \fread($body, 2)); + self::assertSame(' there', \stream_get_contents($r)); + \fclose($r); + } + + public function testDrainsResponseIntoSaveToBodyAtPath() + { + $tmpfname = \tempnam(\sys_get_temp_dir(), 'save_to_path'); + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, ['sink' => $tmpfname])->wait(); + $body = $response->getBody(); + self::assertSame($tmpfname, $body->getMetadata('uri')); + self::assertSame('hi', $body->read(2)); + $body->close(); + \unlink($tmpfname); + } + + public function testDrainsResponseIntoSaveToBodyAtNonExistentPath() + { + $tmpfname = \tempnam(\sys_get_temp_dir(), 'save_to_path'); + \unlink($tmpfname); + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, ['sink' => $tmpfname])->wait(); + $body = $response->getBody(); + self::assertSame($tmpfname, $body->getMetadata('uri')); + self::assertSame('hi', $body->read(2)); + $body->close(); + \unlink($tmpfname); + } + + public function testDrainsResponseAndReadsOnlyContentLengthBytes() + { + Server::flush(); + Server::enqueue([ + new Response(200, [ + 'Foo' => 'Bar', + 'Content-Length' => 8, + ], 'hi there... This has way too much data!'), + ]); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, [])->wait(); + $body = $response->getBody(); + $stream = $body->detach(); + self::assertSame('hi there', \stream_get_contents($stream)); + \fclose($stream); + } + + public function testDoesNotDrainWhenHeadRequest() + { + Server::flush(); + // Say the content-length is 8, but return no response. + Server::enqueue([ + new Response(200, [ + 'Foo' => 'Bar', + 'Content-Length' => 8, + ], ''), + ]); + $handler = new StreamHandler(); + $request = new Request('HEAD', Server::$url); + $response = $handler($request, [])->wait(); + $body = $response->getBody(); + $stream = $body->detach(); + self::assertSame('', \stream_get_contents($stream)); + \fclose($stream); + } + + public function testAutomaticallyDecompressGzip() + { + Server::flush(); + $content = \gzencode('test'); + Server::enqueue([ + new Response(200, [ + 'Content-Encoding' => 'gzip', + 'Content-Length' => \strlen($content), + ], $content), + ]); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, ['decode_content' => true])->wait(); + self::assertSame('test', (string) $response->getBody()); + self::assertFalse($response->hasHeader('content-encoding')); + self::assertTrue(!$response->hasHeader('content-length') || $response->getHeaderLine('content-length') == $response->getBody()->getSize()); + } + + public function testAutomaticallyDecompressGzipHead() + { + Server::flush(); + $content = \gzencode('test'); + Server::enqueue([ + new Response(200, [ + 'Content-Encoding' => 'gzip', + 'Content-Length' => \strlen($content), + ], $content), + ]); + $handler = new StreamHandler(); + $request = new Request('HEAD', Server::$url); + $response = $handler($request, ['decode_content' => true])->wait(); + + // Verify that the content-length matches the encoded size. + self::assertTrue(!$response->hasHeader('content-length') || $response->getHeaderLine('content-length') == \strlen($content)); + } + + public function testReportsOriginalSizeAndContentEncodingAfterDecoding() + { + Server::flush(); + $content = \gzencode('test'); + Server::enqueue([ + new Response(200, [ + 'Content-Encoding' => 'gzip', + 'Content-Length' => \strlen($content), + ], $content), + ]); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, ['decode_content' => true])->wait(); + + self::assertSame( + 'gzip', + $response->getHeaderLine('x-encoded-content-encoding') + ); + self::assertSame( + \strlen($content), + (int) $response->getHeaderLine('x-encoded-content-length') + ); + } + + public function testDoesNotForceGzipDecode() + { + Server::flush(); + $content = \gzencode('test'); + Server::enqueue([ + new Response(200, [ + 'Content-Encoding' => 'gzip', + 'Content-Length' => \strlen($content), + ], $content), + ]); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, ['decode_content' => false])->wait(); + self::assertSame($content, (string) $response->getBody()); + self::assertSame('gzip', $response->getHeaderLine('content-encoding')); + self::assertEquals(\strlen($content), $response->getHeaderLine('content-length')); + } + + public function testProtocolVersion() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url, [], null, '1.0'); + $handler($request, []); + self::assertSame('1.0', Server::received()[0]->getProtocolVersion()); + } + + protected function getSendResult(array $opts) + { + $this->queueRes(); + $handler = new StreamHandler(); + $opts['stream'] = true; + $request = new Request('GET', Server::$url); + + return $handler($request, $opts)->wait(); + } + + public function testAddsProxy() + { + $this->expectException(ConnectException::class); + $this->expectExceptionMessage('Connection refused'); + + $this->getSendResult(['proxy' => '127.0.0.1:8125']); + } + + public function testAddsProxyByProtocol() + { + $url = Server::$url; + $res = $this->getSendResult(['proxy' => ['http' => $url]]); + $opts = \stream_context_get_options($res->getBody()->detach()); + + foreach ([\PHP_URL_HOST, \PHP_URL_PORT] as $part) { + self::assertSame(parse_url($url, $part), parse_url($opts['http']['proxy'], $part)); + } + } + + public function testAddsProxyButHonorsNoProxy() + { + $url = Server::$url; + $res = $this->getSendResult(['proxy' => [ + 'http' => $url, + 'no' => ['*'], + ]]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertArrayNotHasKey('proxy', $opts['http']); + } + + public function testUsesProxy() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('GET', 'http://www.example.com', [], null, '1.0'); + $response = $handler($request, [ + 'proxy' => Server::$url, + ])->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('8', $response->getHeaderLine('Content-Length')); + self::assertSame('hi there', (string) $response->getBody()); + } + + public function testAddsTimeout() + { + $res = $this->getSendResult(['stream' => true, 'timeout' => 200]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertEquals(200, $opts['http']['timeout']); + } + + public function testVerifiesVerifyIsValidIfPath() + { + $this->expectException(RequestException::class); + $this->expectExceptionMessage('SSL CA bundle not found: /does/not/exist'); + + $this->getSendResult(['verify' => '/does/not/exist']); + } + + public function testVerifyCanBeDisabled() + { + $handler = $this->getSendResult(['verify' => false]); + self::assertInstanceOf(Response::class, $handler); + } + + public function testVerifiesCertIfValidPath() + { + $this->expectException(RequestException::class); + $this->expectExceptionMessage('SSL certificate not found: /does/not/exist'); + + $this->getSendResult(['cert' => '/does/not/exist']); + } + + public function testVerifyCanBeSetToPath() + { + $path = Utils::defaultCaBundle(); + $res = $this->getSendResult(['verify' => $path]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertTrue($opts['ssl']['verify_peer']); + self::assertTrue($opts['ssl']['verify_peer_name']); + self::assertSame($path, $opts['ssl']['cafile']); + self::assertFileExists($opts['ssl']['cafile']); + } + + public function testUsesSystemDefaultBundle() + { + $res = $this->getSendResult(['verify' => true]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertArrayNotHasKey('cafile', $opts['ssl']); + } + + public function testEnsuresVerifyOptionIsValid() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid verify request option'); + + $this->getSendResult(['verify' => 10]); + } + + public function testEnsuresCryptoMethodOptionIsValid() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid crypto_method request option: unknown version provided'); + + $this->getSendResult(['crypto_method' => 123]); + } + + public function testSetsCryptoMethodTls10() + { + $res = $this->getSendResult(['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertSame(\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, $opts['http']['crypto_method']); + } + + public function testSetsCryptoMethodTls11() + { + $res = $this->getSendResult(['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertSame(\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, $opts['http']['crypto_method']); + } + + public function testSetsCryptoMethodTls12() + { + $res = $this->getSendResult(['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertSame(\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, $opts['http']['crypto_method']); + } + + /** + * @requires PHP >=7.4 + */ + public function testSetsCryptoMethodTls13() + { + $res = $this->getSendResult(['crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertSame(\STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT, $opts['http']['crypto_method']); + } + + public function testCanSetPasswordWhenSettingCert() + { + $path = __FILE__; + $res = $this->getSendResult(['cert' => [$path, 'foo']]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertSame($path, $opts['ssl']['local_cert']); + self::assertSame('foo', $opts['ssl']['passphrase']); + } + + public function testDebugAttributeWritesToStream() + { + $this->queueRes(); + $f = \fopen('php://temp', 'w+'); + $this->getSendResult(['debug' => $f]); + \fseek($f, 0); + $contents = \stream_get_contents($f); + self::assertStringContainsString(' [CONNECT]', $contents); + self::assertStringContainsString(' [FILE_SIZE_IS]', $contents); + self::assertStringContainsString(' [PROGRESS]', $contents); + } + + public function testDebugAttributeWritesStreamInfoToBuffer() + { + $called = false; + $this->queueRes(); + $buffer = \fopen('php://temp', 'r+'); + $this->getSendResult([ + 'progress' => static function () use (&$called) { + $called = true; + }, + 'debug' => $buffer, + ]); + \fseek($buffer, 0); + $contents = \stream_get_contents($buffer); + self::assertStringContainsString(' [CONNECT]', $contents); + self::assertStringContainsString(' [FILE_SIZE_IS] message: "Content-Length: 8"', $contents); + self::assertStringContainsString(' [PROGRESS] bytes_max: "8"', $contents); + self::assertTrue($called); + } + + public function testEmitsProgressInformation() + { + $called = []; + $this->queueRes(); + $this->getSendResult([ + 'progress' => static function (...$args) use (&$called) { + $called[] = $args; + }, + ]); + self::assertNotEmpty($called); + self::assertEquals(8, $called[0][0]); + self::assertEquals(0, $called[0][1]); + } + + public function testEmitsProgressInformationAndDebugInformation() + { + $called = []; + $this->queueRes(); + $buffer = \fopen('php://memory', 'w+'); + $this->getSendResult([ + 'debug' => $buffer, + 'progress' => static function (...$args) use (&$called) { + $called[] = $args; + }, + ]); + self::assertNotEmpty($called); + self::assertEquals(8, $called[0][0]); + self::assertEquals(0, $called[0][1]); + \rewind($buffer); + self::assertNotEmpty(\stream_get_contents($buffer)); + \fclose($buffer); + } + + public function testPerformsShallowMergeOfCustomContextOptions() + { + $res = $this->getSendResult([ + 'stream_context' => [ + 'http' => [ + 'request_fulluri' => true, + 'method' => 'HEAD', + ], + 'socket' => [ + 'bindto' => '127.0.0.1:0', + ], + 'ssl' => [ + 'verify_peer' => false, + ], + ], + ]); + $opts = \stream_context_get_options($res->getBody()->detach()); + self::assertSame('HEAD', $opts['http']['method']); + self::assertTrue($opts['http']['request_fulluri']); + self::assertSame('127.0.0.1:0', $opts['socket']['bindto']); + self::assertFalse($opts['ssl']['verify_peer']); + } + + public function testEnsuresThatStreamContextIsAnArray() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('stream_context must be an array'); + + $this->getSendResult(['stream_context' => 'foo']); + } + + public function testDoesNotAddContentTypeByDefault() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('PUT', Server::$url, ['Content-Length' => 3], 'foo'); + $handler($request, []); + $req = Server::received()[0]; + self::assertEquals('', $req->getHeaderLine('Content-Type')); + self::assertEquals(3, $req->getHeaderLine('Content-Length')); + } + + public function testAddsContentLengthByDefault() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('PUT', Server::$url, [], 'foo'); + $handler($request, []); + $req = Server::received()[0]; + self::assertEquals(3, $req->getHeaderLine('Content-Length')); + } + + public function testAddsContentLengthEvenWhenEmpty() + { + $this->queueRes(); + $handler = new StreamHandler(); + $request = new Request('PUT', Server::$url, [], ''); + $handler($request, []); + $req = Server::received()[0]; + self::assertEquals(0, $req->getHeaderLine('Content-Length')); + } + + public function testSupports100Continue() + { + Server::flush(); + $response = new Response(200, ['Test' => 'Hello', 'Content-Length' => '4'], 'test'); + Server::enqueue([$response]); + $request = new Request('PUT', Server::$url, ['Expect' => '100-Continue'], 'test'); + $handler = new StreamHandler(); + $response = $handler($request, [])->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('Hello', $response->getHeaderLine('Test')); + self::assertSame('4', $response->getHeaderLine('Content-Length')); + self::assertSame('test', (string) $response->getBody()); + } + + public function testDoesSleep() + { + $response = new Response(200); + Server::enqueue([$response]); + $a = new StreamHandler(); + $request = new Request('GET', Server::$url); + $s = Utils::currentTime(); + $a($request, ['delay' => 0.1])->wait(); + self::assertGreaterThan(0.0001, Utils::currentTime() - $s); + } + + public function testEnsuresOnHeadersIsCallable() + { + $req = new Request('GET', Server::$url); + $handler = new StreamHandler(); + + $this->expectException(\InvalidArgumentException::class); + $handler($req, ['on_headers' => 'error!']); + } + + public function testRejectsPromiseWhenOnHeadersFails() + { + Server::flush(); + Server::enqueue([ + new Response(200, ['X-Foo' => 'bar'], 'abc 123'), + ]); + $req = new Request('GET', Server::$url); + $handler = new StreamHandler(); + $promise = $handler($req, [ + 'on_headers' => static function () { + throw new \Exception('test'); + }, + ]); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered during the on_headers event'); + $promise->wait(); + } + + public function testSuccessfullyCallsOnHeadersBeforeWritingToSink() + { + Server::flush(); + Server::enqueue([ + new Response(200, ['X-Foo' => 'bar'], 'abc 123'), + ]); + $req = new Request('GET', Server::$url); + $got = null; + + $stream = Psr7\Utils::streamFor(); + $stream = FnStream::decorate($stream, [ + 'write' => static function ($data) use ($stream, &$got) { + self::assertNotNull($got); + + return $stream->write($data); + }, + ]); + + $handler = new StreamHandler(); + $promise = $handler($req, [ + 'sink' => $stream, + 'on_headers' => static function (ResponseInterface $res) use (&$got) { + $got = $res; + self::assertSame('bar', $res->getHeaderLine('X-Foo')); + }, + ]); + + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('bar', $response->getHeaderLine('X-Foo')); + self::assertSame('abc 123', (string) $response->getBody()); + } + + public function testInvokesOnStatsOnSuccess() + { + Server::flush(); + Server::enqueue([new Response(200)]); + $req = new Request('GET', Server::$url); + $gotStats = null; + $handler = new StreamHandler(); + $promise = $handler($req, [ + 'on_stats' => static function (TransferStats $stats) use (&$gotStats) { + $gotStats = $stats; + }, + ]); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame(200, $gotStats->getResponse()->getStatusCode()); + self::assertSame( + Server::$url, + (string) $gotStats->getEffectiveUri() + ); + self::assertSame( + Server::$url, + (string) $gotStats->getRequest()->getUri() + ); + self::assertGreaterThan(0, $gotStats->getTransferTime()); + } + + public function testInvokesOnStatsOnError() + { + $req = new Request('GET', 'http://127.0.0.1:123'); + $gotStats = null; + $handler = new StreamHandler(); + $promise = $handler($req, [ + 'connect_timeout' => 0.001, + 'timeout' => 0.001, + 'on_stats' => static function (TransferStats $stats) use (&$gotStats) { + $gotStats = $stats; + }, + ]); + $promise->wait(false); + self::assertFalse($gotStats->hasResponse()); + self::assertSame( + 'http://127.0.0.1:123', + (string) $gotStats->getEffectiveUri() + ); + self::assertSame( + 'http://127.0.0.1:123', + (string) $gotStats->getRequest()->getUri() + ); + self::assertIsFloat($gotStats->getTransferTime()); + self::assertInstanceOf( + ConnectException::class, + $gotStats->getHandlerErrorData() + ); + } + + public function testStreamIgnoresZeroTimeout() + { + Server::flush(); + Server::enqueue([new Response(200)]); + $req = new Request('GET', Server::$url); + $gotStats = null; + $handler = new StreamHandler(); + $promise = $handler($req, [ + 'connect_timeout' => 10, + 'timeout' => 0, + ]); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function testDrainsResponseAndReadsAllContentWhenContentLengthIsZero() + { + Server::flush(); + Server::enqueue([ + new Response(200, [ + 'Foo' => 'Bar', + 'Content-Length' => '0', + ], 'hi there... This has a lot of data!'), + ]); + $handler = new StreamHandler(); + $request = new Request('GET', Server::$url); + $response = $handler($request, [])->wait(); + $body = $response->getBody(); + $stream = $body->detach(); + self::assertSame('hi there... This has a lot of data!', \stream_get_contents($stream)); + \fclose($stream); + } + + public function testHonorsReadTimeout() + { + Server::flush(); + $handler = new StreamHandler(); + $response = $handler( + new Request('GET', Server::$url.'guzzle-server/read-timeout'), + [ + RequestOptions::READ_TIMEOUT => 1, + RequestOptions::STREAM => true, + ] + )->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + $body = $response->getBody()->detach(); + $line = \fgets($body); + self::assertSame("sleeping 60 seconds ...\n", $line); + $line = \fgets($body); + self::assertFalse($line); + self::assertTrue(\stream_get_meta_data($body)['timed_out']); + self::assertFalse(\feof($body)); + } + + public function testHandlesGarbageHttpServerGracefully() + { + $handler = new StreamHandler(); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered while creating the response'); + + $handler( + new Request('GET', Server::$url.'guzzle-server/garbage'), + [ + RequestOptions::STREAM => true, + ] + )->wait(); + } + + public function testHandlesInvalidStatusCodeGracefully() + { + $handler = new StreamHandler(); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage('An error was encountered while creating the response'); + + $handler( + new Request('GET', Server::$url.'guzzle-server/bad-status'), + [ + RequestOptions::STREAM => true, + ] + )->wait(); + } + + public function testRejectsNonHttpSchemes() + { + $handler = new StreamHandler(); + + $this->expectException(RequestException::class); + $this->expectExceptionMessage("The scheme 'file' is not supported."); + + $handler( + new Request('GET', 'file:///etc/passwd'), + [ + RequestOptions::STREAM => true, + ] + )->wait(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HandlerStackTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HandlerStackTest.php new file mode 100644 index 0000000000..1ea9f14ae1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HandlerStackTest.php @@ -0,0 +1,217 @@ +hasHandler()); + } + + /** + * @doesNotPerformAssertions + */ + public function testCanSetDifferentHandlerAfterConstruction() + { + $f = static function () { + }; + $h = new HandlerStack(); + $h->setHandler($f); + $h->resolve(); + } + + public function testEnsuresHandlerIsSet() + { + $this->expectException(\LogicException::class); + + $h = new HandlerStack(); + $h->resolve(); + } + + public function testPushInOrder() + { + $meths = $this->getFunctions(); + $builder = new HandlerStack(); + $builder->setHandler($meths[1]); + $builder->push($meths[2]); + $builder->push($meths[3]); + $builder->push($meths[4]); + $composed = $builder->resolve(); + self::assertSame('Hello - test123', $composed('test')); + self::assertSame( + [['a', 'test'], ['b', 'test1'], ['c', 'test12']], + $meths[0] + ); + } + + public function testUnshiftsInReverseOrder() + { + $meths = $this->getFunctions(); + $builder = new HandlerStack(); + $builder->setHandler($meths[1]); + $builder->unshift($meths[2]); + $builder->unshift($meths[3]); + $builder->unshift($meths[4]); + $composed = $builder->resolve(); + self::assertSame('Hello - test321', $composed('test')); + self::assertSame( + [['c', 'test'], ['b', 'test3'], ['a', 'test32']], + $meths[0] + ); + } + + public function testCanRemoveMiddlewareByInstance() + { + $meths = $this->getFunctions(); + $builder = new HandlerStack(); + $builder->setHandler($meths[1]); + $builder->push($meths[2]); + $builder->push($meths[2]); + $builder->push($meths[3]); + $builder->push($meths[4]); + $builder->push($meths[2]); + $builder->remove($meths[3]); + $composed = $builder->resolve(); + self::assertSame('Hello - test1131', $composed('test')); + } + + public function testCanPrintMiddleware() + { + $meths = $this->getFunctions(); + $builder = new HandlerStack(); + $builder->setHandler($meths[1]); + $builder->push($meths[2], 'a'); + $builder->push([__CLASS__, 'foo']); + $builder->push([$this, 'bar']); + $builder->push(__CLASS__.'::foo'); + $lines = \explode("\n", (string) $builder); + self::assertStringContainsString("> 4) Name: 'a', Function: callable(", $lines[0]); + self::assertStringContainsString("> 3) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[1]); + self::assertStringContainsString("> 2) Name: '', Function: callable(['GuzzleHttp\\Tests\\HandlerStackTest', 'bar'])", $lines[2]); + self::assertStringContainsString("> 1) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[3]); + self::assertStringContainsString('< 0) Handler: callable(', $lines[4]); + self::assertStringContainsString("< 1) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[5]); + self::assertStringContainsString("< 2) Name: '', Function: callable(['GuzzleHttp\\Tests\\HandlerStackTest', 'bar'])", $lines[6]); + self::assertStringContainsString("< 3) Name: '', Function: callable(GuzzleHttp\\Tests\\HandlerStackTest::foo)", $lines[7]); + self::assertStringContainsString("< 4) Name: 'a', Function: callable(", $lines[8]); + } + + public function testCanAddBeforeByName() + { + $meths = $this->getFunctions(); + $builder = new HandlerStack(); + $builder->setHandler($meths[1]); + $builder->push($meths[2], 'foo'); + $builder->before('foo', $meths[3], 'baz'); + $builder->before('baz', $meths[4], 'bar'); + $builder->before('baz', $meths[4], 'qux'); + $lines = \explode("\n", (string) $builder); + self::assertStringContainsString('> 4) Name: \'bar\'', $lines[0]); + self::assertStringContainsString('> 3) Name: \'qux\'', $lines[1]); + self::assertStringContainsString('> 2) Name: \'baz\'', $lines[2]); + self::assertStringContainsString('> 1) Name: \'foo\'', $lines[3]); + } + + public function testEnsuresHandlerExistsByName() + { + $this->expectException(\InvalidArgumentException::class); + + $builder = new HandlerStack(); + $builder->before('foo', static function () { + }); + } + + public function testCanAddAfterByName() + { + $meths = $this->getFunctions(); + $builder = new HandlerStack(); + $builder->setHandler($meths[1]); + $builder->push($meths[2], 'a'); + $builder->push($meths[3], 'b'); + $builder->after('a', $meths[4], 'c'); + $builder->after('b', $meths[4], 'd'); + $lines = \explode("\n", (string) $builder); + self::assertStringContainsString('4) Name: \'a\'', $lines[0]); + self::assertStringContainsString('3) Name: \'c\'', $lines[1]); + self::assertStringContainsString('2) Name: \'b\'', $lines[2]); + self::assertStringContainsString('1) Name: \'d\'', $lines[3]); + } + + public function testPicksUpCookiesFromRedirects() + { + $mock = new MockHandler([ + new Response(301, [ + 'Location' => 'http://foo.com/baz', + 'Set-Cookie' => 'foo=bar; Domain=foo.com', + ]), + new Response(200), + ]); + $handler = HandlerStack::create($mock); + $request = new Request('GET', 'http://foo.com/bar'); + $jar = new CookieJar(); + $response = $handler($request, [ + 'allow_redirects' => true, + 'cookies' => $jar, + ])->wait(); + self::assertSame(200, $response->getStatusCode()); + $lastRequest = $mock->getLastRequest(); + self::assertSame('http://foo.com/baz', (string) $lastRequest->getUri()); + self::assertSame('foo=bar', $lastRequest->getHeaderLine('Cookie')); + } + + private function getFunctions() + { + $calls = []; + + $a = static function (callable $next) use (&$calls) { + return static function ($v) use ($next, &$calls) { + $calls[] = ['a', $v]; + + return $next($v.'1'); + }; + }; + + $b = static function (callable $next) use (&$calls) { + return static function ($v) use ($next, &$calls) { + $calls[] = ['b', $v]; + + return $next($v.'2'); + }; + }; + + $c = static function (callable $next) use (&$calls) { + return static function ($v) use ($next, &$calls) { + $calls[] = ['c', $v]; + + return $next($v.'3'); + }; + }; + + $handler = static function ($v) { + return 'Hello - '.$v; + }; + + return [&$calls, $handler, $a, $b, $c]; + } + + public static function foo() + { + } + + public function bar() + { + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Helpers.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Helpers.php new file mode 100644 index 0000000000..4128bb153b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Helpers.php @@ -0,0 +1,35 @@ +getProperty($attributeName); + + if (!$attribute || $attribute->isPublic()) { + return $object->$attributeName; + } + + $attribute->setAccessible(true); + + try { + return $attribute->getValue($object); + } finally { + $attribute->setAccessible(false); + } + } catch (\ReflectionException $e) { + // do nothing + } + } while ($reflector = $reflector->getParentClass()); + + throw new \Exception( + sprintf('Attribute "%s" not found in object.', $attributeName) + ); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HttplugIntegrationTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HttplugIntegrationTest.php new file mode 100644 index 0000000000..1b9824ec5c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/HttplugIntegrationTest.php @@ -0,0 +1,18 @@ + + */ +class HttplugIntegrationTest extends HttpClientTest +{ + protected function createHttpAdapter(): ClientInterface + { + return new Client(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/InternalUtilsTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/InternalUtilsTest.php new file mode 100644 index 0000000000..1c85387e83 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/InternalUtilsTest.php @@ -0,0 +1,25 @@ +getHost()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MessageFormatterTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MessageFormatterTest.php new file mode 100644 index 0000000000..4304d4e90d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MessageFormatterTest.php @@ -0,0 +1,100 @@ +format($request); + if (method_exists($this, 'assertMatchesRegularExpression')) { + // PHPUnit 9 + self::assertMatchesRegularExpression($pattern, $result); + } else { + // PHPUnit 8 + self::assertRegExp($pattern, $result); + } + } + + public function formatProvider() + { + $request = new Request('PUT', '/', ['x-test' => 'abc'], Psr7\Utils::streamFor('foo')); + $response = new Response(200, ['X-Baz' => 'Bar'], Psr7\Utils::streamFor('baz')); + $err = new RequestException('Test', $request, $response); + + return [ + ['{request}', [$request], Psr7\Message::toString($request)], + ['{response}', [$request, $response], Psr7\Message::toString($response)], + ['{request} {response}', [$request, $response], Psr7\Message::toString($request).' '.Psr7\Message::toString($response)], + // Empty response yields no value + ['{request} {response}', [$request], Psr7\Message::toString($request).' '], + ['{req_headers}', [$request], "PUT / HTTP/1.1\r\nx-test: abc"], + ['{res_headers}', [$request, $response], "HTTP/1.1 200 OK\r\nX-Baz: Bar"], + ['{res_headers}', [$request], 'NULL'], + ['{req_body}', [$request], 'foo'], + ['{res_body}', [$request, $response], 'baz'], + ['{res_body}', [$request], 'NULL'], + ['{method}', [$request], $request->getMethod()], + ['{url}', [$request], $request->getUri()], + ['{target}', [$request], $request->getRequestTarget()], + ['{req_version}', [$request], $request->getProtocolVersion()], + ['{res_version}', [$request, $response], $response->getProtocolVersion()], + ['{res_version}', [$request], 'NULL'], + ['{host}', [$request], $request->getHeaderLine('Host')], + ['{hostname}', [$request, $response], \gethostname()], + ['{hostname}{hostname}', [$request, $response], \gethostname().\gethostname()], + ['{code}', [$request, $response], $response->getStatusCode()], + ['{code}', [$request], 'NULL'], + ['{phrase}', [$request, $response], $response->getReasonPhrase()], + ['{phrase}', [$request], 'NULL'], + ['{error}', [$request, $response, $err], 'Test'], + ['{error}', [$request], 'NULL'], + ['{req_header_x-test}', [$request], 'abc'], + ['{req_header_x-not}', [$request], ''], + ['{res_header_X-Baz}', [$request, $response], 'Bar'], + ['{res_header_x-not}', [$request, $response], ''], + ['{res_header_X-Baz}', [$request], 'NULL'], + ]; + } + + /** + * @dataProvider formatProvider + */ + public function testFormatsMessages(string $template, array $args, $result) + { + $f = new MessageFormatter($template); + self::assertSame((string) $result, $f->format(...$args)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MiddlewareTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MiddlewareTest.php new file mode 100644 index 0000000000..cad9ff33f1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/MiddlewareTest.php @@ -0,0 +1,259 @@ + (string) new SetCookie([ + 'Name' => 'name', + 'Value' => 'value', + 'Domain' => 'foo.com', + ]), + ]); + }, + ] + ); + $f = $m($h); + $f(new Request('GET', 'http://foo.com'), ['cookies' => $jar])->wait(); + self::assertCount(1, $jar); + } + + public function testThrowsExceptionOnHttpClientError() + { + $m = Middleware::httpErrors(); + $h = new MockHandler([new Response(400, [], str_repeat('a', 1000))]); + $f = $m($h); + $p = $f(new Request('GET', 'http://foo.com'), ['http_errors' => true]); + self::assertTrue(P\Is::pending($p)); + + $this->expectException(ClientException::class); + $this->expectExceptionMessage(\sprintf("Client error: `GET http://foo.com` resulted in a `400 Bad Request` response:\n%s (truncated...)", str_repeat('a', 120))); + $p->wait(); + } + + public function testThrowsExceptionOnHttpClientErrorLongBody() + { + $m = Middleware::httpErrors(new BodySummarizer(200)); + $h = new MockHandler([new Response(404, [], str_repeat('b', 1000))]); + $f = $m($h); + $p = $f(new Request('GET', 'http://foo.com'), ['http_errors' => true]); + self::assertTrue(P\Is::pending($p)); + + $this->expectException(ClientException::class); + $this->expectExceptionMessage(\sprintf("Client error: `GET http://foo.com` resulted in a `404 Not Found` response:\n%s (truncated...)", str_repeat('b', 200))); + $p->wait(); + } + + public function testThrowsExceptionOnHttpServerError() + { + $m = Middleware::httpErrors(); + $h = new MockHandler([new Response(500, [], 'Oh no!')]); + $f = $m($h); + $p = $f(new Request('GET', 'http://foo.com'), ['http_errors' => true]); + self::assertTrue(P\Is::pending($p)); + + $this->expectException(ServerException::class); + $this->expectExceptionMessage("GET http://foo.com` resulted in a `500 Internal Server Error` response:\nOh no!"); + $p->wait(); + } + + /** + * @dataProvider getHistoryUseCases + */ + public function testTracksHistory($container) + { + $m = Middleware::history($container); + $h = new MockHandler([new Response(200), new Response(201)]); + $f = $m($h); + $p1 = $f(new Request('GET', 'http://foo.com'), ['headers' => ['foo' => 'bar']]); + $p2 = $f(new Request('HEAD', 'http://foo.com'), ['headers' => ['foo' => 'baz']]); + $p1->wait(); + $p2->wait(); + self::assertCount(2, $container); + self::assertSame(200, $container[0]['response']->getStatusCode()); + self::assertSame(201, $container[1]['response']->getStatusCode()); + self::assertSame('GET', $container[0]['request']->getMethod()); + self::assertSame('HEAD', $container[1]['request']->getMethod()); + self::assertSame('bar', $container[0]['options']['headers']['foo']); + self::assertSame('baz', $container[1]['options']['headers']['foo']); + } + + /** + * As documented in Middleware::history parameter phpdoc. + */ + public function testNullContainerException() + { + $this->expectException(\InvalidArgumentException::class); + + $nullContainer = null; + Middleware::history($nullContainer); + } + + public function getHistoryUseCases() + { + return [ + [[]], // 1. Container is an array + [new \ArrayObject()], // 2. Container is an ArrayObject + ]; + } + + public function testTracksHistoryForFailures() + { + $container = []; + $m = Middleware::history($container); + $request = new Request('GET', 'http://foo.com'); + $h = new MockHandler([new RequestException('error', $request)]); + $f = $m($h); + $f($request, [])->wait(false); + self::assertCount(1, $container); + self::assertSame('GET', $container[0]['request']->getMethod()); + self::assertInstanceOf(RequestException::class, $container[0]['error']); + } + + public function testTapsBeforeAndAfter() + { + $calls = []; + $m = static function ($handler) use (&$calls) { + return static function ($request, $options) use ($handler, &$calls) { + $calls[] = '2'; + + return $handler($request, $options); + }; + }; + + $m2 = Middleware::tap( + static function (RequestInterface $request, array $options) use (&$calls) { + $calls[] = '1'; + }, + static function (RequestInterface $request, array $options, PromiseInterface $p) use (&$calls) { + $calls[] = '3'; + } + ); + + $h = new MockHandler([new Response()]); + $b = new HandlerStack($h); + $b->push($m2); + $b->push($m); + $comp = $b->resolve(); + $p = $comp(new Request('GET', 'http://foo.com'), []); + self::assertSame('123', \implode('', $calls)); + self::assertInstanceOf(PromiseInterface::class, $p); + self::assertSame(200, $p->wait()->getStatusCode()); + } + + public function testMapsRequest() + { + $h = new MockHandler([ + static function (RequestInterface $request, array $options) { + self::assertSame('foo', $request->getHeaderLine('Bar')); + + return new Response(200); + }, + ]); + $stack = new HandlerStack($h); + $stack->push(Middleware::mapRequest(static function (RequestInterface $request) { + return $request->withHeader('Bar', 'foo'); + })); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com'), []); + self::assertInstanceOf(PromiseInterface::class, $p); + } + + public function testMapsResponse() + { + $h = new MockHandler([new Response(200)]); + $stack = new HandlerStack($h); + $stack->push(Middleware::mapResponse(static function (ResponseInterface $response) { + return $response->withHeader('Bar', 'foo'); + })); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com'), []); + $p->wait(); + self::assertSame('foo', $p->wait()->getHeaderLine('Bar')); + } + + public function testLogsRequestsAndResponses() + { + $h = new MockHandler([new Response(200)]); + $stack = new HandlerStack($h); + $logger = new TestLogger(); + $formatter = new MessageFormatter(); + $stack->push(Middleware::log($logger, $formatter)); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com'), []); + $p->wait(); + self::assertCount(1, $logger->records); + self::assertStringContainsString('"PUT / HTTP/1.1" 200', $logger->records[0]['message']); + } + + public function testLogsRequestsAndResponsesCustomLevel() + { + $h = new MockHandler([new Response(200)]); + $stack = new HandlerStack($h); + $logger = new TestLogger(); + $formatter = new MessageFormatter(); + $stack->push(Middleware::log($logger, $formatter, 'debug')); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com'), []); + $p->wait(); + self::assertCount(1, $logger->records); + self::assertStringContainsString('"PUT / HTTP/1.1" 200', $logger->records[0]['message']); + self::assertSame('debug', $logger->records[0]['level']); + } + + public function testLogsRequestsAndErrors() + { + $h = new MockHandler([new Response(404)]); + $stack = new HandlerStack($h); + $logger = new TestLogger(); + $formatter = new MessageFormatter('{code} {error}'); + $stack->push(Middleware::log($logger, $formatter)); + $stack->push(Middleware::httpErrors()); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com'), ['http_errors' => true]); + $p->wait(false); + self::assertCount(1, $logger->records); + self::assertStringContainsString('PUT http://www.google.com', $logger->records[0]['message']); + self::assertStringContainsString('404 Not Found', $logger->records[0]['message']); + } + + public function testLogsWithStringError() + { + $h = new MockHandler([P\Create::rejectionFor('some problem')]); + $stack = new HandlerStack($h); + $logger = new TestLogger(); + $formatter = new MessageFormatter('{error}'); + $stack->push(Middleware::log($logger, $formatter)); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com'), []); + $p->wait(false); + self::assertCount(1, $logger->records); + self::assertStringContainsString('some problem', $logger->records[0]['message']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PoolTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PoolTest.php new file mode 100644 index 0000000000..054482e001 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PoolTest.php @@ -0,0 +1,196 @@ +expectException(\InvalidArgumentException::class); + $p->promise()->wait(); + } + + public function testValidatesEachElement() + { + $c = new Client(); + $requests = ['foo']; + $p = new Pool($c, new \ArrayIterator($requests)); + + $this->expectException(\InvalidArgumentException::class); + $p->promise()->wait(); + } + + /** + * @doesNotPerformAssertions + */ + public function testSendsAndRealizesFuture() + { + $c = $this->getClient(); + $p = new Pool($c, [new Request('GET', 'http://example.com')]); + $p->promise()->wait(); + } + + /** + * @doesNotPerformAssertions + */ + public function testExecutesPendingWhenWaiting() + { + $r1 = new Promise(static function () use (&$r1) { + $r1->resolve(new Response()); + }); + $r2 = new Promise(static function () use (&$r2) { + $r2->resolve(new Response()); + }); + $r3 = new Promise(static function () use (&$r3) { + $r3->resolve(new Response()); + }); + $handler = new MockHandler([$r1, $r2, $r3]); + $c = new Client(['handler' => $handler]); + $p = new Pool($c, [ + new Request('GET', 'http://example.com'), + new Request('GET', 'http://example.com'), + new Request('GET', 'http://example.com'), + ], ['pool_size' => 2]); + $p->promise()->wait(); + } + + public function testUsesRequestOptions() + { + $h = []; + $handler = new MockHandler([ + static function (RequestInterface $request) use (&$h) { + $h[] = $request; + + return new Response(); + }, + ]); + $c = new Client(['handler' => $handler]); + $opts = ['options' => ['headers' => ['x-foo' => 'bar']]]; + $p = new Pool($c, [new Request('GET', 'http://example.com')], $opts); + $p->promise()->wait(); + self::assertCount(1, $h); + self::assertTrue($h[0]->hasHeader('x-foo')); + } + + public function testCanProvideCallablesThatReturnResponses() + { + $h = []; + $handler = new MockHandler([ + static function (RequestInterface $request) use (&$h) { + $h[] = $request; + + return new Response(); + }, + ]); + $c = new Client(['handler' => $handler]); + $optHistory = []; + $fn = static function (array $opts) use (&$optHistory, $c) { + $optHistory = $opts; + + return $c->request('GET', 'http://example.com', $opts); + }; + $opts = ['options' => ['headers' => ['x-foo' => 'bar']]]; + $p = new Pool($c, [$fn], $opts); + $p->promise()->wait(); + self::assertCount(1, $h); + self::assertTrue($h[0]->hasHeader('x-foo')); + } + + public function testBatchesResults() + { + $requests = [ + new Request('GET', 'http://foo.com/200'), + new Request('GET', 'http://foo.com/201'), + new Request('GET', 'http://foo.com/202'), + new Request('GET', 'http://foo.com/404'), + ]; + $fn = static function (RequestInterface $request) { + return new Response(\substr($request->getUri()->getPath(), 1)); + }; + $mock = new MockHandler([$fn, $fn, $fn, $fn]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $results = Pool::batch($client, $requests); + self::assertCount(4, $results); + self::assertSame([0, 1, 2, 3], \array_keys($results)); + self::assertSame(200, $results[0]->getStatusCode()); + self::assertSame(201, $results[1]->getStatusCode()); + self::assertSame(202, $results[2]->getStatusCode()); + self::assertInstanceOf(ClientException::class, $results[3]); + } + + public function testBatchesResultsWithCallbacks() + { + $requests = [ + new Request('GET', 'http://foo.com/200'), + new Request('GET', 'http://foo.com/201'), + ]; + $mock = new MockHandler([ + static function (RequestInterface $request) { + return new Response(\substr($request->getUri()->getPath(), 1)); + }, + ]); + $client = new Client(['handler' => $mock]); + $results = Pool::batch($client, $requests, [ + 'fulfilled' => static function ($value) use (&$called) { + $called = true; + }, + ]); + self::assertCount(2, $results); + self::assertTrue($called); + } + + public function testUsesYieldedKeyInFulfilledCallback() + { + $r1 = new Promise(static function () use (&$r1) { + $r1->resolve(new Response()); + }); + $r2 = new Promise(static function () use (&$r2) { + $r2->resolve(new Response()); + }); + $r3 = new Promise(static function () use (&$r3) { + $r3->resolve(new Response()); + }); + $handler = new MockHandler([$r1, $r2, $r3]); + $c = new Client(['handler' => $handler]); + $keys = []; + $requests = [ + 'request_1' => new Request('GET', 'http://example.com'), + 'request_2' => new Request('GET', 'http://example.com'), + 'request_3' => new Request('GET', 'http://example.com'), + ]; + $p = new Pool($c, $requests, [ + 'pool_size' => 2, + 'fulfilled' => static function ($res, $index) use (&$keys) { + $keys[] = $index; + }, + ]); + $p->promise()->wait(); + self::assertCount(3, $keys); + self::assertSame($keys, \array_keys($requests)); + } + + private function getClient($total = 1) + { + $queue = []; + for ($i = 0; $i < $total; ++$i) { + $queue[] = new Response(); + } + $handler = new MockHandler($queue); + + return new Client(['handler' => $handler]); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PrepareBodyMiddlewareTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PrepareBodyMiddlewareTest.php new file mode 100644 index 0000000000..5dcec82641 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/PrepareBodyMiddlewareTest.php @@ -0,0 +1,162 @@ + 0) { + self::assertEquals($length, $request->getHeaderLine('Content-Length')); + } else { + self::assertFalse($request->hasHeader('Content-Length')); + } + + return new Response(200); + }, + ]); + $m = Middleware::prepareBody(); + $stack = new HandlerStack($h); + $stack->push($m); + $comp = $stack->resolve(); + $p = $comp(new Request($method, 'http://www.google.com', [], $body), []); + self::assertInstanceOf(PromiseInterface::class, $p); + $response = $p->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function testAddsTransferEncodingWhenNoContentLength() + { + $body = FnStream::decorate(Psr7\Utils::streamFor('foo'), [ + 'getSize' => static function () { + return null; + }, + ]); + $h = new MockHandler([ + static function (RequestInterface $request) { + self::assertFalse($request->hasHeader('Content-Length')); + self::assertSame('chunked', $request->getHeaderLine('Transfer-Encoding')); + + return new Response(200); + }, + ]); + $m = Middleware::prepareBody(); + $stack = new HandlerStack($h); + $stack->push($m); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com', [], $body), []); + self::assertInstanceOf(PromiseInterface::class, $p); + $response = $p->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function testAddsContentTypeWhenMissingAndPossible() + { + $bd = Psr7\Utils::streamFor(\fopen(__DIR__.'/../composer.json', 'r')); + $h = new MockHandler([ + static function (RequestInterface $request) { + self::assertSame('application/json', $request->getHeaderLine('Content-Type')); + self::assertTrue($request->hasHeader('Content-Length')); + + return new Response(200); + }, + ]); + $m = Middleware::prepareBody(); + $stack = new HandlerStack($h); + $stack->push($m); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com', [], $bd), []); + self::assertInstanceOf(PromiseInterface::class, $p); + $response = $p->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function expectProvider() + { + return [ + [true, ['100-Continue']], + [false, []], + [10, ['100-Continue']], + [500000, []], + ]; + } + + /** + * @dataProvider expectProvider + */ + public function testAddsExpect($value, $result) + { + $bd = Psr7\Utils::streamFor(\fopen(__DIR__.'/../composer.json', 'r')); + + $h = new MockHandler([ + static function (RequestInterface $request) use ($result) { + self::assertSame($result, $request->getHeader('Expect')); + + return new Response(200); + }, + ]); + + $m = Middleware::prepareBody(); + $stack = new HandlerStack($h); + $stack->push($m); + $comp = $stack->resolve(); + $p = $comp(new Request('PUT', 'http://www.google.com', [], $bd), [ + 'expect' => $value, + ]); + self::assertInstanceOf(PromiseInterface::class, $p); + $response = $p->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function testIgnoresIfExpectIsPresent() + { + $bd = Psr7\Utils::streamFor(\fopen(__DIR__.'/../composer.json', 'r')); + $h = new MockHandler([ + static function (RequestInterface $request) { + self::assertSame(['Foo'], $request->getHeader('Expect')); + + return new Response(200); + }, + ]); + + $m = Middleware::prepareBody(); + $stack = new HandlerStack($h); + $stack->push($m); + $comp = $stack->resolve(); + $p = $comp( + new Request('PUT', 'http://www.google.com', ['Expect' => 'Foo'], $bd), + ['expect' => true] + ); + self::assertInstanceOf(PromiseInterface::class, $p); + $response = $p->wait(); + self::assertSame(200, $response->getStatusCode()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RedirectMiddlewareTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RedirectMiddlewareTest.php new file mode 100644 index 0000000000..5dbe8bd7d7 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RedirectMiddlewareTest.php @@ -0,0 +1,546 @@ +push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com'); + $promise = $handler($request, []); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + } + + public function testIgnoresWhenNoLocation() + { + $response = new Response(304); + $stack = new HandlerStack(new MockHandler([$response])); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com'); + $promise = $handler($request, []); + $response = $promise->wait(); + self::assertSame(304, $response->getStatusCode()); + } + + public function testRedirectsWithAbsoluteUri() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://test.com']), + new Response(200), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['max' => 2], + ]); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('http://test.com', (string) $mock->getLastRequest()->getUri()); + } + + public function testRedirectsWithRelativeUri() + { + $mock = new MockHandler([ + new Response(302, ['Location' => '/foo']), + new Response(200), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['max' => 2], + ]); + $response = $promise->wait(); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('http://example.com/foo', (string) $mock->getLastRequest()->getUri()); + } + + public function testLimitsToMaxRedirects() + { + $mock = new MockHandler([ + new Response(301, ['Location' => 'http://test.com']), + new Response(302, ['Location' => 'http://test.com']), + new Response(303, ['Location' => 'http://test.com']), + new Response(304, ['Location' => 'http://test.com']), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com'); + $promise = $handler($request, ['allow_redirects' => ['max' => 3]]); + + $this->expectException(TooManyRedirectsException::class); + $this->expectExceptionMessage('Will not follow more than 3 redirects'); + $promise->wait(); + } + + public function testTooManyRedirectsExceptionHasResponse() + { + $mock = new MockHandler([ + new Response(301, ['Location' => 'http://test.com']), + new Response(302, ['Location' => 'http://test.com']), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com'); + $promise = $handler($request, ['allow_redirects' => ['max' => 1]]); + + try { + $promise->wait(); + self::fail(); + } catch (TooManyRedirectsException $e) { + self::assertSame(302, $e->getResponse()->getStatusCode()); + } + } + + public function testEnsuresProtocolIsValid() + { + $mock = new MockHandler([ + new Response(301, ['Location' => 'ftp://test.com']), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com'); + + $this->expectException(BadResponseException::class); + $this->expectExceptionMessage('Redirect URI,'); + $handler($request, ['allow_redirects' => ['max' => 3]])->wait(); + } + + public function testAddsRefererHeader() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://test.com']), + new Response(200), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['max' => 2, 'referer' => true], + ]); + $promise->wait(); + self::assertSame( + 'http://example.com?a=b', + $mock->getLastRequest()->getHeaderLine('Referer') + ); + } + + public function testAddsRefererHeaderButClearsUserInfo() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://test.com']), + new Response(200), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://foo:bar@example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['max' => 2, 'referer' => true], + ]); + $promise->wait(); + self::assertSame( + 'http://example.com?a=b', + $mock->getLastRequest()->getHeaderLine('Referer') + ); + } + + public function testAddsGuzzleRedirectHeader() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://example.com']), + new Response(302, ['Location' => 'http://example.com/foo']), + new Response(302, ['Location' => 'http://example.com/bar']), + new Response(200), + ]); + + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['track_redirects' => true], + ]); + $response = $promise->wait(true); + self::assertSame( + [ + 'http://example.com', + 'http://example.com/foo', + 'http://example.com/bar', + ], + $response->getHeader(RedirectMiddleware::HISTORY_HEADER) + ); + } + + public function testAddsGuzzleRedirectStatusHeader() + { + $mock = new MockHandler([ + new Response(301, ['Location' => 'http://example.com']), + new Response(302, ['Location' => 'http://example.com/foo']), + new Response(301, ['Location' => 'http://example.com/bar']), + new Response(302, ['Location' => 'http://example.com/baz']), + new Response(200), + ]); + + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['track_redirects' => true], + ]); + $response = $promise->wait(true); + self::assertSame( + [ + '301', + '302', + '301', + '302', + ], + $response->getHeader(RedirectMiddleware::STATUS_HISTORY_HEADER) + ); + } + + public function testDoesNotAddRefererWhenGoingFromHttpsToHttp() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://test.com']), + new Response(200), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'https://example.com?a=b'); + $promise = $handler($request, [ + 'allow_redirects' => ['max' => 2, 'referer' => true], + ]); + $promise->wait(); + self::assertFalse($mock->getLastRequest()->hasHeader('Referer')); + } + + public function testInvokesOnRedirectForRedirects() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://test.com']), + new Response(200), + ]); + $stack = new HandlerStack($mock); + $stack->push(Middleware::redirect()); + $handler = $stack->resolve(); + $request = new Request('GET', 'http://example.com?a=b'); + $call = false; + $promise = $handler($request, [ + 'allow_redirects' => [ + 'max' => 2, + 'on_redirect' => static function ($request, $response, $uri) use (&$call) { + self::assertSame(302, $response->getStatusCode()); + self::assertSame('GET', $request->getMethod()); + self::assertSame('http://test.com', (string) $uri); + $call = true; + }, + ], + ]); + $promise->wait(); + self::assertTrue($call); + } + + /** + * @testWith ["digest"] + * ["ntlm"] + */ + public function testRemoveCurlAuthorizationOptionsOnRedirectCrossHost($auth) + { + if (!defined('\CURLOPT_HTTPAUTH')) { + self::markTestSkipped('ext-curl is required for this test'); + } + + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://test.com']), + static function (RequestInterface $request, $options) { + self::assertFalse( + isset($options['curl'][\CURLOPT_HTTPAUTH]), + 'curl options still contain CURLOPT_HTTPAUTH entry' + ); + self::assertFalse( + isset($options['curl'][\CURLOPT_USERPWD]), + 'curl options still contain CURLOPT_USERPWD entry' + ); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); + } + + /** + * @testWith ["digest"] + * ["ntlm"] + */ + public function testRemoveCurlAuthorizationOptionsOnRedirectCrossPort($auth) + { + if (!defined('\CURLOPT_HTTPAUTH')) { + self::markTestSkipped('ext-curl is required for this test'); + } + + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://example.com:81/']), + static function (RequestInterface $request, $options) { + self::assertFalse( + isset($options['curl'][\CURLOPT_HTTPAUTH]), + 'curl options still contain CURLOPT_HTTPAUTH entry' + ); + self::assertFalse( + isset($options['curl'][\CURLOPT_USERPWD]), + 'curl options still contain CURLOPT_USERPWD entry' + ); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); + } + + /** + * @testWith ["digest"] + * ["ntlm"] + */ + public function testRemoveCurlAuthorizationOptionsOnRedirectCrossScheme($auth) + { + if (!defined('\CURLOPT_HTTPAUTH')) { + self::markTestSkipped('ext-curl is required for this test'); + } + + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://example.com?a=b']), + static function (RequestInterface $request, $options) { + self::assertFalse( + isset($options['curl'][\CURLOPT_HTTPAUTH]), + 'curl options still contain CURLOPT_HTTPAUTH entry' + ); + self::assertFalse( + isset($options['curl'][\CURLOPT_USERPWD]), + 'curl options still contain CURLOPT_USERPWD entry' + ); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('https://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); + } + + /** + * @testWith ["digest"] + * ["ntlm"] + */ + public function testRemoveCurlAuthorizationOptionsOnRedirectCrossSchemeSamePort($auth) + { + if (!defined('\CURLOPT_HTTPAUTH')) { + self::markTestSkipped('ext-curl is required for this test'); + } + + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://example.com:80?a=b']), + static function (RequestInterface $request, $options) { + self::assertFalse( + isset($options['curl'][\CURLOPT_HTTPAUTH]), + 'curl options still contain CURLOPT_HTTPAUTH entry' + ); + self::assertFalse( + isset($options['curl'][\CURLOPT_USERPWD]), + 'curl options still contain CURLOPT_USERPWD entry' + ); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('https://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); + } + + /** + * @testWith ["digest"] + * ["ntlm"] + */ + public function testNotRemoveCurlAuthorizationOptionsOnRedirect($auth) + { + if (!defined('\CURLOPT_HTTPAUTH') || !defined('\CURLOPT_USERPWD')) { + self::markTestSkipped('ext-curl is required for this test'); + } + + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://example.com/2']), + static function (RequestInterface $request, $options) { + self::assertTrue( + isset($options['curl'][\CURLOPT_HTTPAUTH]), + 'curl options does not contain expected CURLOPT_HTTPAUTH entry' + ); + self::assertTrue( + isset($options['curl'][\CURLOPT_USERPWD]), + 'curl options does not contain expected CURLOPT_USERPWD entry' + ); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); + } + + public function crossOriginRedirectProvider() + { + return [ + ['http://example.com/123', 'http://example.com/', false], + ['http://example.com/123', 'http://example.com:80/', false], + ['http://example.com:80/123', 'http://example.com/', false], + ['http://example.com:80/123', 'http://example.com:80/', false], + ['http://example.com/123', 'https://example.com/', true], + ['http://example.com/123', 'http://www.example.com/', true], + ['http://example.com/123', 'http://example.com:81/', true], + ['http://example.com:80/123', 'http://example.com:81/', true], + ['https://example.com/123', 'https://example.com/', false], + ['https://example.com/123', 'https://example.com:443/', false], + ['https://example.com:443/123', 'https://example.com/', false], + ['https://example.com:443/123', 'https://example.com:443/', false], + ['https://example.com/123', 'http://example.com/', true], + ['https://example.com/123', 'https://www.example.com/', true], + ['https://example.com/123', 'https://example.com:444/', true], + ['https://example.com:443/123', 'https://example.com:444/', true], + ]; + } + + /** + * @dataProvider crossOriginRedirectProvider + */ + public function testHeadersTreatmentOnRedirect($originalUri, $targetUri, $isCrossOrigin) + { + $mock = new MockHandler([ + new Response(302, ['Location' => $targetUri]), + static function (RequestInterface $request) use ($isCrossOrigin) { + self::assertSame(!$isCrossOrigin, $request->hasHeader('Authorization')); + self::assertSame(!$isCrossOrigin, $request->hasHeader('Cookie')); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get($originalUri, ['auth' => ['testuser', 'testpass'], 'headers' => ['Cookie' => 'foo=bar']]); + } + + public function testNotRemoveAuthorizationHeaderOnRedirect() + { + $mock = new MockHandler([ + new Response(302, ['Location' => 'http://example.com/2']), + static function (RequestInterface $request) { + self::assertTrue($request->hasHeader('Authorization')); + + return new Response(200); + }, + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]); + } + + /** + * Verifies how RedirectMiddleware::modifyRequest() modifies the method and body of a request issued when + * encountering a redirect response. + * + * @dataProvider modifyRequestFollowRequyestMethodAndBodyProvider + * + * @param string $expectedFollowRequestMethod + */ + public function testModifyRequestFollowRequestMethodAndBody( + RequestInterface $request, + $expectedFollowRequestMethod + ) { + $redirectMiddleware = new RedirectMiddleware(static function () { + }); + + $options = [ + 'allow_redirects' => [ + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => null, + ], + ]; + + $modifiedRequest = $redirectMiddleware->modifyRequest($request, $options, new Response()); + + self::assertEquals($expectedFollowRequestMethod, $modifiedRequest->getMethod()); + self::assertEquals(0, $modifiedRequest->getBody()->getSize()); + } + + /** + * @return array + */ + public function modifyRequestFollowRequyestMethodAndBodyProvider() + { + return [ + 'DELETE' => [ + 'request' => new Request('DELETE', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'GET', + ], + 'GET' => [ + 'request' => new Request('GET', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'GET', + ], + 'HEAD' => [ + 'request' => new Request('HEAD', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'HEAD', + ], + 'OPTIONS' => [ + 'request' => new Request('OPTIONS', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'OPTIONS', + ], + 'PATCH' => [ + 'request' => new Request('PATCH', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'GET', + ], + 'POST' => [ + 'request' => new Request('POST', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'GET', + ], + 'PUT' => [ + 'request' => new Request('PUT', 'http://example.com/'), + 'expectedFollowRequestMethod' => 'GET', + ], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RetryMiddlewareTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RetryMiddlewareTest.php new file mode 100644 index 0000000000..090f3019b4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/RetryMiddlewareTest.php @@ -0,0 +1,85 @@ + $f]); + $p = $c->sendAsync(new Request('GET', 'http://test.com'), []); + $p->wait(); + self::assertCount(3, $calls); + self::assertSame(2, $delayCalls); + self::assertSame(202, $p->wait()->getStatusCode()); + } + + public function testDoesNotRetryWhenDeciderReturnsFalse() + { + $decider = static function () { + return false; + }; + $m = Middleware::retry($decider); + $h = new MockHandler([new Response(200)]); + $c = new Client(['handler' => $m($h)]); + $p = $c->sendAsync(new Request('GET', 'http://test.com'), []); + self::assertSame(200, $p->wait()->getStatusCode()); + } + + public function testCanRetryExceptions() + { + $calls = []; + $decider = static function (...$args) use (&$calls) { + $calls[] = $args; + + return $args[3] instanceof \Exception; + }; + $m = Middleware::retry($decider); + $h = new MockHandler([new \Exception(), new Response(201)]); + $c = new Client(['handler' => $m($h)]); + $p = $c->sendAsync(new Request('GET', 'http://test.com'), []); + self::assertSame(201, $p->wait()->getStatusCode()); + self::assertCount(2, $calls); + self::assertSame(0, $calls[0][0]); + self::assertNull($calls[0][2]); + self::assertInstanceOf('Exception', $calls[0][3]); + self::assertSame(1, $calls[1][0]); + self::assertInstanceOf(Response::class, $calls[1][2]); + self::assertNull($calls[1][3]); + } + + public function testBackoffCalculateDelay() + { + self::assertSame(0, RetryMiddleware::exponentialDelay(0)); + self::assertSame(1000, RetryMiddleware::exponentialDelay(1)); + self::assertSame(2000, RetryMiddleware::exponentialDelay(2)); + self::assertSame(4000, RetryMiddleware::exponentialDelay(3)); + self::assertSame(8000, RetryMiddleware::exponentialDelay(4)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Server.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Server.php new file mode 100644 index 0000000000..b274587dcc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/Server.php @@ -0,0 +1,208 @@ +request('DELETE', 'guzzle-server/requests'); + } + + /** + * Queue an array of responses or a single response on the server. + * + * Any currently queued responses will be overwritten. Subsequent requests + * on the server will return queued responses in FIFO order. + * + * @param array|ResponseInterface $responses A single or array of Responses + * to queue. + * + * @throws \Exception + */ + public static function enqueue($responses) + { + $data = []; + foreach ((array) $responses as $response) { + if (!($response instanceof ResponseInterface)) { + throw new \Exception('Invalid response given.'); + } + $headers = \array_map(static function ($h) { + return \implode(' ,', $h); + }, $response->getHeaders()); + + $data[] = [ + 'status' => (string) $response->getStatusCode(), + 'reason' => $response->getReasonPhrase(), + 'headers' => $headers, + 'body' => \base64_encode((string) $response->getBody()), + ]; + } + + self::getClient()->request('PUT', 'guzzle-server/responses', [ + 'json' => $data, + ]); + } + + /** + * Queue a single raw response manually, to handle cases where PSR7 response is not suitable. + * + * @param int|string $statusCode Status code for the response, e.g. 200 + * @param string $reasonPhrase Status reason response e.g "OK" + * @param array $headers Array of headers to send in response + * @param string|null $body Body to send in response + * + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public static function enqueueRaw($statusCode, $reasonPhrase, $headers, $body) + { + $data = [ + [ + 'status' => (string) $statusCode, + 'reason' => $reasonPhrase, + 'headers' => $headers, + 'body' => \base64_encode((string) $body), + ], + ]; + + self::getClient()->request('PUT', 'guzzle-server/responses', [ + 'json' => $data, + ]); + } + + /** + * Get all of the received requests + * + * @return ResponseInterface[] + * + * @throws \RuntimeException + */ + public static function received() + { + if (!self::$started) { + return []; + } + + $response = self::getClient()->request('GET', 'guzzle-server/requests'); + $data = \json_decode($response->getBody(), true); + + return \array_map( + static function ($message) { + $uri = $message['uri']; + if (isset($message['query_string'])) { + $uri .= '?'.$message['query_string']; + } + $response = new Psr7\Request( + $message['http_method'], + $uri, + $message['headers'], + $message['body'], + $message['version'] + ); + + return $response->withUri( + $response->getUri() + ->withScheme('http') + ->withHost($response->getHeaderLine('host')) + ); + }, + $data + ); + } + + /** + * Stop running the node.js server + */ + public static function stop() + { + if (self::$started) { + self::getClient()->request('DELETE', 'guzzle-server'); + } + + self::$started = false; + } + + public static function wait($maxTries = 5) + { + $tries = 0; + while (!self::isListening() && ++$tries < $maxTries) { + \usleep(50000 * $tries ** 2); + } + + if (!self::isListening()) { + throw new \RuntimeException('Unable to contact node.js server'); + } + } + + public static function start() + { + if (self::$started) { + return; + } + + if (!self::isListening()) { + \exec('node '.__DIR__.'/server.js ' + .self::$port.' >> /tmp/server.log 2>&1 &'); + self::wait(); + } + + self::$started = true; + } + + private static function isListening() + { + try { + self::getClient()->request('GET', 'guzzle-server/perf', [ + 'connect_timeout' => 5, + 'timeout' => 5, + ]); + + return true; + } catch (\Exception $e) { + return false; + } + } + + private static function getClient() + { + if (!self::$client) { + self::$client = new Client([ + 'base_uri' => self::$url, + 'sync' => true, + ]); + } + + return self::$client; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TestLogger.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TestLogger.php new file mode 100644 index 0000000000..f6e28f192b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TestLogger.php @@ -0,0 +1,99 @@ + $level, + 'message' => $message, + 'context' => $context, + ]; + + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = ['message' => $record]; + } + + return $this->hasRecordThatPasses(static function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(static function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(static function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses(callable $predicate, $level) + { + if (!isset($this->recordsByLevel[$level])) { + return false; + } + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if ($predicate($rec, $i)) { + return true; + } + } + + return false; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1].('Records' !== $matches[3] ? 'Record' : '').$matches[3]; + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + + return ($this->{$genericMethod})(...$args); + } + } + throw new \BadMethodCallException('Call to undefined method '.static::class.'::'.$method.'()'); + } + + public function reset() + { + $this->records = []; + $this->recordsByLevel = []; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TransferStatsTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TransferStatsTest.php new file mode 100644 index 0000000000..79a4488547 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/TransferStatsTest.php @@ -0,0 +1,31 @@ + 'bar'] + ); + self::assertSame($request, $stats->getRequest()); + self::assertSame($response, $stats->getResponse()); + self::assertTrue($stats->hasResponse()); + self::assertSame(['foo' => 'bar'], $stats->getHandlerStats()); + self::assertSame('bar', $stats->getHandlerStat('foo')); + self::assertSame($request->getUri(), $stats->getEffectiveUri()); + self::assertEquals(10.5, $stats->getTransferTime()); + self::assertNull($stats->getHandlerErrorData()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/UtilsTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/UtilsTest.php new file mode 100644 index 0000000000..9eb50320a5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/UtilsTest.php @@ -0,0 +1,198 @@ + ['bar', 'baz'], + 'Abc' => ['123'], + 'Def' => ['a, b'], + ]; + + self::assertSame($expected, Utils::headersFromLines($lines)); + self::assertSame($expected, GuzzleHttp\headers_from_lines($lines)); + } + + public function testParsesHeadersFromLinesWithMultipleLines() + { + $lines = ['Foo: bar', 'Foo: baz', 'Foo: 123']; + $expected = ['Foo' => ['bar', 'baz', '123']]; + + self::assertSame($expected, Utils::headersFromLines($lines)); + self::assertSame($expected, GuzzleHttp\headers_from_lines($lines)); + } + + public function testChooseHandler() + { + self::assertIsCallable(Utils::chooseHandler()); + self::assertIsCallable(GuzzleHttp\choose_handler()); + } + + public function testDefaultUserAgent() + { + self::assertIsString(Utils::defaultUserAgent()); + self::assertIsString(GuzzleHttp\default_user_agent()); + } + + public function testReturnsDebugResource() + { + self::assertIsResource(Utils::debugResource()); + self::assertIsResource(GuzzleHttp\debug_resource()); + } + + public function testProvidesDefaultCaBundler() + { + self::assertFileExists(Utils::defaultCaBundle()); + self::assertFileExists(GuzzleHttp\default_ca_bundle()); + } + + public function testNormalizeHeaderKeys() + { + $input = ['HelLo' => 'foo', 'WORld' => 'bar']; + $expected = ['hello' => 'HelLo', 'world' => 'WORld']; + + self::assertSame($expected, Utils::normalizeHeaderKeys($input)); + self::assertSame($expected, GuzzleHttp\normalize_header_keys($input)); + } + + public function noProxyProvider() + { + return [ + ['mit.edu', ['.mit.edu'], false], + ['foo.mit.edu', ['.mit.edu'], true], + ['foo.mit.edu:123', ['.mit.edu'], true], + ['mit.edu', ['mit.edu'], true], + ['mit.edu', ['baz', 'mit.edu'], true], + ['mit.edu', ['', '', 'mit.edu'], true], + ['mit.edu', ['baz', '*'], true], + ]; + } + + /** + * @dataProvider noproxyProvider + */ + public function testChecksNoProxyList($host, $list, $result) + { + self::assertSame($result, Utils::isHostInNoProxy($host, $list)); + self::assertSame($result, \GuzzleHttp\is_host_in_noproxy($host, $list)); + } + + public function testEnsuresNoProxyCheckHostIsSet() + { + $this->expectException(\InvalidArgumentException::class); + + Utils::isHostInNoProxy('', []); + } + + public function testEnsuresNoProxyCheckHostIsSetLegacy() + { + $this->expectException(\InvalidArgumentException::class); + + \GuzzleHttp\is_host_in_noproxy('', []); + } + + public function testEncodesJson() + { + self::assertSame('true', Utils::jsonEncode(true)); + self::assertSame('true', \GuzzleHttp\json_encode(true)); + } + + public function testEncodesJsonAndThrowsOnError() + { + $this->expectException(\InvalidArgumentException::class); + + Utils::jsonEncode("\x99"); + } + + public function testEncodesJsonAndThrowsOnErrorLegacy() + { + $this->expectException(\InvalidArgumentException::class); + + \GuzzleHttp\json_encode("\x99"); + } + + public function testDecodesJson() + { + self::assertTrue(Utils::jsonDecode('true')); + self::assertTrue(\GuzzleHttp\json_decode('true')); + } + + public function testDecodesJsonAndThrowsOnError() + { + $this->expectException(\InvalidArgumentException::class); + + Utils::jsonDecode('{{]]'); + } + + public function testDecodesJsonAndThrowsOnErrorLegacy() + { + $this->expectException(\InvalidArgumentException::class); + + \GuzzleHttp\json_decode('{{]]'); + } +} + +final class StrClass +{ + public function __toString() + { + return 'foo'; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/bootstrap-phpstan.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/bootstrap-phpstan.php new file mode 100644 index 0000000000..187ab68e62 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/tests/bootstrap-phpstan.php @@ -0,0 +1,9 @@ + DELETE /guzzle-server/requests + * > Host: 127.0.0.1:8126 + * + * - Enqueue responses + * > PUT /guzzle-server/responses + * > Host: 127.0.0.1:8126 + * > + * > [{'status': 200, 'reason': 'OK', 'headers': {}, 'body': '' }] + * + * - Get the received requests + * > GET /guzzle-server/requests + * > Host: 127.0.0.1:8126 + * + * < HTTP/1.1 200 OK + * < + * < [{'http_method': 'GET', 'uri': '/', 'headers': {}, 'body': 'string'}] + * + * - Attempt access to the secure area + * > GET /secure/by-digest/qop-auth/guzzle-server/requests + * > Host: 127.0.0.1:8126 + * + * < HTTP/1.1 401 Unauthorized + * < WWW-Authenticate: Digest realm="Digest Test", qop="auth", nonce="0796e98e1aeef43141fab2a66bf4521a", algorithm="MD5", stale="false" + * < + * < 401 Unauthorized + * + * - Shutdown the server + * > DELETE /guzzle-server + * > Host: 127.0.0.1:8126 + * + * @package Guzzle PHP + * @license See the LICENSE file that was distributed with this source code. + */ + +var http = require('http'); +var url = require('url'); + +/** + * Guzzle node.js server + * @class + */ +var GuzzleServer = function(port, log) { + + this.port = port; + this.log = log; + this.responses = []; + this.requests = []; + var that = this; + + var md5 = function(input) { + var crypto = require('crypto'); + var hasher = crypto.createHash('md5'); + hasher.update(input); + return hasher.digest('hex'); + }; + + /** + * Node.js HTTP server authentication module. + * + * It is only initialized on demand (by loadAuthentifier). This avoids + * requiring the dependency to http-auth on standard operations, and the + * performance hit at startup. + */ + var auth; + + /** + * Provides authentication handlers (Basic, Digest). + */ + var loadAuthentifier = function(type, options) { + var typeId = type; + if (type == 'digest') { + typeId += '.'+(options && options.qop ? options.qop : 'none'); + } + if (!loadAuthentifier[typeId]) { + if (!auth) { + try { + auth = require('http-auth'); + } catch (e) { + if (e.code == 'MODULE_NOT_FOUND') { + return; + } + } + } + switch (type) { + case 'digest': + var digestParams = { + realm: 'Digest Test', + login: 'me', + password: 'test' + }; + if (options && options.qop) { + digestParams.qop = options.qop; + } + loadAuthentifier[typeId] = auth.digest(digestParams, function(username, callback) { + callback(md5(digestParams.login + ':' + digestParams.realm + ':' + digestParams.password)); + }); + break + } + } + return loadAuthentifier[typeId]; + }; + + var firewallRequest = function(request, req, res, requestHandlerCallback) { + var securedAreaUriParts = request.uri.match(/^\/secure\/by-(digest)(\/qop-([^\/]*))?(\/.*)$/); + if (securedAreaUriParts) { + var authentifier = loadAuthentifier(securedAreaUriParts[1], { qop: securedAreaUriParts[2] }); + if (!authentifier) { + res.writeHead(501, 'HTTP authentication not implemented', { 'Content-Length': 0 }); + res.end(); + return; + } + authentifier.check(req, res, function(req, res) { + req.url = securedAreaUriParts[4]; + requestHandlerCallback(request, req, res); + }); + } else { + requestHandlerCallback(request, req, res); + } + }; + + var controlRequest = function(request, req, res) { + if (req.url == '/guzzle-server/garbage') { + if (that.log) { + console.log('returning garbage') + } + res.socket.end("220 example.com ESMTP\r\n200 This is garbage\r\n\r\n"); + } else if (req.url == '/guzzle-server/bad-status') { + if (that.log) { + console.log('returning bad status code') + } + res.writeHead(700, 'BAD', {'Content-Length': 16}); + res.end('Body of response'); + } else if (req.url == '/guzzle-server/perf') { + res.writeHead(200, 'OK', {'Content-Length': 16}); + res.end('Body of response'); + } else if (req.method == 'DELETE') { + if (req.url == '/guzzle-server/requests') { + // Clear the received requests + that.requests = []; + res.writeHead(200, 'OK', { 'Content-Length': 0 }); + res.end(); + if (that.log) { + console.log('Flushing requests'); + } + } else if (req.url == '/guzzle-server') { + // Shutdown the server + res.writeHead(200, 'OK', { 'Content-Length': 0, 'Connection': 'close' }); + res.end(); + if (that.log) { + console.log('Shutting down'); + } + that.server.close(); + } + } else if (req.method == 'GET') { + if (req.url === '/guzzle-server/requests') { + if (that.log) { + console.log('Sending received requests'); + } + // Get received requests + var body = JSON.stringify(that.requests); + res.writeHead(200, 'OK', { 'Content-Length': body.length }); + res.end(body); + } else if (req.url == '/guzzle-server/read-timeout') { + if (that.log) { + console.log('Sleeping'); + } + res.writeHead(200, 'OK'); + res.write("sleeping 60 seconds ...\n"); + setTimeout(function () { + res.end("slept 60 seconds\n"); + }, 60*1000); + } + } else if (req.method == 'PUT' && req.url == '/guzzle-server/responses') { + if (that.log) { + console.log('Adding responses...'); + } + if (!request.body) { + if (that.log) { + console.log('No response data was provided'); + } + res.writeHead(400, 'NO RESPONSES IN REQUEST', { 'Content-Length': 0 }); + } else { + that.responses = JSON.parse(request.body); + for (var i = 0; i < that.responses.length; i++) { + if (that.responses[i].body) { + that.responses[i].body = Buffer.from(that.responses[i].body, 'base64'); + } + } + if (that.log) { + console.log(that.responses); + } + res.writeHead(200, 'OK', { 'Content-Length': 0 }); + } + res.end(); + } + }; + + var receivedRequest = function(request, req, res) { + if (req.url.indexOf('/guzzle-server') === 0) { + controlRequest(request, req, res); + } else if (req.url.indexOf('/guzzle-server') == -1 && !that.responses.length) { + res.writeHead(500); + res.end('No responses in queue'); + } else { + if (that.log) { + console.log('Returning response from queue and adding request'); + } + that.requests.push(request); + var response = that.responses.shift(); + res.writeHead(response.status, response.reason, response.headers); + res.end(response.body); + } + }; + + this.start = function() { + + that.server = http.createServer(function(req, res) { + + var parts = url.parse(req.url, false); + var request = { + http_method: req.method, + scheme: parts.scheme, + uri: parts.pathname, + query_string: parts.query, + headers: req.headers, + version: req.httpVersion, + body: '' + }; + + // Receive each chunk of the request body + req.addListener('data', function(chunk) { + request.body += chunk; + }); + + // Called when the request completes + req.addListener('end', function() { + firewallRequest(request, req, res, receivedRequest); + }); + }); + + that.server.listen(this.port, '127.0.0.1'); + + if (this.log) { + console.log('Server running at http://127.0.0.1:8126/'); + } + }; +}; + +// Get the port from the arguments +port = process.argv.length >= 3 ? process.argv[2] : 8126; +log = process.argv.length >= 4 ? process.argv[3] : false; + +// Start the server +server = new GuzzleServer(port, log); +server.start(); diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/php-cs-fixer/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/php-cs-fixer/composer.json new file mode 100644 index 0000000000..72998c7515 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/php-cs-fixer/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "friendsofphp/php-cs-fixer": "3.59.3" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/phpstan/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/phpstan/composer.json new file mode 100644 index 0000000000..77598be97b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/phpstan/composer.json @@ -0,0 +1,10 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "1.11.7", + "phpstan/phpstan-deprecation-rules": "1.2.0" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/psalm/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/psalm/composer.json new file mode 100644 index 0000000000..020abe5626 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/guzzle/vendor-bin/psalm/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "psalm/phar": "5.25.0" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.editorconfig b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.editorconfig new file mode 100644 index 0000000000..677e36e295 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitattributes b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitattributes new file mode 100644 index 0000000000..faed8b0488 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitattributes @@ -0,0 +1,13 @@ +.editorconfig export-ignore +.gitattributes export-ignore +/.github/ export-ignore +.gitignore export-ignore +/.php-cs-fixer.dist.php export-ignore +/phpstan-baseline.neon export-ignore +/phpstan.neon.dist export-ignore +/phpunit.xml.dist export-ignore +/psalm-baseline.xml export-ignore +/psalm.xml export-ignore +/tests/ export-ignore +/vendor-bin/ export-ignore +/Makefile export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/.editorconfig b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/.editorconfig new file mode 100644 index 0000000000..7bd3346f26 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/.editorconfig @@ -0,0 +1,2 @@ +[*.yml] +indent_size = 2 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/FUNDING.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/FUNDING.yml new file mode 100644 index 0000000000..d00f85ddd9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [Nyholm, GrahamCampbell] +tidelift: "packagist/guzzlehttp/promises" diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/stale.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/stale.yml new file mode 100644 index 0000000000..53faa71bd9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/stale.yml @@ -0,0 +1,14 @@ +daysUntilStale: 120 +daysUntilClose: 14 +exemptLabels: + - lifecycle/keep-open + - lifecycle/ready-for-merge +# Label to use when marking an issue as stale +staleLabel: lifecycle/stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/checks.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/checks.yml new file mode 100644 index 0000000000..aa01ed09ca --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/checks.yml @@ -0,0 +1,21 @@ +name: Checks + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + composer-normalize: + name: Composer Normalize + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Composer normalize + uses: docker://ergebnis/composer-normalize-action diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/ci.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/ci.yml new file mode 100644 index 0000000000..279bdcf526 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + build-lowest-version: + name: Build lowest version + runs-on: ubuntu-22.04 + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.2' + ini-values: error_reporting=E_ALL + coverage: 'none' + extensions: mbstring + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: composer update --no-interaction --prefer-stable --prefer-lowest --no-progress + + - name: Run tests + run: vendor/bin/phpunit + + build: + name: Build + runs-on: ubuntu-22.04 + strategy: + max-parallel: 10 + matrix: + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + coverage: 'none' + extensions: mbstring + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: composer update --no-interaction --no-progress + + - name: Run tests + run: vendor/bin/phpunit diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/static.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/static.yml new file mode 100644 index 0000000000..235e8a90ef --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.github/workflows/static.yml @@ -0,0 +1,82 @@ +name: Static analysis + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download PHPStan + run: composer bin phpstan update --no-interaction --no-progress + + - name: Execute PHPStan + run: vendor/bin/phpstan analyze --no-progress + + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download PHP CS Fixer + run: composer bin php-cs-fixer update --no-interaction --no-progress + + - name: Execute PHP CS Fixer + run: vendor/bin/php-cs-fixer fix --diff --dry-run + + psalm: + name: Psalm + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download Psalm + run: composer bin psalm update --no-interaction --no-progress + + - name: Execute Psalm + run: vendor/bin/psalm.phar --no-progress --output-format=github diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitignore b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitignore new file mode 100644 index 0000000000..09d91da6ef --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.gitignore @@ -0,0 +1,7 @@ +artifacts/ +vendor/ +composer.lock +phpunit.xml +.php-cs-fixer.php +.php-cs-fixer.cache +.phpunit.result.cache diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.php-cs-fixer.dist.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.php-cs-fixer.dist.php new file mode 100644 index 0000000000..77b06848da --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/.php-cs-fixer.dist.php @@ -0,0 +1,28 @@ +setRiskyAllowed(true) + ->setRules([ + '@PHP71Migration:risky' => true, + '@PHPUnit75Migration:risky' => true, + '@PSR12:risky' => true, + '@Symfony' => true, + 'global_namespace_import' => false, + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + ], + 'phpdoc_annotation_without_dot' => false, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => false, + 'single_line_throw' => false, + 'yoda_style' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') + ->name('*.php') + ) +; + +return $config; diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/CHANGELOG.md new file mode 100644 index 0000000000..707925a0bf --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/CHANGELOG.md @@ -0,0 +1,159 @@ +# CHANGELOG + + +## 2.0.3 - 2024-07-18 + +### Changed + +- PHP 8.4 support + + +## 2.0.2 - 2023-12-03 + +### Changed + +- Replaced `call_user_func*` with native calls + + +## 2.0.1 - 2023-08-03 + +### Changed + +- PHP 8.3 support + + +## 2.0.0 - 2023-05-21 + +### Added + +- Added PHP 7 type hints + +### Changed + +- All previously non-final non-exception classes have been marked as soft-final + +### Removed + +- Dropped PHP < 7.2 support +- All functions in the `GuzzleHttp\Promise` namespace + + +## 1.5.3 - 2023-05-21 + +### Changed + +- Removed remaining usage of deprecated functions + + +## 1.5.2 - 2022-08-07 + +### Changed + +- Officially support PHP 8.2 + + +## 1.5.1 - 2021-10-22 + +### Fixed + +- Revert "Call handler when waiting on fulfilled/rejected Promise" +- Fix pool memory leak when empty array of promises provided + + +## 1.5.0 - 2021-10-07 + +### Changed + +- Call handler when waiting on fulfilled/rejected Promise +- Officially support PHP 8.1 + +### Fixed + +- Fix manually settle promises generated with `Utils::task` + + +## 1.4.1 - 2021-02-18 + +### Fixed + +- Fixed `each_limit` skipping promises and failing + + +## 1.4.0 - 2020-09-30 + +### Added + +- Support for PHP 8 +- Optional `$recursive` flag to `all` +- Replaced functions by static methods + +### Fixed + +- Fix empty `each` processing +- Fix promise handling for Iterators of non-unique keys +- Fixed `method_exists` crashes on PHP 8 +- Memory leak on exceptions + + +## 1.3.1 - 2016-12-20 + +### Fixed + +- `wait()` foreign promise compatibility + + +## 1.3.0 - 2016-11-18 + +### Added + +- Adds support for custom task queues. + +### Fixed + +- Fixed coroutine promise memory leak. + + +## 1.2.0 - 2016-05-18 + +### Changed + +- Update to now catch `\Throwable` on PHP 7+ + + +## 1.1.0 - 2016-03-07 + +### Changed + +- Update EachPromise to prevent recurring on a iterator when advancing, as this + could trigger fatal generator errors. +- Update Promise to allow recursive waiting without unwrapping exceptions. + + +## 1.0.3 - 2015-10-15 + +### Changed + +- Update EachPromise to immediately resolve when the underlying promise iterator + is empty. Previously, such a promise would throw an exception when its `wait` + function was called. + + +## 1.0.2 - 2015-05-15 + +### Changed + +- Conditionally require functions.php. + + +## 1.0.1 - 2015-06-24 + +### Changed + +- Updating EachPromise to call next on the underlying promise iterator as late + as possible to ensure that generators that generate new requests based on + callbacks are not iterated until after callbacks are invoked. + + +## 1.0.0 - 2015-05-12 + +- Initial release diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/LICENSE b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/LICENSE new file mode 100644 index 0000000000..9f0f943be8 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/LICENSE @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) 2015 Michael Dowling +Copyright (c) 2015 Graham Campbell +Copyright (c) 2017 Tobias Schultze +Copyright (c) 2020 Tobias Nyholm + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/Makefile b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/Makefile new file mode 100644 index 0000000000..8d5b3ef95e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/Makefile @@ -0,0 +1,13 @@ +all: clean test + +test: + vendor/bin/phpunit + +coverage: + vendor/bin/phpunit --coverage-html=artifacts/coverage + +view-coverage: + open artifacts/coverage/index.html + +clean: + rm -rf artifacts/* diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/README.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/README.md new file mode 100644 index 0000000000..d1c814fe7d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/README.md @@ -0,0 +1,559 @@ +# Guzzle Promises + +[Promises/A+](https://promisesaplus.com/) implementation that handles promise +chaining and resolution iteratively, allowing for "infinite" promise chaining +while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) +for a general introduction to promises. + +- [Features](#features) +- [Quick start](#quick-start) +- [Synchronous wait](#synchronous-wait) +- [Cancellation](#cancellation) +- [API](#api) + - [Promise](#promise) + - [FulfilledPromise](#fulfilledpromise) + - [RejectedPromise](#rejectedpromise) +- [Promise interop](#promise-interop) +- [Implementation notes](#implementation-notes) + + +## Features + +- [Promises/A+](https://promisesaplus.com/) implementation. +- Promise resolution and chaining is handled iteratively, allowing for + "infinite" promise chaining. +- Promises have a synchronous `wait` method. +- Promises can be cancelled. +- Works with any object that has a `then` function. +- C# style async/await coroutine promises using + `GuzzleHttp\Promise\Coroutine::of()`. + + +## Installation + +```shell +composer require guzzlehttp/promises +``` + + +## Version Guidance + +| Version | Status | PHP Version | +|---------|---------------------|--------------| +| 1.x | Security fixes only | >=5.5,<8.3 | +| 2.x | Latest | >=7.2.5,<8.5 | + + +## Quick Start + +A *promise* represents the eventual result of an asynchronous operation. The +primary way of interacting with a promise is through its `then` method, which +registers callbacks to receive either a promise's eventual value or the reason +why the promise cannot be fulfilled. + +### Callbacks + +Callbacks are registered with the `then` method by providing an optional +`$onFulfilled` followed by an optional `$onRejected` function. + + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then( + // $onFulfilled + function ($value) { + echo 'The promise was fulfilled.'; + }, + // $onRejected + function ($reason) { + echo 'The promise was rejected.'; + } +); +``` + +*Resolving* a promise means that you either fulfill a promise with a *value* or +reject a promise with a *reason*. Resolving a promise triggers callbacks +registered with the promise's `then` method. These callbacks are triggered +only once and in the order in which they were added. + +### Resolving a Promise + +Promises are fulfilled using the `resolve($value)` method. Resolving a promise +with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger +all of the onFulfilled callbacks (resolving a promise with a rejected promise +will reject the promise and trigger the `$onRejected` callbacks). + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise + ->then(function ($value) { + // Return a value and don't break the chain + return "Hello, " . $value; + }) + // This then is executed after the first then and receives the value + // returned from the first then. + ->then(function ($value) { + echo $value; + }); + +// Resolving the promise triggers the $onFulfilled callbacks and outputs +// "Hello, reader." +$promise->resolve('reader.'); +``` + +### Promise Forwarding + +Promises can be chained one after the other. Each then in the chain is a new +promise. The return value of a promise is what's forwarded to the next +promise in the chain. Returning a promise in a `then` callback will cause the +subsequent promises in the chain to only be fulfilled when the returned promise +has been fulfilled. The next promise in the chain will be invoked with the +resolved value of the promise. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$nextPromise = new Promise(); + +$promise + ->then(function ($value) use ($nextPromise) { + echo $value; + return $nextPromise; + }) + ->then(function ($value) { + echo $value; + }); + +// Triggers the first callback and outputs "A" +$promise->resolve('A'); +// Triggers the second callback and outputs "B" +$nextPromise->resolve('B'); +``` + +### Promise Rejection + +When a promise is rejected, the `$onRejected` callbacks are invoked with the +rejection reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + echo $reason; +}); + +$promise->reject('Error!'); +// Outputs "Error!" +``` + +### Rejection Forwarding + +If an exception is thrown in an `$onRejected` callback, subsequent +`$onRejected` callbacks are invoked with the thrown exception as the reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + throw new Exception($reason); +})->then(null, function ($reason) { + assert($reason->getMessage() === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +You can also forward a rejection down the promise chain by returning a +`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or +`$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + return new RejectedPromise($reason); +})->then(null, function ($reason) { + assert($reason === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +If an exception is not thrown in a `$onRejected` callback and the callback +does not return a rejected promise, downstream `$onFulfilled` callbacks are +invoked using the value returned from the `$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise + ->then(null, function ($reason) { + return "It's ok"; + }) + ->then(function ($value) { + assert($value === "It's ok"); + }); + +$promise->reject('Error!'); +``` + + +## Synchronous Wait + +You can synchronously force promises to complete using a promise's `wait` +method. When creating a promise, you can provide a wait function that is used +to synchronously force a promise to complete. When a wait function is invoked +it is expected to deliver a value to the promise or reject the promise. If the +wait function does not deliver a value, then an exception is thrown. The wait +function provided to a promise constructor is invoked when the `wait` function +of the promise is called. + +```php +$promise = new Promise(function () use (&$promise) { + $promise->resolve('foo'); +}); + +// Calling wait will return the value of the promise. +echo $promise->wait(); // outputs "foo" +``` + +If an exception is encountered while invoking the wait function of a promise, +the promise is rejected with the exception and the exception is thrown. + +```php +$promise = new Promise(function () use (&$promise) { + throw new Exception('foo'); +}); + +$promise->wait(); // throws the exception. +``` + +Calling `wait` on a promise that has been fulfilled will not trigger the wait +function. It will simply return the previously resolved value. + +```php +$promise = new Promise(function () { die('this is not called!'); }); +$promise->resolve('foo'); +echo $promise->wait(); // outputs "foo" +``` + +Calling `wait` on a promise that has been rejected will throw an exception. If +the rejection reason is an instance of `\Exception` the reason is thrown. +Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason +can be obtained by calling the `getReason` method of the exception. + +```php +$promise = new Promise(); +$promise->reject('foo'); +$promise->wait(); +``` + +> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' + +### Unwrapping a Promise + +When synchronously waiting on a promise, you are joining the state of the +promise into the current state of execution (i.e., return the value of the +promise if it was fulfilled or throw an exception if it was rejected). This is +called "unwrapping" the promise. Waiting on a promise will by default unwrap +the promise state. + +You can force a promise to resolve and *not* unwrap the state of the promise +by passing `false` to the first argument of the `wait` function: + +```php +$promise = new Promise(); +$promise->reject('foo'); +// This will not throw an exception. It simply ensures the promise has +// been resolved. +$promise->wait(false); +``` + +When unwrapping a promise, the resolved value of the promise will be waited +upon until the unwrapped value is not a promise. This means that if you resolve +promise A with a promise B and unwrap promise A, the value returned by the +wait function will be the value delivered to promise B. + +**Note**: when you do not unwrap the promise, no value is returned. + + +## Cancellation + +You can cancel a promise that has not yet been fulfilled using the `cancel()` +method of a promise. When creating a promise you can provide an optional +cancel function that when invoked cancels the action of computing a resolution +of the promise. + + +## API + +### Promise + +When creating a promise object, you can provide an optional `$waitFn` and +`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is +expected to resolve the promise. `$cancelFn` is a function with no arguments +that is expected to cancel the computation of a promise. It is invoked when the +`cancel()` method of a promise is called. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise( + function () use (&$promise) { + $promise->resolve('waited'); + }, + function () { + // do something that will cancel the promise computation (e.g., close + // a socket, cancel a database query, etc...) + } +); + +assert('waited' === $promise->wait()); +``` + +A promise has the following methods: + +- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` + + Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. + +- `otherwise(callable $onRejected) : PromiseInterface` + + Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. + +- `wait($unwrap = true) : mixed` + + Synchronously waits on the promise to complete. + + `$unwrap` controls whether or not the value of the promise is returned for a + fulfilled promise or if an exception is thrown if the promise is rejected. + This is set to `true` by default. + +- `cancel()` + + Attempts to cancel the promise if possible. The promise being cancelled and + the parent most ancestor that has not yet been resolved will also be + cancelled. Any promises waiting on the cancelled promise to resolve will also + be cancelled. + +- `getState() : string` + + Returns the state of the promise. One of `pending`, `fulfilled`, or + `rejected`. + +- `resolve($value)` + + Fulfills the promise with the given `$value`. + +- `reject($reason)` + + Rejects the promise with the given `$reason`. + + +### FulfilledPromise + +A fulfilled promise can be created to represent a promise that has been +fulfilled. + +```php +use GuzzleHttp\Promise\FulfilledPromise; + +$promise = new FulfilledPromise('value'); + +// Fulfilled callbacks are immediately invoked. +$promise->then(function ($value) { + echo $value; +}); +``` + + +### RejectedPromise + +A rejected promise can be created to represent a promise that has been +rejected. + +```php +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new RejectedPromise('Error'); + +// Rejected callbacks are immediately invoked. +$promise->then(null, function ($reason) { + echo $reason; +}); +``` + + +## Promise Interoperability + +This library works with foreign promises that have a `then` method. This means +you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) +for example. When a foreign promise is returned inside of a then method +callback, promise resolution will occur recursively. + +```php +// Create a React promise +$deferred = new React\Promise\Deferred(); +$reactPromise = $deferred->promise(); + +// Create a Guzzle promise that is fulfilled with a React promise. +$guzzlePromise = new GuzzleHttp\Promise\Promise(); +$guzzlePromise->then(function ($value) use ($reactPromise) { + // Do something something with the value... + // Return the React promise + return $reactPromise; +}); +``` + +Please note that wait and cancel chaining is no longer possible when forwarding +a foreign promise. You will need to wrap a third-party promise with a Guzzle +promise in order to utilize wait and cancel functions with foreign promises. + + +### Event Loop Integration + +In order to keep the stack size constant, Guzzle promises are resolved +asynchronously using a task queue. When waiting on promises synchronously, the +task queue will be automatically run to ensure that the blocking promise and +any forwarded promises are resolved. When using promises asynchronously in an +event loop, you will need to run the task queue on each tick of the loop. If +you do not run the task queue, then promises will not be resolved. + +You can run the task queue using the `run()` method of the global task queue +instance. + +```php +// Get the global task queue +$queue = GuzzleHttp\Promise\Utils::queue(); +$queue->run(); +``` + +For example, you could use Guzzle promises with React using a periodic timer: + +```php +$loop = React\EventLoop\Factory::create(); +$loop->addPeriodicTimer(0, [$queue, 'run']); +``` + + +## Implementation Notes + +### Promise Resolution and Chaining is Handled Iteratively + +By shuffling pending handlers from one owner to another, promises are +resolved iteratively, allowing for "infinite" then chaining. + +```php +then(function ($v) { + // The stack size remains constant (a good thing) + echo xdebug_get_stack_depth() . ', '; + return $v + 1; + }); +} + +$parent->resolve(0); +var_dump($p->wait()); // int(1000) + +``` + +When a promise is fulfilled or rejected with a non-promise value, the promise +then takes ownership of the handlers of each child promise and delivers values +down the chain without using recursion. + +When a promise is resolved with another promise, the original promise transfers +all of its pending handlers to the new promise. When the new promise is +eventually resolved, all of the pending handlers are delivered the forwarded +value. + +### A Promise is the Deferred + +Some promise libraries implement promises using a deferred object to represent +a computation and a promise object to represent the delivery of the result of +the computation. This is a nice separation of computation and delivery because +consumers of the promise cannot modify the value that will be eventually +delivered. + +One side effect of being able to implement promise resolution and chaining +iteratively is that you need to be able for one promise to reach into the state +of another promise to shuffle around ownership of handlers. In order to achieve +this without making the handlers of a promise publicly mutable, a promise is +also the deferred value, allowing promises of the same parent class to reach +into and modify the private properties of promises of the same type. While this +does allow consumers of the value to modify the resolution or rejection of the +deferred, it is a small price to pay for keeping the stack size constant. + +```php +$promise = new Promise(); +$promise->then(function ($value) { echo $value; }); +// The promise is the deferred value, so you can deliver a value to it. +$promise->resolve('foo'); +// prints "foo" +``` + + +## Upgrading from Function API + +A static API was first introduced in 1.4.0, in order to mitigate problems with +functions conflicting between global and local copies of the package. The +function API was removed in 2.0.0. A migration table has been provided here for +your convenience: + +| Original Function | Replacement Method | +|----------------|----------------| +| `queue` | `Utils::queue` | +| `task` | `Utils::task` | +| `promise_for` | `Create::promiseFor` | +| `rejection_for` | `Create::rejectionFor` | +| `exception_for` | `Create::exceptionFor` | +| `iter_for` | `Create::iterFor` | +| `inspect` | `Utils::inspect` | +| `inspect_all` | `Utils::inspectAll` | +| `unwrap` | `Utils::unwrap` | +| `all` | `Utils::all` | +| `some` | `Utils::some` | +| `any` | `Utils::any` | +| `settle` | `Utils::settle` | +| `each` | `Each::of` | +| `each_limit` | `Each::ofLimit` | +| `each_limit_all` | `Each::ofLimitAll` | +| `!is_fulfilled` | `Is::pending` | +| `is_fulfilled` | `Is::fulfilled` | +| `is_rejected` | `Is::rejected` | +| `is_settled` | `Is::settled` | +| `coroutine` | `Coroutine::of` | + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/promises/security/policy) for more information. + + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-promises?utm_source=packagist-guzzlehttp-promises&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/composer.json new file mode 100644 index 0000000000..f64ed7714e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/composer.json @@ -0,0 +1,58 @@ +{ + "name": "guzzlehttp/promises", + "description": "Guzzle promises library", + "keywords": ["promise"], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Promise\\Tests\\": "tests/" + } + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan-baseline.neon b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan-baseline.neon new file mode 100644 index 0000000000..2c6c4346ab --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan-baseline.neon @@ -0,0 +1,7 @@ +parameters: + ignoreErrors: + - + message: "#^Dead catch \\- GuzzleHttp\\\\Promise\\\\RejectionException is never thrown in the try block\\.$#" + count: 1 + path: src/Utils.php + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan.neon.dist b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan.neon.dist new file mode 100644 index 0000000000..bc0f2c3a4f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpstan.neon.dist @@ -0,0 +1,7 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 5 + paths: + - src diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpunit.xml.dist b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpunit.xml.dist new file mode 100644 index 0000000000..6163dba5b0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/phpunit.xml.dist @@ -0,0 +1,21 @@ + + + + + tests/ + + + + + src/ + + src/ + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm-baseline.xml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm-baseline.xml new file mode 100644 index 0000000000..7bf39a80e9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm-baseline.xml @@ -0,0 +1,2 @@ + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm.xml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm.xml new file mode 100644 index 0000000000..10238ae0a9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/AggregateException.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/AggregateException.php new file mode 100644 index 0000000000..40ffdbcf11 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/AggregateException.php @@ -0,0 +1,19 @@ +then(function ($v) { echo $v; }); + * + * @param callable $generatorFn Generator function to wrap into a promise. + * + * @return Promise + * + * @see https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration + */ +final class Coroutine implements PromiseInterface +{ + /** + * @var PromiseInterface|null + */ + private $currentPromise; + + /** + * @var Generator + */ + private $generator; + + /** + * @var Promise + */ + private $result; + + public function __construct(callable $generatorFn) + { + $this->generator = $generatorFn(); + $this->result = new Promise(function (): void { + while (isset($this->currentPromise)) { + $this->currentPromise->wait(); + } + }); + try { + $this->nextCoroutine($this->generator->current()); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * Create a new coroutine. + */ + public static function of(callable $generatorFn): self + { + return new self($generatorFn); + } + + public function then( + ?callable $onFulfilled = null, + ?callable $onRejected = null + ): PromiseInterface { + return $this->result->then($onFulfilled, $onRejected); + } + + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->result->otherwise($onRejected); + } + + public function wait(bool $unwrap = true) + { + return $this->result->wait($unwrap); + } + + public function getState(): string + { + return $this->result->getState(); + } + + public function resolve($value): void + { + $this->result->resolve($value); + } + + public function reject($reason): void + { + $this->result->reject($reason); + } + + public function cancel(): void + { + $this->currentPromise->cancel(); + $this->result->cancel(); + } + + private function nextCoroutine($yielded): void + { + $this->currentPromise = Create::promiseFor($yielded) + ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); + } + + /** + * @internal + */ + public function _handleSuccess($value): void + { + unset($this->currentPromise); + try { + $next = $this->generator->send($value); + if ($this->generator->valid()) { + $this->nextCoroutine($next); + } else { + $this->result->resolve($value); + } + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * @internal + */ + public function _handleFailure($reason): void + { + unset($this->currentPromise); + try { + $nextYield = $this->generator->throw(Create::exceptionFor($reason)); + // The throw was caught, so keep iterating on the coroutine + $this->nextCoroutine($nextYield); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Create.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Create.php new file mode 100644 index 0000000000..9d3fc4a1e3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Create.php @@ -0,0 +1,79 @@ +then([$promise, 'resolve'], [$promise, 'reject']); + + return $promise; + } + + return new FulfilledPromise($value); + } + + /** + * Creates a rejected promise for a reason if the reason is not a promise. + * If the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + */ + public static function rejectionFor($reason): PromiseInterface + { + if ($reason instanceof PromiseInterface) { + return $reason; + } + + return new RejectedPromise($reason); + } + + /** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + */ + public static function exceptionFor($reason): \Throwable + { + if ($reason instanceof \Throwable) { + return $reason; + } + + return new RejectionException($reason); + } + + /** + * Returns an iterator for the given value. + * + * @param mixed $value + */ + public static function iterFor($value): \Iterator + { + if ($value instanceof \Iterator) { + return $value; + } + + if (is_array($value)) { + return new \ArrayIterator($value); + } + + return new \ArrayIterator([$value]); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Each.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Each.php new file mode 100644 index 0000000000..dd72c8310b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Each.php @@ -0,0 +1,81 @@ + $onFulfilled, + 'rejected' => $onRejected, + ]))->promise(); + } + + /** + * Like of, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow + * for dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + */ + public static function ofLimit( + $iterable, + $concurrency, + ?callable $onFulfilled = null, + ?callable $onRejected = null + ): PromiseInterface { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected, + 'concurrency' => $concurrency, + ]))->promise(); + } + + /** + * Like limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + */ + public static function ofLimitAll( + $iterable, + $concurrency, + ?callable $onFulfilled = null + ): PromiseInterface { + return self::ofLimit( + $iterable, + $concurrency, + $onFulfilled, + function ($reason, $idx, PromiseInterface $aggregate): void { + $aggregate->reject($reason); + } + ); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/EachPromise.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/EachPromise.php new file mode 100644 index 0000000000..e12389818c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/EachPromise.php @@ -0,0 +1,248 @@ +iterable = Create::iterFor($iterable); + + if (isset($config['concurrency'])) { + $this->concurrency = $config['concurrency']; + } + + if (isset($config['fulfilled'])) { + $this->onFulfilled = $config['fulfilled']; + } + + if (isset($config['rejected'])) { + $this->onRejected = $config['rejected']; + } + } + + /** @psalm-suppress InvalidNullableReturnType */ + public function promise(): PromiseInterface + { + if ($this->aggregate) { + return $this->aggregate; + } + + try { + $this->createPromise(); + /** @psalm-assert Promise $this->aggregate */ + $this->iterable->rewind(); + $this->refillPending(); + } catch (\Throwable $e) { + $this->aggregate->reject($e); + } + + /** + * @psalm-suppress NullableReturnStatement + */ + return $this->aggregate; + } + + private function createPromise(): void + { + $this->mutex = false; + $this->aggregate = new Promise(function (): void { + if ($this->checkIfFinished()) { + return; + } + reset($this->pending); + // Consume a potentially fluctuating list of promises while + // ensuring that indexes are maintained (precluding array_shift). + while ($promise = current($this->pending)) { + next($this->pending); + $promise->wait(); + if (Is::settled($this->aggregate)) { + return; + } + } + }); + + // Clear the references when the promise is resolved. + $clearFn = function (): void { + $this->iterable = $this->concurrency = $this->pending = null; + $this->onFulfilled = $this->onRejected = null; + $this->nextPendingIndex = 0; + }; + + $this->aggregate->then($clearFn, $clearFn); + } + + private function refillPending(): void + { + if (!$this->concurrency) { + // Add all pending promises. + while ($this->addPending() && $this->advanceIterator()) { + } + + return; + } + + // Add only up to N pending promises. + $concurrency = is_callable($this->concurrency) + ? ($this->concurrency)(count($this->pending)) + : $this->concurrency; + $concurrency = max($concurrency - count($this->pending), 0); + // Concurrency may be set to 0 to disallow new promises. + if (!$concurrency) { + return; + } + // Add the first pending promise. + $this->addPending(); + // Note this is special handling for concurrency=1 so that we do + // not advance the iterator after adding the first promise. This + // helps work around issues with generators that might not have the + // next value to yield until promise callbacks are called. + while (--$concurrency + && $this->advanceIterator() + && $this->addPending()) { + } + } + + private function addPending(): bool + { + if (!$this->iterable || !$this->iterable->valid()) { + return false; + } + + $promise = Create::promiseFor($this->iterable->current()); + $key = $this->iterable->key(); + + // Iterable keys may not be unique, so we use a counter to + // guarantee uniqueness + $idx = $this->nextPendingIndex++; + + $this->pending[$idx] = $promise->then( + function ($value) use ($idx, $key): void { + if ($this->onFulfilled) { + ($this->onFulfilled)( + $value, + $key, + $this->aggregate + ); + } + $this->step($idx); + }, + function ($reason) use ($idx, $key): void { + if ($this->onRejected) { + ($this->onRejected)( + $reason, + $key, + $this->aggregate + ); + } + $this->step($idx); + } + ); + + return true; + } + + private function advanceIterator(): bool + { + // Place a lock on the iterator so that we ensure to not recurse, + // preventing fatal generator errors. + if ($this->mutex) { + return false; + } + + $this->mutex = true; + + try { + $this->iterable->next(); + $this->mutex = false; + + return true; + } catch (\Throwable $e) { + $this->aggregate->reject($e); + $this->mutex = false; + + return false; + } + } + + private function step(int $idx): void + { + // If the promise was already resolved, then ignore this step. + if (Is::settled($this->aggregate)) { + return; + } + + unset($this->pending[$idx]); + + // Only refill pending promises if we are not locked, preventing the + // EachPromise to recursively invoke the provided iterator, which + // cause a fatal error: "Cannot resume an already running generator" + if ($this->advanceIterator() && !$this->checkIfFinished()) { + // Add more pending promises if possible. + $this->refillPending(); + } + } + + private function checkIfFinished(): bool + { + if (!$this->pending && !$this->iterable->valid()) { + // Resolve the promise if there's nothing left to do. + $this->aggregate->resolve(null); + + return true; + } + + return false; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/FulfilledPromise.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/FulfilledPromise.php new file mode 100644 index 0000000000..727ec315c4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/FulfilledPromise.php @@ -0,0 +1,89 @@ +value = $value; + } + + public function then( + ?callable $onFulfilled = null, + ?callable $onRejected = null + ): PromiseInterface { + // Return itself if there is no onFulfilled function. + if (!$onFulfilled) { + return $this; + } + + $queue = Utils::queue(); + $p = new Promise([$queue, 'run']); + $value = $this->value; + $queue->add(static function () use ($p, $value, $onFulfilled): void { + if (Is::pending($p)) { + try { + $p->resolve($onFulfilled($value)); + } catch (\Throwable $e) { + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->then(null, $onRejected); + } + + public function wait(bool $unwrap = true) + { + return $unwrap ? $this->value : null; + } + + public function getState(): string + { + return self::FULFILLED; + } + + public function resolve($value): void + { + if ($value !== $this->value) { + throw new \LogicException('Cannot resolve a fulfilled promise'); + } + } + + public function reject($reason): void + { + throw new \LogicException('Cannot reject a fulfilled promise'); + } + + public function cancel(): void + { + // pass + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Is.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Is.php new file mode 100644 index 0000000000..f3f0503843 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Is.php @@ -0,0 +1,40 @@ +getState() === PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled or rejected. + */ + public static function settled(PromiseInterface $promise): bool + { + return $promise->getState() !== PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled. + */ + public static function fulfilled(PromiseInterface $promise): bool + { + return $promise->getState() === PromiseInterface::FULFILLED; + } + + /** + * Returns true if a promise is rejected. + */ + public static function rejected(PromiseInterface $promise): bool + { + return $promise->getState() === PromiseInterface::REJECTED; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Promise.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Promise.php new file mode 100644 index 0000000000..c0c5be2c09 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/Promise.php @@ -0,0 +1,281 @@ +waitFn = $waitFn; + $this->cancelFn = $cancelFn; + } + + public function then( + ?callable $onFulfilled = null, + ?callable $onRejected = null + ): PromiseInterface { + if ($this->state === self::PENDING) { + $p = new Promise(null, [$this, 'cancel']); + $this->handlers[] = [$p, $onFulfilled, $onRejected]; + $p->waitList = $this->waitList; + $p->waitList[] = $this; + + return $p; + } + + // Return a fulfilled promise and immediately invoke any callbacks. + if ($this->state === self::FULFILLED) { + $promise = Create::promiseFor($this->result); + + return $onFulfilled ? $promise->then($onFulfilled) : $promise; + } + + // It's either cancelled or rejected, so return a rejected promise + // and immediately invoke any callbacks. + $rejection = Create::rejectionFor($this->result); + + return $onRejected ? $rejection->then(null, $onRejected) : $rejection; + } + + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->then(null, $onRejected); + } + + public function wait(bool $unwrap = true) + { + $this->waitIfPending(); + + if ($this->result instanceof PromiseInterface) { + return $this->result->wait($unwrap); + } + if ($unwrap) { + if ($this->state === self::FULFILLED) { + return $this->result; + } + // It's rejected so "unwrap" and throw an exception. + throw Create::exceptionFor($this->result); + } + } + + public function getState(): string + { + return $this->state; + } + + public function cancel(): void + { + if ($this->state !== self::PENDING) { + return; + } + + $this->waitFn = $this->waitList = null; + + if ($this->cancelFn) { + $fn = $this->cancelFn; + $this->cancelFn = null; + try { + $fn(); + } catch (\Throwable $e) { + $this->reject($e); + } + } + + // Reject the promise only if it wasn't rejected in a then callback. + /** @psalm-suppress RedundantCondition */ + if ($this->state === self::PENDING) { + $this->reject(new CancellationException('Promise has been cancelled')); + } + } + + public function resolve($value): void + { + $this->settle(self::FULFILLED, $value); + } + + public function reject($reason): void + { + $this->settle(self::REJECTED, $reason); + } + + private function settle(string $state, $value): void + { + if ($this->state !== self::PENDING) { + // Ignore calls with the same resolution. + if ($state === $this->state && $value === $this->result) { + return; + } + throw $this->state === $state + ? new \LogicException("The promise is already {$state}.") + : new \LogicException("Cannot change a {$this->state} promise to {$state}"); + } + + if ($value === $this) { + throw new \LogicException('Cannot fulfill or reject a promise with itself'); + } + + // Clear out the state of the promise but stash the handlers. + $this->state = $state; + $this->result = $value; + $handlers = $this->handlers; + $this->handlers = null; + $this->waitList = $this->waitFn = null; + $this->cancelFn = null; + + if (!$handlers) { + return; + } + + // If the value was not a settled promise or a thenable, then resolve + // it in the task queue using the correct ID. + if (!is_object($value) || !method_exists($value, 'then')) { + $id = $state === self::FULFILLED ? 1 : 2; + // It's a success, so resolve the handlers in the queue. + Utils::queue()->add(static function () use ($id, $value, $handlers): void { + foreach ($handlers as $handler) { + self::callHandler($id, $value, $handler); + } + }); + } elseif ($value instanceof Promise && Is::pending($value)) { + // We can just merge our handlers onto the next promise. + $value->handlers = array_merge($value->handlers, $handlers); + } else { + // Resolve the handlers when the forwarded promise is resolved. + $value->then( + static function ($value) use ($handlers): void { + foreach ($handlers as $handler) { + self::callHandler(1, $value, $handler); + } + }, + static function ($reason) use ($handlers): void { + foreach ($handlers as $handler) { + self::callHandler(2, $reason, $handler); + } + } + ); + } + } + + /** + * Call a stack of handlers using a specific callback index and value. + * + * @param int $index 1 (resolve) or 2 (reject). + * @param mixed $value Value to pass to the callback. + * @param array $handler Array of handler data (promise and callbacks). + */ + private static function callHandler(int $index, $value, array $handler): void + { + /** @var PromiseInterface $promise */ + $promise = $handler[0]; + + // The promise may have been cancelled or resolved before placing + // this thunk in the queue. + if (Is::settled($promise)) { + return; + } + + try { + if (isset($handler[$index])) { + /* + * If $f throws an exception, then $handler will be in the exception + * stack trace. Since $handler contains a reference to the callable + * itself we get a circular reference. We clear the $handler + * here to avoid that memory leak. + */ + $f = $handler[$index]; + unset($handler); + $promise->resolve($f($value)); + } elseif ($index === 1) { + // Forward resolution values as-is. + $promise->resolve($value); + } else { + // Forward rejections down the chain. + $promise->reject($value); + } + } catch (\Throwable $reason) { + $promise->reject($reason); + } + } + + private function waitIfPending(): void + { + if ($this->state !== self::PENDING) { + return; + } elseif ($this->waitFn) { + $this->invokeWaitFn(); + } elseif ($this->waitList) { + $this->invokeWaitList(); + } else { + // If there's no wait function, then reject the promise. + $this->reject('Cannot wait on a promise that has ' + .'no internal wait function. You must provide a wait ' + .'function when constructing the promise to be able to ' + .'wait on a promise.'); + } + + Utils::queue()->run(); + + /** @psalm-suppress RedundantCondition */ + if ($this->state === self::PENDING) { + $this->reject('Invoking the wait callback did not resolve the promise'); + } + } + + private function invokeWaitFn(): void + { + try { + $wfn = $this->waitFn; + $this->waitFn = null; + $wfn(true); + } catch (\Throwable $reason) { + if ($this->state === self::PENDING) { + // The promise has not been resolved yet, so reject the promise + // with the exception. + $this->reject($reason); + } else { + // The promise was already resolved, so there's a problem in + // the application. + throw $reason; + } + } + } + + private function invokeWaitList(): void + { + $waitList = $this->waitList; + $this->waitList = null; + + foreach ($waitList as $result) { + do { + $result->waitIfPending(); + $result = $result->result; + } while ($result instanceof Promise); + + if ($result instanceof PromiseInterface) { + $result->wait(false); + } + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/PromiseInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/PromiseInterface.php new file mode 100644 index 0000000000..c11721e4d9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/PromiseInterface.php @@ -0,0 +1,91 @@ +reason = $reason; + } + + public function then( + ?callable $onFulfilled = null, + ?callable $onRejected = null + ): PromiseInterface { + // If there's no onRejected callback then just return self. + if (!$onRejected) { + return $this; + } + + $queue = Utils::queue(); + $reason = $this->reason; + $p = new Promise([$queue, 'run']); + $queue->add(static function () use ($p, $reason, $onRejected): void { + if (Is::pending($p)) { + try { + // Return a resolved promise if onRejected does not throw. + $p->resolve($onRejected($reason)); + } catch (\Throwable $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->then(null, $onRejected); + } + + public function wait(bool $unwrap = true) + { + if ($unwrap) { + throw Create::exceptionFor($this->reason); + } + + return null; + } + + public function getState(): string + { + return self::REJECTED; + } + + public function resolve($value): void + { + throw new \LogicException('Cannot resolve a rejected promise'); + } + + public function reject($reason): void + { + if ($reason !== $this->reason) { + throw new \LogicException('Cannot reject a rejected promise'); + } + } + + public function cancel(): void + { + // pass + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/RejectionException.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/RejectionException.php new file mode 100644 index 0000000000..47dca86248 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/RejectionException.php @@ -0,0 +1,49 @@ +reason = $reason; + + $message = 'The promise was rejected'; + + if ($description) { + $message .= ' with reason: '.$description; + } elseif (is_string($reason) + || (is_object($reason) && method_exists($reason, '__toString')) + ) { + $message .= ' with reason: '.$this->reason; + } elseif ($reason instanceof \JsonSerializable) { + $message .= ' with reason: '.json_encode($this->reason, JSON_PRETTY_PRINT); + } + + parent::__construct($message); + } + + /** + * Returns the rejection reason. + * + * @return mixed + */ + public function getReason() + { + return $this->reason; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueue.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueue.php new file mode 100644 index 0000000000..503e0b2da5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueue.php @@ -0,0 +1,71 @@ +run(); + * + * @final + */ +class TaskQueue implements TaskQueueInterface +{ + private $enableShutdown = true; + private $queue = []; + + public function __construct(bool $withShutdown = true) + { + if ($withShutdown) { + register_shutdown_function(function (): void { + if ($this->enableShutdown) { + // Only run the tasks if an E_ERROR didn't occur. + $err = error_get_last(); + if (!$err || ($err['type'] ^ E_ERROR)) { + $this->run(); + } + } + }); + } + } + + public function isEmpty(): bool + { + return !$this->queue; + } + + public function add(callable $task): void + { + $this->queue[] = $task; + } + + public function run(): void + { + while ($task = array_shift($this->queue)) { + /** @var callable $task */ + $task(); + } + } + + /** + * The task queue will be run and exhausted by default when the process + * exits IFF the exit is not the result of a PHP E_ERROR error. + * + * You can disable running the automatic shutdown of the queue by calling + * this function. If you disable the task queue shutdown process, then you + * MUST either run the task queue (as a result of running your event loop + * or manually using the run() method) or wait on each outstanding promise. + * + * Note: This shutdown will occur before any destructors are triggered. + */ + public function disableShutdown(): void + { + $this->enableShutdown = false; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueueInterface.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueueInterface.php new file mode 100644 index 0000000000..34c561a482 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/src/TaskQueueInterface.php @@ -0,0 +1,24 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\Utils::queue()->run(); + * } + * + * + * @param TaskQueueInterface|null $assign Optionally specify a new queue instance. + */ + public static function queue(?TaskQueueInterface $assign = null): TaskQueueInterface + { + static $queue; + + if ($assign) { + $queue = $assign; + } elseif (!$queue) { + $queue = new TaskQueue(); + } + + return $queue; + } + + /** + * Adds a function to run in the task queue when it is next `run()` and + * returns a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + */ + public static function task(callable $task): PromiseInterface + { + $queue = self::queue(); + $promise = new Promise([$queue, 'run']); + $queue->add(function () use ($task, $promise): void { + try { + if (Is::pending($promise)) { + $promise->resolve($task()); + } + } catch (\Throwable $e) { + $promise->reject($e); + } + }); + + return $promise; + } + + /** + * Synchronously waits on a promise to resolve and returns an inspection + * state array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the + * array will contain a "value" key mapping to the fulfilled value of the + * promise. If the promise is rejected, the array will contain a "reason" + * key mapping to the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + */ + public static function inspect(PromiseInterface $promise): array + { + try { + return [ + 'state' => PromiseInterface::FULFILLED, + 'value' => $promise->wait(), + ]; + } catch (RejectionException $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; + } catch (\Throwable $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } + } + + /** + * Waits on all of the provided promises, but does not unwrap rejected + * promises as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + */ + public static function inspectAll($promises): array + { + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = self::inspect($promise); + } + + return $results; + } + + /** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same + * order the promises were provided). An exception is thrown if any of the + * promises are rejected. + * + * @param iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @throws \Throwable on error + */ + public static function unwrap($promises): array + { + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = $promise->wait(); + } + + return $results; + } + + /** + * Given an array of promises, return a promise that is fulfilled when all + * the items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + */ + public static function all($promises, bool $recursive = false): PromiseInterface + { + $results = []; + $promise = Each::of( + $promises, + function ($value, $idx) use (&$results): void { + $results[$idx] = $value; + }, + function ($reason, $idx, Promise $aggregate): void { + $aggregate->reject($reason); + } + )->then(function () use (&$results) { + ksort($results); + + return $results; + }); + + if (true === $recursive) { + $promise = $promise->then(function ($results) use ($recursive, &$promises) { + foreach ($promises as $promise) { + if (Is::pending($promise)) { + return self::all($promises, $recursive); + } + } + + return $results; + }); + } + + return $promise; + } + + /** + * Initiate a competitive race between multiple promises or values (values + * will become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise + * is fulfilled with an array that contains the fulfillment values of the + * winners in order of resolution. + * + * This promise is rejected with a {@see AggregateException} if the number + * of fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + */ + public static function some(int $count, $promises): PromiseInterface + { + $results = []; + $rejections = []; + + return Each::of( + $promises, + function ($value, $idx, PromiseInterface $p) use (&$results, $count): void { + if (Is::settled($p)) { + return; + } + $results[$idx] = $value; + if (count($results) >= $count) { + $p->resolve(null); + } + }, + function ($reason) use (&$rejections): void { + $rejections[] = $reason; + } + )->then( + function () use (&$results, &$rejections, $count) { + if (count($results) !== $count) { + throw new AggregateException( + 'Not enough promises to fulfill count', + $rejections + ); + } + ksort($results); + + return array_values($results); + } + ); + } + + /** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + */ + public static function any($promises): PromiseInterface + { + return self::some(1, $promises)->then(function ($values) { + return $values[0]; + }); + } + + /** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + */ + public static function settle($promises): PromiseInterface + { + $results = []; + + return Each::of( + $promises, + function ($value, $idx) use (&$results): void { + $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; + }, + function ($reason, $idx) use (&$results): void { + $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; + } + )->then(function () use (&$results) { + ksort($results); + + return $results; + }); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/AggregateExceptionTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/AggregateExceptionTest.php new file mode 100644 index 0000000000..95f2431698 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/AggregateExceptionTest.php @@ -0,0 +1,18 @@ +assertStringContainsString('foo', $e->getMessage()); + $this->assertSame(['baz', 'bar'], $e->getReason()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CoroutineTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CoroutineTest.php new file mode 100644 index 0000000000..af60639605 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CoroutineTest.php @@ -0,0 +1,115 @@ +assertInstanceOf(Coroutine::class, Coroutine::of($fn)); + } + + /** + * @dataProvider promiseInterfaceMethodProvider + * + * @param string $method + * @param array $args + */ + public function testShouldProxyPromiseMethodsToResultPromise($method, $args = []): void + { + $coroutine = new Coroutine(function () { yield 0; }); + $mockPromise = $this->getMockForAbstractClass(PromiseInterface::class); + $mockPromise->expects($this->once())->method($method)->with(...$args); + + $resultPromiseProp = (new ReflectionClass(Coroutine::class))->getProperty('result'); + $resultPromiseProp->setAccessible(true); + $resultPromiseProp->setValue($coroutine, $mockPromise); + + $coroutine->{$method}(...$args); + } + + public function promiseInterfaceMethodProvider() + { + return [ + ['then', [null, null]], + ['otherwise', [function (): void {}]], + ['wait', [true]], + ['getState', []], + ['resolve', [null]], + ['reject', [null]], + ]; + } + + public function testShouldCancelResultPromiseAndOutsideCurrentPromise(): void + { + $coroutine = new Coroutine(function () { yield 0; }); + + $mockPromises = [ + 'result' => $this->getMockForAbstractClass(PromiseInterface::class), + 'currentPromise' => $this->getMockForAbstractClass(PromiseInterface::class), + ]; + foreach ($mockPromises as $propName => $mockPromise) { + /** + * @var $mockPromise \PHPUnit_Framework_MockObject_MockObject + */ + $mockPromise->expects($this->once()) + ->method('cancel') + ->with(); + + $promiseProp = (new ReflectionClass(Coroutine::class))->getProperty($propName); + $promiseProp->setAccessible(true); + $promiseProp->setValue($coroutine, $mockPromise); + } + + $coroutine->cancel(); + } + + public function testWaitShouldResolveChainedCoroutines(): void + { + $promisor = function () { + return Coroutine::of(function () { + yield $promise = new Promise(function () use (&$promise): void { + $promise->resolve(1); + }); + }); + }; + + $promise = $promisor()->then($promisor)->then($promisor); + + $this->assertSame(1, $promise->wait()); + } + + public function testWaitShouldHandleIntermediateErrors(): void + { + $promise = Coroutine::of(function () { + yield $promise = new Promise(function () use (&$promise): void { + $promise->resolve(1); + }); + }) + ->then(function () { + return Coroutine::of(function () { + yield $promise = new Promise(function () use (&$promise): void { + $promise->reject(new \Exception()); + }); + }); + }) + ->otherwise(function (?\Exception $error = null) { + if (!$error) { + self::fail('Error did not propagate.'); + } + + return 3; + }); + + $this->assertSame(3, $promise->wait()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CreateTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CreateTest.php new file mode 100644 index 0000000000..87949da127 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/CreateTest.php @@ -0,0 +1,58 @@ +assertInstanceOf(FulfilledPromise::class, $p); + } + + public function testReturnsPromiseForPromise(): void + { + $p = new Promise(); + $this->assertSame($p, P\Create::promiseFor($p)); + } + + public function testReturnsPromiseForThennable(): void + { + $p = new Thennable(); + $wrapped = P\Create::promiseFor($p); + $this->assertNotSame($p, $wrapped); + $this->assertInstanceOf(PromiseInterface::class, $wrapped); + $p->resolve('foo'); + P\Utils::queue()->run(); + $this->assertSame('foo', $wrapped->wait()); + } + + public function testReturnsRejection(): void + { + $p = P\Create::rejectionFor('fail'); + $this->assertInstanceOf(RejectedPromise::class, $p); + $this->assertSame('fail', PropertyHelper::get($p, 'reason')); + } + + public function testReturnsPromisesAsIsInRejectionFor(): void + { + $a = new Promise(); + $b = P\Create::rejectionFor($a); + $this->assertSame($a, $b); + } + + public function testIterForReturnsIterator(): void + { + $iter = new \ArrayIterator(); + $this->assertSame($iter, P\Create::iterFor($iter)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachPromiseTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachPromiseTest.php new file mode 100644 index 0000000000..10425fa5b4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachPromiseTest.php @@ -0,0 +1,433 @@ + 100]); + $this->assertSame($each->promise(), $each->promise()); + } + + public function testResolvesInCaseOfAnEmptyList(): void + { + $promises = []; + $each = new EachPromise($promises); + $p = $each->promise(); + $this->assertNull($p->wait()); + $this->assertTrue(P\Is::fulfilled($p)); + } + + public function testResolvesInCaseOfAnEmptyListAndInvokesFulfilled(): void + { + $promises = []; + $each = new EachPromise($promises); + $p = $each->promise(); + $onFulfilledCalled = false; + $onRejectedCalled = false; + $p->then( + function () use (&$onFulfilledCalled): void { + $onFulfilledCalled = true; + }, + function () use (&$onRejectedCalled): void { + $onRejectedCalled = true; + } + ); + $this->assertNull($p->wait()); + $this->assertTrue(P\Is::fulfilled($p)); + $this->assertTrue($onFulfilledCalled); + $this->assertFalse($onRejectedCalled); + } + + public function testInvokesAllPromises(): void + { + $promises = [new Promise(), new Promise(), new Promise()]; + $called = []; + $each = new EachPromise($promises, [ + 'fulfilled' => function ($value) use (&$called): void { + $called[] = $value; + }, + ]); + $p = $each->promise(); + $promises[0]->resolve('a'); + $promises[1]->resolve('c'); + $promises[2]->resolve('b'); + P\Utils::queue()->run(); + $this->assertSame(['a', 'c', 'b'], $called); + $this->assertTrue(P\Is::fulfilled($p)); + } + + public function testIsWaitable(): void + { + $a = $this->createSelfResolvingPromise('a'); + $b = $this->createSelfResolvingPromise('b'); + $called = []; + $each = new EachPromise([$a, $b], [ + 'fulfilled' => function ($value) use (&$called): void { $called[] = $value; }, + ]); + $p = $each->promise(); + $this->assertNull($p->wait()); + $this->assertTrue(P\Is::fulfilled($p)); + $this->assertSame(['a', 'b'], $called); + } + + public function testCanResolveBeforeConsumingAll(): void + { + $called = 0; + $a = $this->createSelfResolvingPromise('a'); + $b = new Promise(function (): void { $this->fail(); }); + $each = new EachPromise([$a, $b], [ + 'fulfilled' => function ($value, $idx, Promise $aggregate) use (&$called): void { + $this->assertSame($idx, 0); + $this->assertSame('a', $value); + $aggregate->resolve(null); + ++$called; + }, + 'rejected' => function (\Exception $reason): void { + $this->fail($reason->getMessage()); + }, + ]); + $p = $each->promise(); + $p->wait(); + $this->assertNull($p->wait()); + $this->assertSame(1, $called); + $this->assertTrue(P\Is::fulfilled($a)); + $this->assertTrue(P\Is::pending($b)); + // Resolving $b has no effect on the aggregate promise. + $b->resolve('foo'); + $this->assertSame(1, $called); + } + + public function testLimitsPendingPromises(): void + { + $pending = [new Promise(), new Promise(), new Promise(), new Promise()]; + $promises = new \ArrayIterator($pending); + $each = new EachPromise($promises, ['concurrency' => 2]); + $p = $each->promise(); + $this->assertCount(2, PropertyHelper::get($each, 'pending')); + $pending[0]->resolve('a'); + $this->assertCount(2, PropertyHelper::get($each, 'pending')); + $this->assertTrue($promises->valid()); + $pending[1]->resolve('b'); + P\Utils::queue()->run(); + $this->assertCount(2, PropertyHelper::get($each, 'pending')); + $this->assertTrue($promises->valid()); + $promises[2]->resolve('c'); + P\Utils::queue()->run(); + $this->assertCount(1, PropertyHelper::get($each, 'pending')); + $this->assertTrue(P\Is::pending($p)); + $promises[3]->resolve('d'); + P\Utils::queue()->run(); + $this->assertNull(PropertyHelper::get($each, 'pending')); + $this->assertTrue(P\Is::fulfilled($p)); + $this->assertFalse($promises->valid()); + } + + public function testDynamicallyLimitsPendingPromises(): void + { + $calls = []; + $pendingFn = function ($count) use (&$calls) { + $calls[] = $count; + + return 2; + }; + $pending = [new Promise(), new Promise(), new Promise(), new Promise()]; + $promises = new \ArrayIterator($pending); + $each = new EachPromise($promises, ['concurrency' => $pendingFn]); + $p = $each->promise(); + $this->assertCount(2, PropertyHelper::get($each, 'pending')); + $pending[0]->resolve('a'); + $this->assertCount(2, PropertyHelper::get($each, 'pending')); + $this->assertTrue($promises->valid()); + $pending[1]->resolve('b'); + $this->assertCount(2, PropertyHelper::get($each, 'pending')); + P\Utils::queue()->run(); + $this->assertTrue($promises->valid()); + $promises[2]->resolve('c'); + P\Utils::queue()->run(); + $this->assertCount(1, PropertyHelper::get($each, 'pending')); + $this->assertTrue(P\Is::pending($p)); + $promises[3]->resolve('d'); + P\Utils::queue()->run(); + $this->assertNull(PropertyHelper::get($each, 'pending')); + $this->assertTrue(P\Is::fulfilled($p)); + $this->assertSame([0, 1, 1, 1], $calls); + $this->assertFalse($promises->valid()); + } + + public function testClearsReferencesWhenResolved(): void + { + $called = false; + $a = new Promise(function () use (&$a, &$called): void { + $a->resolve('a'); + $called = true; + }); + $each = new EachPromise([$a], [ + 'concurrency' => function () { return 1; }, + 'fulfilled' => function (): void {}, + 'rejected' => function (): void {}, + ]); + $each->promise()->wait(); + $this->assertNull(PropertyHelper::get($each, 'onFulfilled')); + $this->assertNull(PropertyHelper::get($each, 'onRejected')); + $this->assertNull(PropertyHelper::get($each, 'iterable')); + $this->assertNull(PropertyHelper::get($each, 'pending')); + $this->assertNull(PropertyHelper::get($each, 'concurrency')); + $this->assertTrue($called); + } + + public function testCanBeCancelled(): void + { + $called = false; + $a = new FulfilledPromise('a'); + $b = new Promise(function () use (&$called): void { $called = true; }); + $each = new EachPromise([$a, $b], [ + 'fulfilled' => function ($value, $idx, Promise $aggregate): void { + $aggregate->cancel(); + }, + 'rejected' => function ($reason) use (&$called): void { + $called = true; + }, + ]); + $p = $each->promise(); + $p->wait(false); + $this->assertTrue(P\Is::fulfilled($a)); + $this->assertTrue(P\Is::pending($b)); + $this->assertTrue(P\Is::rejected($p)); + $this->assertFalse($called); + } + + public function testDoesNotBlowStackWithFulfilledPromises(): void + { + $pending = []; + for ($i = 0; $i < 100; ++$i) { + $pending[] = new FulfilledPromise($i); + } + $values = []; + $each = new EachPromise($pending, [ + 'fulfilled' => function ($value) use (&$values): void { + $values[] = $value; + }, + ]); + $called = false; + $each->promise()->then(function () use (&$called): void { + $called = true; + }); + $this->assertFalse($called); + P\Utils::queue()->run(); + $this->assertTrue($called); + $this->assertSame(range(0, 99), $values); + } + + public function testDoesNotBlowStackWithRejectedPromises(): void + { + $pending = []; + for ($i = 0; $i < 100; ++$i) { + $pending[] = new RejectedPromise($i); + } + $values = []; + $each = new EachPromise($pending, [ + 'rejected' => function ($value) use (&$values): void { + $values[] = $value; + }, + ]); + $called = false; + $each->promise()->then( + function () use (&$called): void { $called = true; }, + function (): void { $this->fail('Should not have rejected.'); } + ); + $this->assertFalse($called); + P\Utils::queue()->run(); + $this->assertTrue($called); + $this->assertSame(range(0, 99), $values); + } + + public function testReturnsPromiseForWhatever(): void + { + $called = []; + $arr = ['a', 'b']; + $each = new EachPromise($arr, [ + 'fulfilled' => function ($v) use (&$called): void { $called[] = $v; }, + ]); + $p = $each->promise(); + $this->assertNull($p->wait()); + $this->assertSame(['a', 'b'], $called); + } + + public function testRejectsAggregateWhenNextThrows(): void + { + $iter = function () { + yield 'a'; + throw new \Exception('Failure'); + }; + $each = new EachPromise($iter()); + $p = $each->promise(); + $e = null; + $received = null; + $p->then(null, function ($reason) use (&$e): void { $e = $reason; }); + P\Utils::queue()->run(); + $this->assertInstanceOf(\Exception::class, $e); + $this->assertSame('Failure', $e->getMessage()); + } + + public function testDoesNotCallNextOnIteratorUntilNeededWhenWaiting(): void + { + $results = []; + $values = [10]; + $remaining = 9; + $iter = function () use (&$values) { + while ($value = array_pop($values)) { + yield $value; + } + }; + $each = new EachPromise($iter(), [ + 'concurrency' => 1, + 'fulfilled' => function ($r) use (&$results, &$values, &$remaining): void { + $results[] = $r; + if ($remaining > 0) { + $values[] = $remaining--; + } + }, + ]); + $each->promise()->wait(); + $this->assertSame(range(10, 1), $results); + } + + public function testDoesNotCallNextOnIteratorUntilNeededWhenAsync(): void + { + $firstPromise = new Promise(); + $pending = [$firstPromise]; + $values = [$firstPromise]; + $results = []; + $remaining = 9; + $iter = function () use (&$values) { + while ($value = array_pop($values)) { + yield $value; + } + }; + $each = new EachPromise($iter(), [ + 'concurrency' => 1, + 'fulfilled' => function ($r) use (&$results, &$values, &$remaining, &$pending): void { + $results[] = $r; + if ($remaining-- > 0) { + $pending[] = $values[] = new Promise(); + } + }, + ]); + $i = 0; + $each->promise(); + while ($promise = array_pop($pending)) { + $promise->resolve($i++); + P\Utils::queue()->run(); + } + $this->assertSame(range(0, 9), $results); + } + + private function createSelfResolvingPromise($value) + { + $p = new Promise(function () use (&$p, $value): void { + $p->resolve($value); + }); + $trickCsFixer = true; + + return $p; + } + + public function testMutexPreventsGeneratorRecursion(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $results = $promises = []; + for ($i = 0; $i < 20; ++$i) { + $p = $this->createSelfResolvingPromise($i); + $pending[] = $p; + $promises[] = $p; + } + + $iter = function () use (&$promises, &$pending) { + foreach ($promises as $promise) { + // Resolve a promises, which will trigger the then() function, + // which would cause the EachPromise to try to add more + // promises to the queue. Without a lock, this would trigger + // a "Cannot resume an already running generator" fatal error. + if ($p = array_pop($pending)) { + $p->wait(); + } + yield $promise; + } + }; + + $each = new EachPromise($iter(), [ + 'concurrency' => 5, + 'fulfilled' => function ($r) use (&$results, &$pending): void { + $results[] = $r; + }, + ]); + + $each->promise()->wait(); + $this->assertCount(20, $results); + } + + public function testIteratorWithSameKey(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $iter = function () { + yield 'foo' => $this->createSelfResolvingPromise(1); + yield 'foo' => $this->createSelfResolvingPromise(2); + yield 1 => $this->createSelfResolvingPromise(3); + yield 1 => $this->createSelfResolvingPromise(4); + }; + $called = 0; + $each = new EachPromise($iter(), [ + 'fulfilled' => function ($value, $idx, Promise $aggregate) use (&$called): void { + ++$called; + if ($value < 3) { + $this->assertSame('foo', $idx); + } else { + $this->assertSame(1, $idx); + } + }, + ]); + $each->promise()->wait(); + $this->assertSame(4, $called); + } + + public function testIsWaitableWhenLimited(): void + { + $promises = [ + $this->createSelfResolvingPromise('a'), + $this->createSelfResolvingPromise('c'), + $this->createSelfResolvingPromise('b'), + $this->createSelfResolvingPromise('d'), + ]; + $called = []; + $each = new EachPromise($promises, [ + 'concurrency' => 2, + 'fulfilled' => function ($value) use (&$called): void { + $called[] = $value; + }, + ]); + $p = $each->promise(); + $this->assertNull($p->wait()); + $this->assertSame(['a', 'c', 'b', 'd'], $called); + $this->assertTrue(P\Is::fulfilled($p)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachTest.php new file mode 100644 index 0000000000..5eb55df5ea --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/EachTest.php @@ -0,0 +1,36 @@ +resolve('a'); + P\Utils::queue()->run(); + $this->assertTrue(P\Is::fulfilled($aggregate)); + } + + public function testEachLimitAllRejectsOnFailure(): void + { + $p = [new FulfilledPromise('a'), new RejectedPromise('b')]; + $aggregate = P\Each::ofLimitAll($p, 2); + + P\Utils::queue()->run(); + $this->assertTrue(P\Is::rejected($aggregate)); + + $result = P\Utils::inspect($aggregate); + $this->assertSame('b', $result['reason']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/FulfilledPromiseTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/FulfilledPromiseTest.php new file mode 100644 index 0000000000..142005b87a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/FulfilledPromiseTest.php @@ -0,0 +1,115 @@ +assertTrue(P\Is::fulfilled($p)); + $this->assertSame('foo', $p->wait(true)); + } + + public function testCannotCancel(): void + { + $p = new FulfilledPromise('foo'); + $this->assertTrue(P\Is::fulfilled($p)); + $p->cancel(); + $this->assertSame('foo', $p->wait()); + } + + /** + * @expectedExceptionMessage Cannot resolve a fulfilled promise + */ + public function testCannotResolve(): void + { + $this->expectException(\LogicException::class); + + $p = new FulfilledPromise('foo'); + $p->resolve('bar'); + } + + /** + * @expectedExceptionMessage Cannot reject a fulfilled promise + */ + public function testCannotReject(): void + { + $this->expectException(\LogicException::class); + + $p = new FulfilledPromise('foo'); + $p->reject('bar'); + } + + public function testCanResolveWithSameValue(): void + { + $p = new FulfilledPromise('foo'); + $p->resolve('foo'); + $this->assertSame('foo', $p->wait()); + } + + public function testCannotResolveWithPromise(): void + { + $this->expectException(\InvalidArgumentException::class); + + new FulfilledPromise(new Promise()); + } + + public function testReturnsSelfWhenNoOnFulfilled(): void + { + $p = new FulfilledPromise('a'); + $this->assertSame($p, $p->then()); + } + + public function testAsynchronouslyInvokesOnFulfilled(): void + { + $p = new FulfilledPromise('a'); + $r = null; + $f = function ($d) use (&$r): void { $r = $d; }; + $p2 = $p->then($f); + $this->assertNotSame($p, $p2); + $this->assertNull($r); + P\Utils::queue()->run(); + $this->assertSame('a', $r); + } + + public function testReturnsNewRejectedWhenOnFulfilledFails(): void + { + $p = new FulfilledPromise('a'); + $f = function (): void { throw new \Exception('b'); }; + $p2 = $p->then($f); + $this->assertNotSame($p, $p2); + try { + $p2->wait(); + $this->fail(); + } catch (\Exception $e) { + $this->assertSame('b', $e->getMessage()); + } + } + + public function testOtherwiseIsSugarForRejections(): void + { + $c = null; + $p = new FulfilledPromise('foo'); + $p->otherwise(function ($v) use (&$c): void { $c = $v; }); + $this->assertNull($c); + } + + public function testDoesNotTryToFulfillTwiceDuringTrampoline(): void + { + $fp = new FulfilledPromise('a'); + $t1 = $fp->then(function ($v) { return $v.' b'; }); + $t1->resolve('why!'); + $this->assertSame('why!', $t1->wait()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/IsTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/IsTest.php new file mode 100644 index 0000000000..6b3cf217a4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/IsTest.php @@ -0,0 +1,42 @@ +assertTrue(P\Is::fulfilled($p)); + $this->assertFalse(P\Is::rejected($p)); + } + + public function testKnowsIfRejected(): void + { + $p = new RejectedPromise(null); + $this->assertTrue(P\Is::rejected($p)); + $this->assertFalse(P\Is::fulfilled($p)); + } + + public function testKnowsIfSettled(): void + { + $p = new RejectedPromise(null); + $this->assertTrue(P\Is::settled($p)); + $this->assertFalse(P\Is::pending($p)); + } + + public function testKnowsIfPending(): void + { + $p = new Promise(); + $this->assertFalse(P\Is::settled($p)); + $this->assertTrue(P\Is::pending($p)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/NotPromiseInstance.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/NotPromiseInstance.php new file mode 100644 index 0000000000..e4c9d340f5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/NotPromiseInstance.php @@ -0,0 +1,51 @@ +nextPromise = new Promise(); + } + + public function then(?callable $res = null, ?callable $rej = null): PromiseInterface + { + return $this->nextPromise->then($res, $rej); + } + + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->then($onRejected); + } + + public function resolve($value): void + { + $this->nextPromise->resolve($value); + } + + public function reject($reason): void + { + $this->nextPromise->reject($reason); + } + + public function wait(bool $unwrap = true, ?bool $defaultResolution = null): void + { + } + + public function cancel(): void + { + } + + public function getState(): string + { + return $this->nextPromise->getState(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PromiseTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PromiseTest.php new file mode 100644 index 0000000000..52ba353d5b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PromiseTest.php @@ -0,0 +1,773 @@ +expectException(\LogicException::class); + $this->expectExceptionMessage('The promise is already fulfilled'); + + $p = new Promise(); + $p->resolve('foo'); + $p->resolve('bar'); + $this->assertSame('foo', $p->wait()); + } + + public function testCanResolveWithSameValue(): void + { + $p = new Promise(); + $p->resolve('foo'); + $p->resolve('foo'); + $this->assertSame('foo', $p->wait()); + } + + public function testCannotRejectNonPendingPromise(): void + { + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Cannot change a fulfilled promise to rejected'); + + $p = new Promise(); + $p->resolve('foo'); + $p->reject('bar'); + $this->assertSame('foo', $p->wait()); + } + + public function testCanRejectWithSameValue(): void + { + $p = new Promise(); + $p->reject('foo'); + $p->reject('foo'); + $this->assertTrue(P\Is::rejected($p)); + } + + public function testCannotRejectResolveWithSameValue(): void + { + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Cannot change a fulfilled promise to rejected'); + + $p = new Promise(); + $p->resolve('foo'); + $p->reject('foo'); + } + + public function testInvokesWaitFunction(): void + { + $p = new Promise(function () use (&$p): void { + $p->resolve('10'); + }); + $this->assertSame('10', $p->wait()); + } + + public function testRejectsAndThrowsWhenWaitFailsToResolve(): void + { + $this->expectException(RejectionException::class); + $this->expectExceptionMessage('The promise was rejected with reason: Invoking the wait callback did not resolve the promise'); + + $p = new Promise(function (): void {}); + $p->wait(); + } + + public function testThrowsWhenUnwrapIsRejectedWithNonException(): void + { + $this->expectException(RejectionException::class); + $this->expectExceptionMessage('The promise was rejected with reason: foo'); + + $p = new Promise(function () use (&$p): void { + $p->reject('foo'); + }); + $p->wait(); + } + + public function testThrowsWhenUnwrapIsRejectedWithException(): void + { + $this->expectException(\UnexpectedValueException::class); + $this->expectExceptionMessage('foo'); + + $e = new \UnexpectedValueException('foo'); + $p = new Promise(function () use (&$p, $e): void { + $p->reject($e); + }); + $p->wait(); + } + + public function testDoesNotUnwrapExceptionsWhenDisabled(): void + { + $p = new Promise(function () use (&$p): void { + $p->reject('foo'); + }); + $this->assertTrue(P\Is::pending($p)); + $p->wait(false); + $this->assertTrue(P\Is::rejected($p)); + } + + public function testRejectsSelfWhenWaitThrows(): void + { + $e = new \UnexpectedValueException('foo'); + $p = new Promise(function () use ($e): void { + throw $e; + }); + try { + $p->wait(); + $this->fail(); + } catch (\UnexpectedValueException $e) { + $this->assertTrue(P\Is::rejected($p)); + } + } + + public function testWaitsOnNestedPromises(): void + { + $p = new Promise(function () use (&$p): void { + $p->resolve('_'); + }); + $p2 = new Promise(function () use (&$p2): void { + $p2->resolve('foo'); + }); + $p3 = $p->then(function () use ($p2) { + return $p2; + }); + $this->assertSame('foo', $p3->wait()); + } + + public function testThrowsWhenWaitingOnPromiseWithNoWaitFunction(): void + { + $this->expectException(RejectionException::class); + + $p = new Promise(); + $p->wait(); + } + + public function testThrowsWaitExceptionAfterPromiseIsResolved(): void + { + $p = new Promise(function () use (&$p): void { + $p->reject('Foo!'); + throw new \Exception('Bar?'); + }); + + try { + $p->wait(); + $this->fail(); + } catch (\Exception $e) { + $this->assertSame('Bar?', $e->getMessage()); + } + } + + public function testGetsActualWaitValueFromThen(): void + { + $p = new Promise(function () use (&$p): void { + $p->reject('Foo!'); + }); + $p2 = $p->then(null, function ($reason) { + return new RejectedPromise([$reason]); + }); + + try { + $p2->wait(); + $this->fail('Should have thrown'); + } catch (RejectionException $e) { + $this->assertSame(['Foo!'], $e->getReason()); + } + } + + public function testWaitBehaviorIsBasedOnLastPromiseInChain(): void + { + $p3 = new Promise(function () use (&$p3): void { + $p3->resolve('Whoop'); + }); + $p2 = new Promise(function () use (&$p2, $p3): void { + $p2->reject($p3); + }); + $p = new Promise(function () use (&$p, $p2): void { + $p->reject($p2); + }); + $this->assertSame('Whoop', $p->wait()); + } + + public function testWaitsOnAPromiseChainEvenWhenNotUnwrapped(): void + { + $p2 = new Promise(function () use (&$p2): void { + $p2->reject('Fail'); + }); + $p = new Promise(function () use ($p2, &$p): void { + $p->resolve($p2); + }); + $p->wait(false); + $this->assertTrue(P\Is::rejected($p2)); + } + + public function testCannotCancelNonPending(): void + { + $p = new Promise(); + $p->resolve('foo'); + $p->cancel(); + $this->assertTrue(P\Is::fulfilled($p)); + } + + public function testCancelsPromiseWhenNoCancelFunction(): void + { + $this->expectException(CancellationException::class); + + $p = new Promise(); + $p->cancel(); + $this->assertTrue(P\Is::rejected($p)); + $p->wait(); + } + + public function testCancelsPromiseWithCancelFunction(): void + { + $called = false; + $p = new Promise(null, function () use (&$called): void { + $called = true; + }); + $p->cancel(); + $this->assertTrue(P\Is::rejected($p)); + $this->assertTrue($called); + } + + public function testCancelsUppermostPendingPromise(): void + { + $called = false; + $p1 = new Promise(null, function () use (&$called): void { + $called = true; + }); + $p2 = $p1->then(function (): void {}); + $p3 = $p2->then(function (): void {}); + $p4 = $p3->then(function (): void {}); + $p3->cancel(); + $this->assertTrue(P\Is::rejected($p1)); + $this->assertTrue(P\Is::rejected($p2)); + $this->assertTrue(P\Is::rejected($p3)); + $this->assertTrue(P\Is::pending($p4)); + $this->assertTrue($called); + + try { + $p3->wait(); + $this->fail(); + } catch (CancellationException $e) { + $this->assertStringContainsString('cancelled', $e->getMessage()); + } + + try { + $p4->wait(); + $this->fail(); + } catch (CancellationException $e) { + $this->assertStringContainsString('cancelled', $e->getMessage()); + } + + $this->assertTrue(P\Is::rejected($p4)); + } + + public function testCancelsChildPromises(): void + { + $called1 = $called2 = $called3 = false; + $p1 = new Promise(null, function () use (&$called1): void { + $called1 = true; + }); + $p2 = new Promise(null, function () use (&$called2): void { + $called2 = true; + }); + $p3 = new Promise(null, function () use (&$called3): void { + $called3 = true; + }); + $p4 = $p2->then(function () use ($p3) { + return $p3; + }); + $p5 = $p4->then(function (): void { + $this->fail(); + }); + $p4->cancel(); + $this->assertTrue(P\Is::pending($p1)); + $this->assertTrue(P\Is::rejected($p2)); + $this->assertTrue(P\Is::pending($p3)); + $this->assertTrue(P\Is::rejected($p4)); + $this->assertTrue(P\Is::pending($p5)); + $this->assertFalse($called1); + $this->assertTrue($called2); + $this->assertFalse($called3); + } + + public function testRejectsPromiseWhenCancelFails(): void + { + $called = false; + $p = new Promise(null, function () use (&$called): void { + $called = true; + throw new \Exception('e'); + }); + $p->cancel(); + $this->assertTrue(P\Is::rejected($p)); + $this->assertTrue($called); + try { + $p->wait(); + $this->fail(); + } catch (\Exception $e) { + $this->assertSame('e', $e->getMessage()); + } + } + + public function testCreatesPromiseWhenFulfilledAfterThen(): void + { + $p = new Promise(); + $carry = null; + $p2 = $p->then(function ($v) use (&$carry): void { + $carry = $v; + }); + $this->assertNotSame($p, $p2); + $p->resolve('foo'); + P\Utils::queue()->run(); + + $this->assertSame('foo', $carry); + } + + public function testCreatesPromiseWhenFulfilledBeforeThen(): void + { + $p = new Promise(); + $p->resolve('foo'); + $carry = null; + $p2 = $p->then(function ($v) use (&$carry): void { + $carry = $v; + }); + $this->assertNotSame($p, $p2); + $this->assertNull($carry); + P\Utils::queue()->run(); + $this->assertSame('foo', $carry); + } + + public function testCreatesPromiseWhenFulfilledWithNoCallback(): void + { + $p = new Promise(); + $p->resolve('foo'); + $p2 = $p->then(); + $this->assertNotSame($p, $p2); + $this->assertInstanceOf(FulfilledPromise::class, $p2); + } + + public function testCreatesPromiseWhenRejectedAfterThen(): void + { + $p = new Promise(); + $carry = null; + $p2 = $p->then(null, function ($v) use (&$carry): void { + $carry = $v; + }); + $this->assertNotSame($p, $p2); + $p->reject('foo'); + P\Utils::queue()->run(); + $this->assertSame('foo', $carry); + } + + public function testCreatesPromiseWhenRejectedBeforeThen(): void + { + $p = new Promise(); + $p->reject('foo'); + $carry = null; + $p2 = $p->then(null, function ($v) use (&$carry): void { + $carry = $v; + }); + $this->assertNotSame($p, $p2); + $this->assertNull($carry); + P\Utils::queue()->run(); + $this->assertSame('foo', $carry); + } + + public function testCreatesPromiseWhenRejectedWithNoCallback(): void + { + $p = new Promise(); + $p->reject('foo'); + $p2 = $p->then(); + $this->assertNotSame($p, $p2); + $this->assertInstanceOf(RejectedPromise::class, $p2); + } + + public function testInvokesWaitFnsForThens(): void + { + $p = new Promise(function () use (&$p): void { + $p->resolve('a'); + }); + $p2 = $p + ->then(function ($v) { + return $v.'-1-'; + }) + ->then(function ($v) { + return $v.'2'; + }); + $this->assertSame('a-1-2', $p2->wait()); + } + + public function testStacksThenWaitFunctions(): void + { + $p1 = new Promise(function () use (&$p1): void { + $p1->resolve('a'); + }); + $p2 = new Promise(function () use (&$p2): void { + $p2->resolve('b'); + }); + $p3 = new Promise(function () use (&$p3): void { + $p3->resolve('c'); + }); + $p4 = $p1 + ->then(function () use ($p2) { + return $p2; + }) + ->then(function () use ($p3) { + return $p3; + }); + $this->assertSame('c', $p4->wait()); + } + + public function testForwardsFulfilledDownChainBetweenGaps(): void + { + $p = new Promise(); + $r = $r2 = null; + $p->then(null, null) + ->then(function ($v) use (&$r) { + $r = $v; + + return $v.'2'; + }) + ->then(function ($v) use (&$r2): void { + $r2 = $v; + }); + $p->resolve('foo'); + P\Utils::queue()->run(); + $this->assertSame('foo', $r); + $this->assertSame('foo2', $r2); + } + + public function testForwardsRejectedPromisesDownChainBetweenGaps(): void + { + $p = new Promise(); + $r = $r2 = null; + $p->then(null, null) + ->then(null, function ($v) use (&$r) { + $r = $v; + + return $v.'2'; + }) + ->then(function ($v) use (&$r2): void { + $r2 = $v; + }); + $p->reject('foo'); + P\Utils::queue()->run(); + $this->assertSame('foo', $r); + $this->assertSame('foo2', $r2); + } + + public function testForwardsThrownPromisesDownChainBetweenGaps(): void + { + $e = new \Exception(); + $p = new Promise(); + $r = $r2 = null; + $p->then(null, null) + ->then(null, function ($v) use (&$r, $e): void { + $r = $v; + throw $e; + }) + ->then( + null, + function ($v) use (&$r2): void { + $r2 = $v; + } + ); + $p->reject('foo'); + P\Utils::queue()->run(); + $this->assertSame('foo', $r); + $this->assertSame($e, $r2); + } + + public function testForwardsReturnedRejectedPromisesDownChainBetweenGaps(): void + { + $p = new Promise(); + $rejected = new RejectedPromise('bar'); + $r = $r2 = null; + $p->then(null, null) + ->then(null, function ($v) use (&$r, $rejected) { + $r = $v; + + return $rejected; + }) + ->then( + null, + function ($v) use (&$r2): void { + $r2 = $v; + } + ); + $p->reject('foo'); + P\Utils::queue()->run(); + $this->assertSame('foo', $r); + $this->assertSame('bar', $r2); + try { + $p->wait(); + } catch (RejectionException $e) { + $this->assertSame('foo', $e->getReason()); + } + } + + public function testForwardsHandlersToNextPromise(): void + { + $p = new Promise(); + $p2 = new Promise(); + $resolved = null; + $p + ->then(function ($v) use ($p2) { + return $p2; + }) + ->then(function ($value) use (&$resolved): void { + $resolved = $value; + }); + $p->resolve('a'); + $p2->resolve('b'); + P\Utils::queue()->run(); + $this->assertSame('b', $resolved); + } + + public function testRemovesReferenceFromChildWhenParentWaitedUpon(): void + { + $r = null; + $p = new Promise(function () use (&$p): void { + $p->resolve('a'); + }); + $p2 = new Promise(function () use (&$p2): void { + $p2->resolve('b'); + }); + $pb = $p->then( + function ($v) use ($p2, &$r) { + $r = $v; + + return $p2; + } + ) + ->then(function ($v) { + return $v.'.'; + }); + $this->assertSame('a', $p->wait()); + $this->assertSame('b', $p2->wait()); + $this->assertSame('b.', $pb->wait()); + $this->assertSame('a', $r); + } + + public function testForwardsHandlersWhenFulfilledPromiseIsReturned(): void + { + $res = []; + $p = new Promise(); + $p2 = new Promise(); + $p2->resolve('foo'); + $p2->then(function ($v) use (&$res): void { + $res[] = 'A:'.$v; + }); + // $res is A:foo + $p + ->then(function () use ($p2, &$res) { + $res[] = 'B'; + + return $p2; + }) + ->then(function ($v) use (&$res): void { + $res[] = 'C:'.$v; + }); + $p->resolve('a'); + $p->then(function ($v) use (&$res): void { + $res[] = 'D:'.$v; + }); + P\Utils::queue()->run(); + $this->assertSame(['A:foo', 'B', 'D:a', 'C:foo'], $res); + } + + public function testForwardsHandlersWhenRejectedPromiseIsReturned(): void + { + $res = []; + $p = new Promise(); + $p2 = new Promise(); + $p2->reject('foo'); + $p2->then(null, function ($v) use (&$res): void { + $res[] = 'A:'.$v; + }); + $p->then(null, function () use ($p2, &$res) { + $res[] = 'B'; + + return $p2; + }) + ->then(null, function ($v) use (&$res): void { + $res[] = 'C:'.$v; + }); + $p->reject('a'); + $p->then(null, function ($v) use (&$res): void { + $res[] = 'D:'.$v; + }); + P\Utils::queue()->run(); + $this->assertSame(['A:foo', 'B', 'D:a', 'C:foo'], $res); + } + + public function testDoesNotForwardRejectedPromise(): void + { + $res = []; + $p = new Promise(); + $p2 = new Promise(); + $p2->cancel(); + $p2->then(function ($v) use (&$res) { + $res[] = "B:$v"; + + return $v; + }); + $p->then(function ($v) use ($p2, &$res) { + $res[] = "B:$v"; + + return $p2; + }) + ->then(function ($v) use (&$res): void { + $res[] = 'C:'.$v; + }); + $p->resolve('a'); + $p->then(function ($v) use (&$res): void { + $res[] = 'D:'.$v; + }); + P\Utils::queue()->run(); + $this->assertSame(['B:a', 'D:a'], $res); + } + + public function testRecursivelyForwardsWhenOnlyThennable(): void + { + $res = []; + $p = new Promise(); + $p2 = new Thennable(); + $p2->resolve('foo'); + $p2->then(function ($v) use (&$res): void { + $res[] = 'A:'.$v; + }); + $p->then(function () use ($p2, &$res) { + $res[] = 'B'; + + return $p2; + }) + ->then(function ($v) use (&$res): void { + $res[] = 'C:'.$v; + }); + $p->resolve('a'); + $p->then(function ($v) use (&$res): void { + $res[] = 'D:'.$v; + }); + P\Utils::queue()->run(); + $this->assertSame(['A:foo', 'B', 'D:a', 'C:foo'], $res); + } + + public function testRecursivelyForwardsWhenNotInstanceOfPromise(): void + { + $res = []; + $p = new Promise(); + $p2 = new NotPromiseInstance(); + $p2->then(function ($v) use (&$res): void { + $res[] = 'A:'.$v; + }); + $p->then(function () use ($p2, &$res) { + $res[] = 'B'; + + return $p2; + }) + ->then(function ($v) use (&$res): void { + $res[] = 'C:'.$v; + }); + $p->resolve('a'); + $p->then(function ($v) use (&$res): void { + $res[] = 'D:'.$v; + }); + P\Utils::queue()->run(); + $this->assertSame(['B', 'D:a'], $res); + $p2->resolve('foo'); + P\Utils::queue()->run(); + $this->assertSame(['B', 'D:a', 'A:foo', 'C:foo'], $res); + } + + public function testCannotResolveWithSelf(): void + { + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Cannot fulfill or reject a promise with itself'); + + $p = new Promise(); + $p->resolve($p); + } + + public function testCannotRejectWithSelf(): void + { + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Cannot fulfill or reject a promise with itself'); + + $p = new Promise(); + $p->reject($p); + } + + public function testDoesNotBlowStackWhenWaitingOnNestedThens(): void + { + $inner = new Promise(function () use (&$inner): void { + $inner->resolve(0); + }); + $prev = $inner; + for ($i = 1; $i < 100; ++$i) { + $prev = $prev->then(function ($i) { + return $i + 1; + }); + } + + $parent = new Promise(function () use (&$parent, $prev): void { + $parent->resolve($prev); + }); + + $this->assertSame(99, $parent->wait()); + } + + public function testOtherwiseIsSugarForRejections(): void + { + $p = new Promise(); + $p->reject('foo'); + $p->otherwise(function ($v) use (&$c): void { + $c = $v; + }); + P\Utils::queue()->run(); + $this->assertSame($c, 'foo'); + } + + public function testRepeatedWaitFulfilled(): void + { + $promise = new Promise(function () use (&$promise): void { + $promise->resolve('foo'); + }); + + $this->assertSame('foo', $promise->wait()); + $this->assertSame('foo', $promise->wait()); + } + + public function testRepeatedWaitRejected(): void + { + $promise = new Promise(function () use (&$promise): void { + $promise->reject(new \RuntimeException('foo')); + }); + + $exceptionCount = 0; + try { + $promise->wait(); + } catch (\Exception $e) { + $this->assertSame('foo', $e->getMessage()); + ++$exceptionCount; + } + + try { + $promise->wait(); + } catch (\Exception $e) { + $this->assertSame('foo', $e->getMessage()); + ++$exceptionCount; + } + + $this->assertSame(2, $exceptionCount); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PropertyHelper.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PropertyHelper.php new file mode 100644 index 0000000000..d3a674f8c0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/PropertyHelper.php @@ -0,0 +1,29 @@ + + */ +class PropertyHelper +{ + /** + * @param object $object + * @param string $property + * + * @throws \ReflectionException + */ + public static function get($object, $property) + { + $property = (new \ReflectionObject($object))->getProperty($property); + $property->setAccessible(true); + + return $property->getValue($object); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectedPromiseTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectedPromiseTest.php new file mode 100644 index 0000000000..f24b14ac7d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectedPromiseTest.php @@ -0,0 +1,151 @@ +assertTrue(P\Is::rejected($p)); + try { + $p->wait(true); + $this->fail(); + } catch (\Exception $e) { + $this->assertTrue(P\Is::rejected($p)); + $this->assertStringContainsString('foo', $e->getMessage()); + } + } + + public function testCannotCancel(): void + { + $p = new RejectedPromise('foo'); + $p->cancel(); + $this->assertTrue(P\Is::rejected($p)); + } + + /** + * @exepctedExceptionMessage Cannot resolve a rejected promise + */ + public function testCannotResolve(): void + { + $this->expectException(\LogicException::class); + + $p = new RejectedPromise('foo'); + $p->resolve('bar'); + } + + /** + * @expectedExceptionMessage Cannot reject a rejected promise + */ + public function testCannotReject(): void + { + $this->expectException(\LogicException::class); + + $p = new RejectedPromise('foo'); + $p->reject('bar'); + } + + public function testCanRejectWithSameValue(): void + { + $p = new RejectedPromise('foo'); + $p->reject('foo'); + $this->assertTrue(P\Is::rejected($p)); + } + + public function testThrowsSpecificException(): void + { + $e = new \Exception(); + $p = new RejectedPromise($e); + try { + $p->wait(true); + $this->fail(); + } catch (\Exception $e2) { + $this->assertSame($e, $e2); + } + } + + public function testCannotResolveWithPromise(): void + { + $this->expectException(\InvalidArgumentException::class); + + new RejectedPromise(new Promise()); + } + + public function testReturnsSelfWhenNoOnReject(): void + { + $p = new RejectedPromise('a'); + $this->assertSame($p, $p->then()); + } + + public function testInvokesOnRejectedAsynchronously(): void + { + $p = new RejectedPromise('a'); + $r = null; + $f = function ($reason) use (&$r): void { $r = $reason; }; + $p->then(null, $f); + $this->assertNull($r); + P\Utils::queue()->run(); + $this->assertSame('a', $r); + } + + public function testReturnsNewRejectedWhenOnRejectedFails(): void + { + $p = new RejectedPromise('a'); + $f = function (): void { throw new \Exception('b'); }; + $p2 = $p->then(null, $f); + $this->assertNotSame($p, $p2); + try { + $p2->wait(); + $this->fail(); + } catch (\Exception $e) { + $this->assertSame('b', $e->getMessage()); + } + } + + public function testWaitingIsNoOp(): void + { + $p = new RejectedPromise('a'); + $p->wait(false); + $this->assertTrue(P\Is::rejected($p)); + } + + public function testOtherwiseIsSugarForRejections(): void + { + $p = new RejectedPromise('foo'); + $p->otherwise(function ($v) use (&$c): void { $c = $v; }); + P\Utils::queue()->run(); + $this->assertSame('foo', $c); + } + + public function testCanResolveThenWithSuccess(): void + { + $actual = null; + $p = new RejectedPromise('foo'); + $p->otherwise(function ($v) { + return $v.' bar'; + })->then(function ($v) use (&$actual): void { + $actual = $v; + }); + P\Utils::queue()->run(); + $this->assertSame('foo bar', $actual); + } + + public function testDoesNotTryToRejectTwiceDuringTrampoline(): void + { + $fp = new RejectedPromise('a'); + $t1 = $fp->then(null, function ($v) { return $v.' b'; }); + $t1->resolve('why!'); + $this->assertSame('why!', $t1->wait()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectionExceptionTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectionExceptionTest.php new file mode 100644 index 0000000000..73ff53aede --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/RejectionExceptionTest.php @@ -0,0 +1,30 @@ +assertSame($thing, $e->getReason()); + $this->assertSame('The promise was rejected with reason: foo', $e->getMessage()); + } + + public function testCanGetReasonMessageFromJson(): void + { + $reason = new Thing2(); + $e = new RejectionException($reason); + $this->assertStringContainsString('{}', $e->getMessage()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/TaskQueueTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/TaskQueueTest.php new file mode 100644 index 0000000000..d45a37dd32 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/TaskQueueTest.php @@ -0,0 +1,35 @@ +assertTrue($tq->isEmpty()); + } + + public function testKnowsIfFull(): void + { + $tq = new TaskQueue(false); + $tq->add(function (): void {}); + $this->assertFalse($tq->isEmpty()); + } + + public function testExecutesTasksInOrder(): void + { + $tq = new TaskQueue(false); + $called = []; + $tq->add(function () use (&$called): void { $called[] = 'a'; }); + $tq->add(function () use (&$called): void { $called[] = 'b'; }); + $tq->add(function () use (&$called): void { $called[] = 'c'; }); + $tq->run(); + $this->assertSame(['a', 'b', 'c'], $called); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thennable.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thennable.php new file mode 100644 index 0000000000..fb1e49627b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thennable.php @@ -0,0 +1,27 @@ +nextPromise = new Promise(); + } + + public function then(?callable $res = null, ?callable $rej = null) + { + return $this->nextPromise->then($res, $rej); + } + + public function resolve($value): void + { + $this->nextPromise->resolve($value); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing1.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing1.php new file mode 100644 index 0000000000..78cc84ef8a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing1.php @@ -0,0 +1,20 @@ +message = $message; + } + + public function __toString() + { + return $this->message; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing2.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing2.php new file mode 100644 index 0000000000..efd7065944 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/tests/Thing2.php @@ -0,0 +1,14 @@ +resolve('a'); }); + $b = new Promise(function () use (&$b): void { $b->reject('b'); }); + $c = new Promise(function () use (&$c, $e): void { $c->reject($e); }); + $results = P\Utils::inspectAll([$a, $b, $c]); + $this->assertSame([ + ['state' => 'fulfilled', 'value' => 'a'], + ['state' => 'rejected', 'reason' => 'b'], + ['state' => 'rejected', 'reason' => $e], + ], $results); + } + + public function testUnwrapsPromisesWithNoDefaultAndFailure(): void + { + $this->expectException(RejectionException::class); + + $promises = [new FulfilledPromise('a'), new Promise()]; + P\Utils::unwrap($promises); + } + + public function testUnwrapsPromisesWithNoDefault(): void + { + $promises = [new FulfilledPromise('a')]; + $this->assertSame(['a'], P\Utils::unwrap($promises)); + } + + public function testUnwrapsPromisesWithKeys(): void + { + $promises = [ + 'foo' => new FulfilledPromise('a'), + 'bar' => new FulfilledPromise('b'), + ]; + $this->assertSame([ + 'foo' => 'a', + 'bar' => 'b', + ], P\Utils::unwrap($promises)); + } + + public function testAllAggregatesSortedArray(): void + { + $a = new Promise(); + $b = new Promise(); + $c = new Promise(); + $d = P\Utils::all([$a, $b, $c]); + $b->resolve('b'); + $a->resolve('a'); + $c->resolve('c'); + $d->then( + function ($value) use (&$result): void { $result = $value; }, + function ($reason) use (&$result): void { $result = $reason; } + ); + P\Utils::queue()->run(); + $this->assertSame(['a', 'b', 'c'], $result); + } + + public function testPromisesDynamicallyAddedToStack(): void + { + $promises = new \ArrayIterator(); + $counter = 0; + $promises['a'] = new FulfilledPromise('a'); + $promises['b'] = $promise = new Promise(function () use (&$promise, &$promises, &$counter): void { + ++$counter; // Make sure the wait function is called only once + $promise->resolve('b'); + $promises['c'] = $subPromise = new Promise(function () use (&$subPromise): void { + $subPromise->resolve('c'); + }); + }); + $result = P\Utils::all($promises, true)->wait(); + $this->assertCount(3, $promises); + $this->assertCount(3, $result); + $this->assertSame($result['c'], 'c'); + $this->assertSame(1, $counter); + } + + public function testAllThrowsWhenAnyRejected(): void + { + $a = new Promise(); + $b = new Promise(); + $c = new Promise(); + $d = P\Utils::all([$a, $b, $c]); + $b->resolve('b'); + $a->reject('fail'); + $c->resolve('c'); + $d->then( + function ($value) use (&$result): void { $result = $value; }, + function ($reason) use (&$result): void { $result = $reason; } + ); + P\Utils::queue()->run(); + $this->assertSame('fail', $result); + } + + public function testSomeAggregatesSortedArrayWithMax(): void + { + $a = new Promise(); + $b = new Promise(); + $c = new Promise(); + $d = P\Utils::some(2, [$a, $b, $c]); + $b->resolve('b'); + $c->resolve('c'); + $a->resolve('a'); + $d->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame(['b', 'c'], $result); + } + + public function testSomeRejectsWhenTooManyRejections(): void + { + $a = new Promise(); + $b = new Promise(); + $d = P\Utils::some(2, [$a, $b]); + $a->reject('bad'); + $b->resolve('good'); + P\Utils::queue()->run(); + $this->assertTrue(P\Is::rejected($d)); + $d->then(null, function ($reason) use (&$called): void { + $called = $reason; + }); + P\Utils::queue()->run(); + $this->assertInstanceOf(AggregateException::class, $called); + $this->assertContains('bad', $called->getReason()); + } + + public function testCanWaitUntilSomeCountIsSatisfied(): void + { + $a = new Promise(function () use (&$a): void { $a->resolve('a'); }); + $b = new Promise(function () use (&$b): void { $b->resolve('b'); }); + $c = new Promise(function () use (&$c): void { $c->resolve('c'); }); + $d = P\Utils::some(2, [$a, $b, $c]); + $this->assertSame(['a', 'b'], $d->wait()); + } + + public function testThrowsIfImpossibleToWaitForSomeCount(): void + { + $this->expectException(AggregateException::class); + $this->expectExceptionMessage('Not enough promises to fulfill count'); + + $a = new Promise(function () use (&$a): void { $a->resolve('a'); }); + $d = P\Utils::some(2, [$a]); + $d->wait(); + } + + public function testThrowsIfResolvedWithoutCountTotalResults(): void + { + $this->expectException(AggregateException::class); + $this->expectExceptionMessage('Not enough promises to fulfill count'); + + $a = new Promise(); + $b = new Promise(); + $d = P\Utils::some(3, [$a, $b]); + $a->resolve('a'); + $b->resolve('b'); + $d->wait(); + } + + public function testAnyReturnsFirstMatch(): void + { + $a = new Promise(); + $b = new Promise(); + $c = P\Utils::any([$a, $b]); + $b->resolve('b'); + $a->resolve('a'); + $c->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame('b', $result); + } + + public function testSettleFulfillsWithFulfilledAndRejected(): void + { + $a = new Promise(); + $b = new Promise(); + $c = new Promise(); + $d = P\Utils::settle([$a, $b, $c]); + $b->resolve('b'); + $c->resolve('c'); + $a->reject('a'); + P\Utils::queue()->run(); + $this->assertTrue(P\Is::fulfilled($d)); + $d->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame([ + ['state' => 'rejected', 'reason' => 'a'], + ['state' => 'fulfilled', 'value' => 'b'], + ['state' => 'fulfilled', 'value' => 'c'], + ], $result); + } + + public function testCanInspectFulfilledPromise(): void + { + $p = new FulfilledPromise('foo'); + $this->assertSame([ + 'state' => 'fulfilled', + 'value' => 'foo', + ], P\Utils::inspect($p)); + } + + public function testCanInspectRejectedPromise(): void + { + $p = new RejectedPromise('foo'); + $this->assertSame([ + 'state' => 'rejected', + 'reason' => 'foo', + ], P\Utils::inspect($p)); + } + + public function testCanInspectRejectedPromiseWithNormalException(): void + { + $e = new \Exception('foo'); + $p = new RejectedPromise($e); + $this->assertSame([ + 'state' => 'rejected', + 'reason' => $e, + ], P\Utils::inspect($p)); + } + + public function testReturnsTrampoline(): void + { + $this->assertInstanceOf(TaskQueue::class, P\Utils::queue()); + $this->assertSame(P\Utils::queue(), P\Utils::queue()); + } + + public function testCanScheduleThunk(): void + { + $tramp = P\Utils::queue(); + $promise = P\Utils::task(function () { return 'Hi!'; }); + $c = null; + $promise->then(function ($v) use (&$c): void { $c = $v; }); + $this->assertNull($c); + $tramp->run(); + $this->assertSame('Hi!', $c); + } + + public function testCanScheduleThunkWithRejection(): void + { + $tramp = P\Utils::queue(); + $promise = P\Utils::task(function (): void { throw new \Exception('Hi!'); }); + $c = null; + $promise->otherwise(function ($v) use (&$c): void { $c = $v; }); + $this->assertNull($c); + $tramp->run(); + $this->assertSame('Hi!', $c->getMessage()); + } + + public function testCanScheduleThunkWithWait(): void + { + $tramp = P\Utils::queue(); + $promise = P\Utils::task(function () { return 'a'; }); + $this->assertSame('a', $promise->wait()); + $tramp->run(); + } + + public function testYieldsFromCoroutine(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = P\Coroutine::of(function () { + $value = (yield new FulfilledPromise('a')); + yield $value.'b'; + }); + $promise->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame('ab', $result); + } + + public function testCanCatchExceptionsInCoroutine(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = P\Coroutine::of(function () { + try { + yield new RejectedPromise('a'); + $this->fail('Should have thrown into the coroutine!'); + } catch (RejectionException $e) { + $value = (yield new FulfilledPromise($e->getReason())); + yield $value.'b'; + } + }); + $promise->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertTrue(P\Is::fulfilled($promise)); + $this->assertSame('ab', $result); + } + + /** + * @dataProvider rejectsParentExceptionProvider + */ + public function testRejectsParentExceptionWhenException(PromiseInterface $promise): void + { + $promise->then( + function (): void { $this->fail(); }, + function ($reason) use (&$result): void { $result = $reason; } + ); + P\Utils::queue()->run(); + $this->assertInstanceOf(\Exception::class, $result); + $this->assertSame('a', $result->getMessage()); + } + + public function rejectsParentExceptionProvider() + { + return [ + [P\Coroutine::of(function () { + yield new FulfilledPromise(0); + throw new \Exception('a'); + })], + [P\Coroutine::of(function () { + throw new \Exception('a'); + yield new FulfilledPromise(0); + })], + ]; + } + + public function testCanRejectFromRejectionCallback(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = P\Coroutine::of(function () { + yield new FulfilledPromise(0); + yield new RejectedPromise('no!'); + }); + $promise->then( + function (): void { $this->fail(); }, + function ($reason) use (&$result): void { $result = $reason; } + ); + P\Utils::queue()->run(); + $this->assertInstanceOf(RejectionException::class, $result); + $this->assertSame('no!', $result->getReason()); + } + + public function testCanAsyncReject(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $rej = new Promise(); + $promise = P\Coroutine::of(function () use ($rej) { + yield new FulfilledPromise(0); + yield $rej; + }); + $promise->then( + function (): void { $this->fail(); }, + function ($reason) use (&$result): void { $result = $reason; } + ); + $rej->reject('no!'); + P\Utils::queue()->run(); + $this->assertInstanceOf(RejectionException::class, $result); + $this->assertSame('no!', $result->getReason()); + } + + public function testCanCatchAndThrowOtherException(): void + { + $promise = P\Coroutine::of(function () { + try { + yield new RejectedPromise('a'); + $this->fail('Should have thrown into the coroutine!'); + } catch (RejectionException $e) { + throw new \Exception('foo'); + } + }); + $promise->otherwise(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertTrue(P\Is::rejected($promise)); + $this->assertStringContainsString('foo', $result->getMessage()); + } + + public function testCanCatchAndYieldOtherException(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = P\Coroutine::of(function () { + try { + yield new RejectedPromise('a'); + $this->fail('Should have thrown into the coroutine!'); + } catch (RejectionException $e) { + yield new RejectedPromise('foo'); + } + }); + $promise->otherwise(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertTrue(P\Is::rejected($promise)); + $this->assertStringContainsString('foo', $result->getMessage()); + } + + public function createLotsOfSynchronousPromise() + { + return P\Coroutine::of(function () { + $value = 0; + for ($i = 0; $i < 1000; ++$i) { + $value = (yield new FulfilledPromise($i)); + } + yield $value; + }); + } + + public function testLotsOfSynchronousDoesNotBlowStack(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = $this->createLotsOfSynchronousPromise(); + $promise->then(function ($v) use (&$r): void { $r = $v; }); + P\Utils::queue()->run(); + $this->assertSame(999, $r); + } + + public function testLotsOfSynchronousWaitDoesNotBlowStack(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = $this->createLotsOfSynchronousPromise(); + $promise->then(function ($v) use (&$r): void { $r = $v; }); + $this->assertSame(999, $promise->wait()); + $this->assertSame(999, $r); + } + + private function createLotsOfFlappingPromise() + { + return P\Coroutine::of(function () { + $value = 0; + for ($i = 0; $i < 1000; ++$i) { + try { + if ($i % 2) { + $value = (yield new FulfilledPromise($i)); + } else { + $value = (yield new RejectedPromise($i)); + } + } catch (\Exception $e) { + $value = (yield new FulfilledPromise($i)); + } + } + yield $value; + }); + } + + public function testLotsOfTryCatchingDoesNotBlowStack(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = $this->createLotsOfFlappingPromise(); + $promise->then(function ($v) use (&$r): void { $r = $v; }); + P\Utils::queue()->run(); + $this->assertSame(999, $r); + } + + public function testLotsOfTryCatchingWaitingDoesNotBlowStack(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promise = $this->createLotsOfFlappingPromise(); + $promise->then(function ($v) use (&$r): void { $r = $v; }); + $this->assertSame(999, $promise->wait()); + $this->assertSame(999, $r); + } + + public function testAsyncPromisesWithCorrectlyYieldedValues(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promises = [ + new Promise(), + new Promise(), + new Promise(), + ]; + + eval(' + $promise = \GuzzleHttp\Promise\Coroutine::of(function () use ($promises) { + $value = null; + $this->assertSame(\'skip\', (yield new \GuzzleHttp\Promise\FulfilledPromise(\'skip\'))); + foreach ($promises as $idx => $p) { + $value = (yield $p); + $this->assertSame($idx, $value); + $this->assertSame(\'skip\', (yield new \GuzzleHttp\Promise\FulfilledPromise(\'skip\'))); + } + $this->assertSame(\'skip\', (yield new \GuzzleHttp\Promise\FulfilledPromise(\'skip\'))); + yield $value; + }); +'); + + $promises[0]->resolve(0); + $promises[1]->resolve(1); + $promises[2]->resolve(2); + + $promise->then(function ($v) use (&$r): void { $r = $v; }); + P\Utils::queue()->run(); + $this->assertSame(2, $r); + } + + public function testYieldFinalWaitablePromise(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $p1 = new Promise(function () use (&$p1): void { + $p1->resolve('skip me'); + }); + $p2 = new Promise(function () use (&$p2): void { + $p2->resolve('hello!'); + }); + $co = P\Coroutine::of(function () use ($p1, $p2) { + yield $p1; + yield $p2; + }); + P\Utils::queue()->run(); + $this->assertSame('hello!', $co->wait()); + } + + public function testCanYieldFinalPendingPromise(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $p1 = new Promise(); + $p2 = new Promise(); + $co = P\Coroutine::of(function () use ($p1, $p2) { + yield $p1; + yield $p2; + }); + $p1->resolve('a'); + $p2->resolve('b'); + $co->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame('b', $result); + } + + public function testCanNestYieldsAndFailures(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $p1 = new Promise(); + $p2 = new Promise(); + $p3 = new Promise(); + $p4 = new Promise(); + $p5 = new Promise(); + $co = P\Coroutine::of(function () use ($p1, $p2, $p3, $p4, $p5) { + try { + yield $p1; + } catch (\Exception $e) { + yield $p2; + try { + yield $p3; + yield $p4; + } catch (\Exception $e) { + yield $p5; + } + } + }); + $p1->reject('a'); + $p2->resolve('b'); + $p3->resolve('c'); + $p4->reject('d'); + $p5->resolve('e'); + $co->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame('e', $result); + } + + public function testCanYieldErrorsAndSuccessesWithoutRecursion(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $promises = []; + for ($i = 0; $i < 20; ++$i) { + $promises[] = new Promise(); + } + + $co = P\Coroutine::of(function () use ($promises) { + for ($i = 0; $i < 20; $i += 4) { + try { + yield $promises[$i]; + yield $promises[$i + 1]; + } catch (\Exception $e) { + yield $promises[$i + 2]; + yield $promises[$i + 3]; + } + } + }); + + for ($i = 0; $i < 20; $i += 4) { + $promises[$i]->resolve($i); + $promises[$i + 1]->reject($i + 1); + $promises[$i + 2]->resolve($i + 2); + $promises[$i + 3]->resolve($i + 3); + } + + $co->then(function ($value) use (&$result): void { $result = $value; }); + P\Utils::queue()->run(); + $this->assertSame(19, $result); + } + + public function testCanWaitOnPromiseAfterFulfilled(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $f = function () { + static $i = 0; + ++$i; + + return $p = new Promise(function () use (&$p, $i): void { + $p->resolve($i.'-bar'); + }); + }; + + $promises = []; + for ($i = 0; $i < 20; ++$i) { + $promises[] = $f(); + } + + $p = P\Coroutine::of(function () use ($promises) { + yield new FulfilledPromise('foo!'); + foreach ($promises as $promise) { + yield $promise; + } + }); + + $this->assertSame('20-bar', $p->wait()); + } + + public function testCanWaitOnErroredPromises(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $p1 = new Promise(function () use (&$p1): void { $p1->reject('a'); }); + $p2 = new Promise(function () use (&$p2): void { $p2->resolve('b'); }); + $p3 = new Promise(function () use (&$p3): void { $p3->resolve('c'); }); + $p4 = new Promise(function () use (&$p4): void { $p4->reject('d'); }); + $p5 = new Promise(function () use (&$p5): void { $p5->resolve('e'); }); + $p6 = new Promise(function () use (&$p6): void { $p6->reject('f'); }); + + $co = P\Coroutine::of(function () use ($p1, $p2, $p3, $p4, $p5, $p6) { + try { + yield $p1; + } catch (\Exception $e) { + yield $p2; + try { + yield $p3; + yield $p4; + } catch (\Exception $e) { + yield $p5; + yield $p6; + } + } + }); + + $res = P\Utils::inspect($co); + $this->assertSame('f', $res['reason']); + } + + public function testCoroutineOtherwiseIntegrationTest(): void + { + if (defined('HHVM_VERSION')) { + $this->markTestIncomplete('Broken on HHVM.'); + } + + $a = new Promise(); + $b = new Promise(); + $promise = P\Coroutine::of(function () use ($a, $b) { + // Execute the pool of commands concurrently, and process errors. + yield $a; + yield $b; + })->otherwise(function (\Exception $e): void { + // Throw errors from the operations as a specific Multipart error. + throw new \OutOfBoundsException('a', 0, $e); + }); + $a->resolve('a'); + $b->reject('b'); + $reason = P\Utils::inspect($promise)['reason']; + $this->assertInstanceOf(\OutOfBoundsException::class, $reason); + $this->assertInstanceOf(RejectionException::class, $reason->getPrevious()); + } + + public function testCanManuallySettleTaskQueueGeneratedPromises(): void + { + $p1 = P\Utils::task(function () { return 'a'; }); + $p2 = P\Utils::task(function () { return 'b'; }); + $p3 = P\Utils::task(function () { return 'c'; }); + + $p1->cancel(); + $p2->resolve('b2'); + + $results = P\Utils::inspectAll([$p1, $p2, $p3]); + + $this->assertSame([ + ['state' => 'rejected', 'reason' => 'Promise has been cancelled'], + ['state' => 'fulfilled', 'value' => 'b2'], + ['state' => 'fulfilled', 'value' => 'c'], + ], $results); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json new file mode 100644 index 0000000000..72998c7515 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "friendsofphp/php-cs-fixer": "3.59.3" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/phpstan/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/phpstan/composer.json new file mode 100644 index 0000000000..77598be97b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/phpstan/composer.json @@ -0,0 +1,10 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "1.11.7", + "phpstan/phpstan-deprecation-rules": "1.2.0" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/psalm/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/psalm/composer.json new file mode 100644 index 0000000000..020abe5626 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/promises/vendor-bin/psalm/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "psalm/phar": "5.25.0" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.editorconfig b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.editorconfig new file mode 100644 index 0000000000..7c3e4a280f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[{Makefile, *.mk}] +indent_style = tab diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitattributes b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitattributes new file mode 100644 index 0000000000..687c48fb42 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitattributes @@ -0,0 +1,13 @@ +.editorconfig export-ignore +.gitattributes export-ignore +/.github/ export-ignore +.gitignore export-ignore +.php-cs-fixer.dist.php export-ignore +/Makefile export-ignore +/phpstan-baseline.neon export-ignore +/phpstan.neon.dist export-ignore +/phpunit.xml.dist export-ignore +/psalm-baseline.xml export-ignore +/psalm.xml export-ignore +/tests/ export-ignore +/vendor-bin/ export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/.editorconfig b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/.editorconfig new file mode 100644 index 0000000000..7bd3346f26 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/.editorconfig @@ -0,0 +1,2 @@ +[*.yml] +indent_size = 2 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/FUNDING.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/FUNDING.yml new file mode 100644 index 0000000000..7d222c5820 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [Nyholm, GrahamCampbell] +tidelift: "packagist/guzzlehttp/psr7" diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/stale.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/stale.yml new file mode 100644 index 0000000000..53faa71bd9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/stale.yml @@ -0,0 +1,14 @@ +daysUntilStale: 120 +daysUntilClose: 14 +exemptLabels: + - lifecycle/keep-open + - lifecycle/ready-for-merge +# Label to use when marking an issue as stale +staleLabel: lifecycle/stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/checks.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/checks.yml new file mode 100644 index 0000000000..aa01ed09ca --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/checks.yml @@ -0,0 +1,21 @@ +name: Checks + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + composer-normalize: + name: Composer Normalize + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Composer normalize + uses: docker://ergebnis/composer-normalize-action diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/ci.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/ci.yml new file mode 100644 index 0000000000..d554d7f167 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + build-lowest-version: + name: Build lowest version + runs-on: ubuntu-22.04 + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.2' + ini-values: error_reporting=E_ALL + coverage: 'none' + extensions: mbstring + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: composer update --no-interaction --prefer-stable --prefer-lowest --no-progress + + - name: Run tests + run: vendor/bin/phpunit --testsuite "Guzzle PSR-7 Unit Test Suite" + + build: + name: Build + runs-on: ubuntu-22.04 + strategy: + max-parallel: 10 + matrix: + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + coverage: 'none' + extensions: mbstring + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: composer update --no-interaction --no-progress + + - name: Run tests + run: vendor/bin/phpunit --testsuite "Guzzle PSR-7 Unit Test Suite" diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/integration.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/integration.yml new file mode 100644 index 0000000000..7163908d9a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/integration.yml @@ -0,0 +1,45 @@ +name: Integration + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + build: + name: Test + runs-on: ubuntu-22.04 + strategy: + max-parallel: 10 + matrix: + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + coverage: none + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: composer update --no-interaction --no-progress + + - name: Start server + run: php -S 127.0.0.1:10002 tests/Integration/server.php & + + - name: Run Guzzle tests + env: + TEST_SERVER: 127.0.0.1:10002 + run: vendor/bin/phpunit --testsuite "Guzzle PSR-7 Integration Test Suite" + + - name: Run Interop tests + env: + TEST_SERVER: 127.0.0.1:10002 + run: vendor/bin/phpunit --testsuite "PSR-17 Integration Test Suite" diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/static.yml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/static.yml new file mode 100644 index 0000000000..235e8a90ef --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.github/workflows/static.yml @@ -0,0 +1,82 @@ +name: Static analysis + +on: + push: + branches: + pull_request: + +permissions: + contents: read + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download PHPStan + run: composer bin phpstan update --no-interaction --no-progress + + - name: Execute PHPStan + run: vendor/bin/phpstan analyze --no-progress + + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download PHP CS Fixer + run: composer bin php-cs-fixer update --no-interaction --no-progress + + - name: Execute PHP CS Fixer + run: vendor/bin/php-cs-fixer fix --diff --dry-run + + psalm: + name: Psalm + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + extensions: mbstring + + - name: Download dependencies + run: composer update --no-interaction --no-progress + + - name: Download Psalm + run: composer bin psalm update --no-interaction --no-progress + + - name: Execute Psalm + run: vendor/bin/psalm.phar --no-progress --output-format=github diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitignore b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitignore new file mode 100644 index 0000000000..d9fe6a3097 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.gitignore @@ -0,0 +1,7 @@ +.php-cs-fixer.php +.php-cs-fixer.cache +.phpunit.result.cache +composer.lock +vendor/ +/phpstan.neon +/phpunit.xml diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.php-cs-fixer.dist.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.php-cs-fixer.dist.php new file mode 100644 index 0000000000..77b06848da --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/.php-cs-fixer.dist.php @@ -0,0 +1,28 @@ +setRiskyAllowed(true) + ->setRules([ + '@PHP71Migration:risky' => true, + '@PHPUnit75Migration:risky' => true, + '@PSR12:risky' => true, + '@Symfony' => true, + 'global_namespace_import' => false, + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + ], + 'phpdoc_annotation_without_dot' => false, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => false, + 'single_line_throw' => false, + 'yoda_style' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') + ->name('*.php') + ) +; + +return $config; diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/CHANGELOG.md new file mode 100644 index 0000000000..75aabfb93e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/CHANGELOG.md @@ -0,0 +1,465 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 2.7.0 - 2024-07-18 + +### Added + +- Add `Utils::redactUserInfo()` method +- Add ability to encode bools as ints in `Query::build` + +## 2.6.3 - 2024-07-18 + +### Fixed + +- Make `StreamWrapper::stream_stat()` return `false` if inner stream's size is `null` + +### Changed + +- PHP 8.4 support + +## 2.6.2 - 2023-12-03 + +### Fixed + +- Fixed another issue with the fact that PHP transforms numeric strings in array keys to ints + +### Changed + +- Updated links in docs to their canonical versions +- Replaced `call_user_func*` with native calls + +## 2.6.1 - 2023-08-27 + +### Fixed + +- Properly handle the fact that PHP transforms numeric strings in array keys to ints + +## 2.6.0 - 2023-08-03 + +### Changed + +- Updated the mime type map to add some new entries, fix a couple of invalid entries, and remove an invalid entry +- Fallback to `application/octet-stream` if we are unable to guess the content type for a multipart file upload + +## 2.5.1 - 2023-08-03 + +### Fixed + +- Corrected mime type for `.acc` files to `audio/aac` + +### Changed + +- PHP 8.3 support + +## 2.5.0 - 2023-04-17 + +### Changed + +- Adjusted `psr/http-message` version constraint to `^1.1 || ^2.0` + +## 2.4.5 - 2023-04-17 + +### Fixed + +- Prevent possible warnings on unset variables in `ServerRequest::normalizeNestedFileSpec` +- Fixed `Message::bodySummary` when `preg_match` fails +- Fixed header validation issue + +## 2.4.4 - 2023-03-09 + +### Changed + +- Removed the need for `AllowDynamicProperties` in `LazyOpenStream` + +## 2.4.3 - 2022-10-26 + +### Changed + +- Replaced `sha1(uniqid())` by `bin2hex(random_bytes(20))` + +## 2.4.2 - 2022-10-25 + +### Fixed + +- Fixed erroneous behaviour when combining host and relative path + +## 2.4.1 - 2022-08-28 + +### Fixed + +- Rewind body before reading in `Message::bodySummary` + +## 2.4.0 - 2022-06-20 + +### Added + +- Added provisional PHP 8.2 support +- Added `UriComparator::isCrossOrigin` method + +## 2.3.0 - 2022-06-09 + +### Fixed + +- Added `Header::splitList` method +- Added `Utils::tryGetContents` method +- Improved `Stream::getContents` method +- Updated mimetype mappings + +## 2.2.2 - 2022-06-08 + +### Fixed + +- Fix `Message::parseRequestUri` for numeric headers +- Re-wrap exceptions thrown in `fread` into runtime exceptions +- Throw an exception when multipart options is misformatted + +## 2.2.1 - 2022-03-20 + +### Fixed + +- Correct header value validation + +## 2.2.0 - 2022-03-20 + +### Added + +- A more compressive list of mime types +- Add JsonSerializable to Uri +- Missing return types + +### Fixed + +- Bug MultipartStream no `uri` metadata +- Bug MultipartStream with filename for `data://` streams +- Fixed new line handling in MultipartStream +- Reduced RAM usage when copying streams +- Updated parsing in `Header::normalize()` + +## 2.1.1 - 2022-03-20 + +### Fixed + +- Validate header values properly + +## 2.1.0 - 2021-10-06 + +### Changed + +- Attempting to create a `Uri` object from a malformed URI will no longer throw a generic + `InvalidArgumentException`, but rather a `MalformedUriException`, which inherits from the former + for backwards compatibility. Callers relying on the exception being thrown to detect invalid + URIs should catch the new exception. + +### Fixed + +- Return `null` in caching stream size if remote size is `null` + +## 2.0.0 - 2021-06-30 + +Identical to the RC release. + +## 2.0.0@RC-1 - 2021-04-29 + +### Fixed + +- Handle possibly unset `url` in `stream_get_meta_data` + +## 2.0.0@beta-1 - 2021-03-21 + +### Added + +- PSR-17 factories +- Made classes final +- PHP7 type hints + +### Changed + +- When building a query string, booleans are represented as 1 and 0. + +### Removed + +- PHP < 7.2 support +- All functions in the `GuzzleHttp\Psr7` namespace + +## 1.8.1 - 2021-03-21 + +### Fixed + +- Issue parsing IPv6 URLs +- Issue modifying ServerRequest lost all its attributes + +## 1.8.0 - 2021-03-21 + +### Added + +- Locale independent URL parsing +- Most classes got a `@final` annotation to prepare for 2.0 + +### Fixed + +- Issue when creating stream from `php://input` and curl-ext is not installed +- Broken `Utils::tryFopen()` on PHP 8 + +## 1.7.0 - 2020-09-30 + +### Added + +- Replaced functions by static methods + +### Fixed + +- Converting a non-seekable stream to a string +- Handle multiple Set-Cookie correctly +- Ignore array keys in header values when merging +- Allow multibyte characters to be parsed in `Message:bodySummary()` + +### Changed + +- Restored partial HHVM 3 support + + +## [1.6.1] - 2019-07-02 + +### Fixed + +- Accept null and bool header values again + + +## [1.6.0] - 2019-06-30 + +### Added + +- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244) +- Added MIME type for WEBP image format (#246) +- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272) + +### Changed + +- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262) +- Accept port number 0 to be valid (#270) + +### Fixed + +- Fixed subsequent reads from `php://input` in ServerRequest (#247) +- Fixed readable/writable detection for certain stream modes (#248) +- Fixed encoding of special characters in the `userInfo` component of an URI (#253) + + +## [1.5.2] - 2018-12-04 + +### Fixed + +- Check body size when getting the message summary + + +## [1.5.1] - 2018-12-04 + +### Fixed + +- Get the summary of a body only if it is readable + + +## [1.5.0] - 2018-12-03 + +### Added + +- Response first-line to response string exception (fixes #145) +- A test for #129 behavior +- `get_message_body_summary` function in order to get the message summary +- `3gp` and `mkv` mime types + +### Changed + +- Clarify exception message when stream is detached + +### Deprecated + +- Deprecated parsing folded header lines as per RFC 7230 + +### Fixed + +- Fix `AppendStream::detach` to not close streams +- `InflateStream` preserves `isSeekable` attribute of the underlying stream +- `ServerRequest::getUriFromGlobals` to support URLs in query parameters + + +Several other fixes and improvements. + + +## [1.4.2] - 2017-03-20 + +### Fixed + +- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing + calls to `trigger_error` when deprecated methods are invoked. + + +## [1.4.1] - 2017-02-27 + +### Added + +- Rriggering of silenced deprecation warnings. + +### Fixed + +- Reverted BC break by reintroducing behavior to automagically fix a URI with a + relative path and an authority by adding a leading slash to the path. It's only + deprecated now. + + +## [1.4.0] - 2017-02-21 + +### Added + +- Added common URI utility methods based on RFC 3986 (see documentation in the readme): + - `Uri::isDefaultPort` + - `Uri::isAbsolute` + - `Uri::isNetworkPathReference` + - `Uri::isAbsolutePathReference` + - `Uri::isRelativePathReference` + - `Uri::isSameDocumentReference` + - `Uri::composeComponents` + - `UriNormalizer::normalize` + - `UriNormalizer::isEquivalent` + - `UriResolver::relativize` + +### Changed + +- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form. +- Allow `parse_response` to parse a response without delimiting space and reason. +- Ensure each URI modification results in a valid URI according to PSR-7 discussions. + Invalid modifications will throw an exception instead of returning a wrong URI or + doing some magic. + - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + + +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, + e.g. as a user info password. +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may + be surrounded by whitespace which should be ignored according to RFC 7230 + Section 3.2.4. This does not apply to header names. +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the + key/value both in encoded as well as decoded form to those methods. This is + consistent with withPath, withQuery etc. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 + +### Added + +- Remaining interfaces needed for full PSR7 compatibility + (ServerRequestInterface, UploadedFileInterface, etc.). +- Support for stream_for from scalars. + +### Changed + +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote + streams, which can sometimes return fewer bytes than requested with `fread`. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. + + +## [1.2.1] - 2015-11-02 + +### Changes + +- Now supporting negative offsets when seeking to SEEK_END. + + +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in + `parse_request`. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 + +### Changed + +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed + in URIs: "(", ")", "*", "!", "'" +- A port is no longer added to a URI when the scheme is missing and no port is + present. + + +## 1.0.0 - 2015-05-19 + +Initial release. + +Currently unsupported: + +- `Psr\Http\Message\ServerRequestInterface` +- `Psr\Http\Message\UploadedFileInterface` + + + +[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/LICENSE b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/LICENSE new file mode 100644 index 0000000000..51c7ec81cb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/LICENSE @@ -0,0 +1,26 @@ +The MIT License (MIT) + +Copyright (c) 2015 Michael Dowling +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Graham Campbell +Copyright (c) 2016 Tobias Schultze +Copyright (c) 2016 George Mponos +Copyright (c) 2018 Tobias Nyholm + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/Makefile b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/Makefile new file mode 100644 index 0000000000..b3bfef653a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/Makefile @@ -0,0 +1,18 @@ +test: + vendor/bin/phpunit $(TEST) + +check-tag: + $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1")) + +tag: check-tag + @echo Tagging $(TAG) + chag update $(TAG) + git commit -a -m '$(TAG) release' + chag tag + @echo "Release has been created. Push using 'make release'" + @echo "Changes made in the release commit" + git diff HEAD~1 HEAD + +release: check-tag + git push origin master + git push origin $(TAG) diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/README.md b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/README.md new file mode 100644 index 0000000000..2e9bb0b9b1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/README.md @@ -0,0 +1,887 @@ +# PSR-7 Message Implementation + +This repository contains a full [PSR-7](https://www.php-fig.org/psr/psr-7/) +message implementation, several stream decorators, and some helpful +functionality like query string parsing. + +![CI](https://github.com/guzzle/psr7/workflows/CI/badge.svg) +![Static analysis](https://github.com/guzzle/psr7/workflows/Static%20analysis/badge.svg) + + +## Features + +This package comes with a number of stream implementations and stream +decorators. + + +## Installation + +```shell +composer require guzzlehttp/psr7 +``` + +## Version Guidance + +| Version | Status | PHP Version | +|---------|---------------------|--------------| +| 1.x | EOL (2024-06-30) | >=5.4,<8.2 | +| 2.x | Latest | >=7.2.5,<8.5 | + + +## AppendStream + +`GuzzleHttp\Psr7\AppendStream` + +Reads from multiple streams, one after the other. + +```php +use GuzzleHttp\Psr7; + +$a = Psr7\Utils::streamFor('abc, '); +$b = Psr7\Utils::streamFor('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\Utils::streamFor(' Above all listen to me')); + +echo $composed; // abc, 123. Above all listen to me. +``` + + +## BufferStream + +`GuzzleHttp\Psr7\BufferStream` + +Provides a buffer stream that can be written to fill a buffer, and read +from to remove bytes from the buffer. + +This stream returns a "hwm" metadata value that tells upstream consumers +what the configured high water mark of the stream is, or the maximum +preferred size of the buffer. + +```php +use GuzzleHttp\Psr7; + +// When more than 1024 bytes are in the buffer, it will begin returning +// false to writes. This is an indication that writers should slow down. +$buffer = new Psr7\BufferStream(1024); +``` + + +## CachingStream + +The CachingStream is used to allow seeking over previously read bytes on +non-seekable streams. This can be useful when transferring a non-seekable +entity body fails due to needing to rewind the stream (for example, resulting +from a redirect). Data that is read from the remote stream will be buffered in +a PHP temp stream so that previously read bytes are cached first in memory, +then on disk. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor(fopen('http://www.google.com', 'r')); +$stream = new Psr7\CachingStream($original); + +$stream->read(1024); +echo $stream->tell(); +// 1024 + +$stream->seek(0); +echo $stream->tell(); +// 0 +``` + + +## DroppingStream + +`GuzzleHttp\Psr7\DroppingStream` + +Stream decorator that begins dropping data once the size of the underlying +stream becomes too full. + +```php +use GuzzleHttp\Psr7; + +// Create an empty stream +$stream = Psr7\Utils::streamFor(); + +// Start dropping data when the stream has more than 10 bytes +$dropping = new Psr7\DroppingStream($stream, 10); + +$dropping->write('01234567890123456789'); +echo $stream; // 0123456789 +``` + + +## FnStream + +`GuzzleHttp\Psr7\FnStream` + +Compose stream implementations based on a hash of functions. + +Allows for easy testing and extension of a provided stream without needing +to create a concrete class for a simple extension point. + +```php + +use GuzzleHttp\Psr7; + +$stream = Psr7\Utils::streamFor('hi'); +$fnStream = Psr7\FnStream::decorate($stream, [ + 'rewind' => function () use ($stream) { + echo 'About to rewind - '; + $stream->rewind(); + echo 'rewound!'; + } +]); + +$fnStream->rewind(); +// Outputs: About to rewind - rewound! +``` + + +## InflateStream + +`GuzzleHttp\Psr7\InflateStream` + +Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content. + +This stream decorator converts the provided stream to a PHP stream resource, +then appends the zlib.inflate filter. The stream is then converted back +to a Guzzle stream resource to be used as a Guzzle stream. + + +## LazyOpenStream + +`GuzzleHttp\Psr7\LazyOpenStream` + +Lazily reads or writes to a file that is opened only after an IO operation +take place on the stream. + +```php +use GuzzleHttp\Psr7; + +$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); +// The file has not yet been opened... + +echo $stream->read(10); +// The file is opened and read from only when needed. +``` + + +## LimitStream + +`GuzzleHttp\Psr7\LimitStream` + +LimitStream can be used to read a subset or slice of an existing stream object. +This can be useful for breaking a large file into smaller pieces to be sent in +chunks (e.g. Amazon S3's multipart upload API). + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor(fopen('/tmp/test.txt', 'r+')); +echo $original->getSize(); +// >>> 1048576 + +// Limit the size of the body to 1024 bytes and start reading from byte 2048 +$stream = new Psr7\LimitStream($original, 1024, 2048); +echo $stream->getSize(); +// >>> 1024 +echo $stream->tell(); +// >>> 0 +``` + + +## MultipartStream + +`GuzzleHttp\Psr7\MultipartStream` + +Stream that when read returns bytes for a streaming multipart or +multipart/form-data stream. + + +## NoSeekStream + +`GuzzleHttp\Psr7\NoSeekStream` + +NoSeekStream wraps a stream and does not allow seeking. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor('foo'); +$noSeek = new Psr7\NoSeekStream($original); + +echo $noSeek->read(3); +// foo +var_export($noSeek->isSeekable()); +// false +$noSeek->seek(0); +var_export($noSeek->read(3)); +// NULL +``` + + +## PumpStream + +`GuzzleHttp\Psr7\PumpStream` + +Provides a read only stream that pumps data from a PHP callable. + +When invoking the provided callable, the PumpStream will pass the amount of +data requested to read to the callable. The callable can choose to ignore +this value and return fewer or more bytes than requested. Any extra data +returned by the provided callable is buffered internally until drained using +the read() function of the PumpStream. The provided callable MUST return +false when there is no more data to read. + + +## Implementing stream decorators + +Creating a stream decorator is very easy thanks to the +`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that +implement `Psr\Http\Message\StreamInterface` by proxying to an underlying +stream. Just `use` the `StreamDecoratorTrait` and implement your custom +methods. + +For example, let's say we wanted to call a specific function each time the last +byte is read from a stream. This could be implemented by overriding the +`read()` method. + +```php +use Psr\Http\Message\StreamInterface; +use GuzzleHttp\Psr7\StreamDecoratorTrait; + +class EofCallbackStream implements StreamInterface +{ + use StreamDecoratorTrait; + + private $callback; + + private $stream; + + public function __construct(StreamInterface $stream, callable $cb) + { + $this->stream = $stream; + $this->callback = $cb; + } + + public function read($length) + { + $result = $this->stream->read($length); + + // Invoke the callback when EOF is hit. + if ($this->eof()) { + ($this->callback)(); + } + + return $result; + } +} +``` + +This decorator could be added to any existing stream and used like so: + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor('foo'); + +$eofStream = new EofCallbackStream($original, function () { + echo 'EOF!'; +}); + +$eofStream->read(2); +$eofStream->read(1); +// echoes "EOF!" +$eofStream->seek(0); +$eofStream->read(3); +// echoes "EOF!" +``` + + +## PHP StreamWrapper + +You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a +PSR-7 stream as a PHP stream resource. + +Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP +stream from a PSR-7 stream. + +```php +use GuzzleHttp\Psr7\StreamWrapper; + +$stream = GuzzleHttp\Psr7\Utils::streamFor('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Static API + +There are various static methods available under the `GuzzleHttp\Psr7` namespace. + + +## `GuzzleHttp\Psr7\Message::toString` + +`public static function toString(MessageInterface $message): string` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\Message::toString($request); +``` + + +## `GuzzleHttp\Psr7\Message::bodySummary` + +`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null` + +Get a short summary of the message body. + +Will return `null` if the response is not printable. + + +## `GuzzleHttp\Psr7\Message::rewindBody` + +`public static function rewindBody(MessageInterface $message): void` + +Attempts to rewind a message body and throws an exception on failure. + +The body of the message will only be rewound if a call to `tell()` +returns a value other than `0`. + + +## `GuzzleHttp\Psr7\Message::parseMessage` + +`public static function parseMessage(string $message): array` + +Parses an HTTP message into an associative array. + +The array contains the "start-line" key containing the start line of +the message, "headers" key containing an associative array of header +array values, and a "body" key containing the body of the message. + + +## `GuzzleHttp\Psr7\Message::parseRequestUri` + +`public static function parseRequestUri(string $path, array $headers): string` + +Constructs a URI for an HTTP request message. + + +## `GuzzleHttp\Psr7\Message::parseRequest` + +`public static function parseRequest(string $message): Request` + +Parses a request message string into a request object. + + +## `GuzzleHttp\Psr7\Message::parseResponse` + +`public static function parseResponse(string $message): Response` + +Parses a response message string into a response object. + + +## `GuzzleHttp\Psr7\Header::parse` + +`public static function parse(string|array $header): array` + +Parse an array of header values containing ";" separated data into an +array of associative arrays representing the header key value pair data +of the header. When a parameter does not contain a value, but just +contains a key, this function will inject a key with a '' string value. + + +## `GuzzleHttp\Psr7\Header::splitList` + +`public static function splitList(string|string[] $header): string[]` + +Splits a HTTP header defined to contain a comma-separated list into +each individual value: + +``` +$knownEtags = Header::splitList($request->getHeader('if-none-match')); +``` + +Example headers include `accept`, `cache-control` and `if-none-match`. + + +## `GuzzleHttp\Psr7\Header::normalize` (deprecated) + +`public static function normalize(string|array $header): array` + +`Header::normalize()` is deprecated in favor of [`Header::splitList()`](README.md#guzzlehttppsr7headersplitlist) +which performs the same operation with a cleaned up API and improved +documentation. + +Converts an array of header values that may contain comma separated +headers into an array of headers with no comma separated values. + + +## `GuzzleHttp\Psr7\Query::parse` + +`public static function parse(string $str, int|bool $urlEncoding = true): array` + +Parse a query string into an associative array. + +If multiple values are found for the same key, the value of that key +value pair will become an array. This function does not parse nested +PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` +will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`. + + +## `GuzzleHttp\Psr7\Query::build` + +`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986, bool $treatBoolsAsInts = true): string` + +Build a query string from an array of key value pairs. + +This function can use the return value of `parse()` to build a query +string. This function does not modify the provided keys when an array is +encountered (like `http_build_query()` would). + + +## `GuzzleHttp\Psr7\Utils::caselessRemove` + +`public static function caselessRemove(iterable $keys, $keys, array $data): array` + +Remove the items given by the keys, case insensitively from the data. + + +## `GuzzleHttp\Psr7\Utils::copyToStream` + +`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void` + +Copy the contents of a stream into another stream until the given number +of bytes have been read. + + +## `GuzzleHttp\Psr7\Utils::copyToString` + +`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string` + +Copy the contents of a stream into a string until the given number of +bytes have been read. + + +## `GuzzleHttp\Psr7\Utils::hash` + +`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string` + +Calculate a hash of a stream. + +This method reads the entire stream to calculate a rolling hash, based on +PHP's `hash_init` functions. + + +## `GuzzleHttp\Psr7\Utils::modifyRequest` + +`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface` + +Clone and modify a request with the given changes. + +This method is useful for reducing the number of clones needed to mutate +a message. + +- method: (string) Changes the HTTP method. +- set_headers: (array) Sets the given headers. +- remove_headers: (array) Remove the given headers. +- body: (mixed) Sets the given body. +- uri: (UriInterface) Set the URI. +- query: (string) Set the query string value of the URI. +- version: (string) Set the protocol version. + + +## `GuzzleHttp\Psr7\Utils::readLine` + +`public static function readLine(StreamInterface $stream, ?int $maxLength = null): string` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `GuzzleHttp\Psr7\Utils::redactUserInfo` + +`public static function redactUserInfo(UriInterface $uri): UriInterface` + +Redact the password in the user info part of a URI. + + +## `GuzzleHttp\Psr7\Utils::streamFor` + +`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface` + +Create a new stream based on the input type. + +Options is an associative array that can contain the following keys: + +- metadata: Array of custom metadata. +- size: Size of the stream. + +This method accepts the following `$resource` types: + +- `Psr\Http\Message\StreamInterface`: Returns the value as-is. +- `string`: Creates a stream object that uses the given string as the contents. +- `resource`: Creates a stream object that wraps the given PHP stream resource. +- `Iterator`: If the provided value implements `Iterator`, then a read-only + stream object will be created that wraps the given iterable. Each time the + stream is read from, data from the iterator will fill a buffer and will be + continuously called until the buffer is equal to the requested read size. + Subsequent read calls will first read from the buffer and then call `next` + on the underlying iterator until it is exhausted. +- `object` with `__toString()`: If the object has the `__toString()` method, + the object will be cast to a string and then a stream will be returned that + uses the string value. +- `NULL`: When `null` is passed, an empty stream object is returned. +- `callable` When a callable is passed, a read-only stream object will be + created that invokes the given callable. The callable is invoked with the + number of suggested bytes to read. The callable can return any number of + bytes, but MUST return `false` when there is no more data to return. The + stream object that wraps the callable will invoke the callable until the + number of requested bytes are available. Any additional bytes will be + buffered and used in subsequent reads. + +```php +$stream = GuzzleHttp\Psr7\Utils::streamFor('foo'); +$stream = GuzzleHttp\Psr7\Utils::streamFor(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\Utils::streamFor($generator(100)); +``` + + +## `GuzzleHttp\Psr7\Utils::tryFopen` + +`public static function tryFopen(string $filename, string $mode): resource` + +Safely opens a PHP stream resource using a filename. + +When fopen fails, PHP normally raises a warning. This function adds an +error handler that checks for errors and throws an exception instead. + + +## `GuzzleHttp\Psr7\Utils::tryGetContents` + +`public static function tryGetContents(resource $stream): string` + +Safely gets the contents of a given stream. + +When stream_get_contents fails, PHP normally raises a warning. This +function adds an error handler that checks for errors and throws an +exception instead. + + +## `GuzzleHttp\Psr7\Utils::uriFor` + +`public static function uriFor(string|UriInterface $uri): UriInterface` + +Returns a UriInterface for the given value. + +This function accepts a string or UriInterface and returns a +UriInterface for the given value. If the value is already a +UriInterface, it is returned as-is. + + +## `GuzzleHttp\Psr7\MimeType::fromFilename` + +`public static function fromFilename(string $filename): string|null` + +Determines the mimetype of a file by looking at its extension. + + +## `GuzzleHttp\Psr7\MimeType::fromExtension` + +`public static function fromExtension(string $extension): string|null` + +Maps a file extensions to a mimetype. + + +## Upgrading from Function API + +The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API was removed in 2.0.0. A migration table has been provided here for your convenience: + +| Original Function | Replacement Method | +|----------------|----------------| +| `str` | `Message::toString` | +| `uri_for` | `Utils::uriFor` | +| `stream_for` | `Utils::streamFor` | +| `parse_header` | `Header::parse` | +| `normalize_header` | `Header::normalize` | +| `modify_request` | `Utils::modifyRequest` | +| `rewind_body` | `Message::rewindBody` | +| `try_fopen` | `Utils::tryFopen` | +| `copy_to_string` | `Utils::copyToString` | +| `copy_to_stream` | `Utils::copyToStream` | +| `hash` | `Utils::hash` | +| `readline` | `Utils::readLine` | +| `parse_request` | `Message::parseRequest` | +| `parse_response` | `Message::parseResponse` | +| `parse_query` | `Query::parse` | +| `build_query` | `Query::build` | +| `mimetype_from_filename` | `MimeType::fromFilename` | +| `mimetype_from_extension` | `MimeType::fromExtension` | +| `_parse_message` | `Message::parseMessage` | +| `_parse_request_uri` | `Message::parseRequestUri` | +| `get_message_body_summary` | `Message::bodySummary` | +| `_caseless_remove` | `Utils::caselessRemove` | + + +# Additional URI Methods + +Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, +this library also provides additional functionality when working with URIs as static methods. + +## URI Types + +An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. +An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, +the base URI. Relative references can be divided into several forms according to +[RFC 3986 Section 4.2](https://datatracker.ietf.org/doc/html/rfc3986#section-4.2): + +- network-path references, e.g. `//example.com/path` +- absolute-path references, e.g. `/path` +- relative-path references, e.g. `subpath` + +The following methods can be used to identify the type of the URI. + +### `GuzzleHttp\Psr7\Uri::isAbsolute` + +`public static function isAbsolute(UriInterface $uri): bool` + +Whether the URI is absolute, i.e. it has a scheme. + +### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` + +`public static function isNetworkPathReference(UriInterface $uri): bool` + +Whether the URI is a network-path reference. A relative reference that begins with two slash characters is +termed an network-path reference. + +### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` + +`public static function isAbsolutePathReference(UriInterface $uri): bool` + +Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is +termed an absolute-path reference. + +### `GuzzleHttp\Psr7\Uri::isRelativePathReference` + +`public static function isRelativePathReference(UriInterface $uri): bool` + +Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is +termed a relative-path reference. + +### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` + +`public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null): bool` + +Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its +fragment component, identical to the base URI. When no base URI is given, only an empty URI reference +(apart from its fragment) is considered a same-document reference. + +## URI Components + +Additional methods to work with URI components. + +### `GuzzleHttp\Psr7\Uri::isDefaultPort` + +`public static function isDefaultPort(UriInterface $uri): bool` + +Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null +or the standard port. This method can be used independently of the implementation. + +### `GuzzleHttp\Psr7\Uri::composeComponents` + +`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` + +Composes a URI reference string from its various components according to +[RFC 3986 Section 5.3](https://datatracker.ietf.org/doc/html/rfc3986#section-5.3). Usually this method does not need +to be called manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. + +### `GuzzleHttp\Psr7\Uri::fromParts` + +`public static function fromParts(array $parts): UriInterface` + +Creates a URI from a hash of [`parse_url`](https://www.php.net/manual/en/function.parse-url.php) components. + + +### `GuzzleHttp\Psr7\Uri::withQueryValue` + +`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` + +Creates a new URI with a specific query string value. Any existing query string values that exactly match the +provided key are removed and replaced with the given key value pair. A value of null will set the query string +key without a value, e.g. "key" instead of "key=value". + +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. + +### `GuzzleHttp\Psr7\Uri::withoutQueryValue` + +`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` + +Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the +provided key are removed. + +## Cross-Origin Detection + +`GuzzleHttp\Psr7\UriComparator` provides methods to determine if a modified URL should be considered cross-origin. + +### `GuzzleHttp\Psr7\UriComparator::isCrossOrigin` + +`public static function isCrossOrigin(UriInterface $original, UriInterface $modified): bool` + +Determines if a modified URL should be considered cross-origin with respect to an original URL. + +## Reference Resolution + +`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according +to [RFC 3986 Section 5](https://datatracker.ietf.org/doc/html/rfc3986#section-5). This is for example also what web +browsers do when resolving a link in a website based on the current request URI. + +### `GuzzleHttp\Psr7\UriResolver::resolve` + +`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` + +Converts the relative URI into a new URI that is resolved against the base URI. + +### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` + +`public static function removeDotSegments(string $path): string` + +Removes dot segments from a path and returns the new path according to +[RFC 3986 Section 5.2.4](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4). + +### `GuzzleHttp\Psr7\UriResolver::relativize` + +`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` + +Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): + +```php +(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) +``` + +One use-case is to use the current request URI as base URI and then generate relative links in your documents +to reduce the document size or offer self-contained downloadable document archives. + +```php +$base = new Uri('http://example.com/a/b/'); +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. +echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. +``` + +## Normalization and Comparison + +`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to +[RFC 3986 Section 6](https://datatracker.ietf.org/doc/html/rfc3986#section-6). + +### `GuzzleHttp\Psr7\UriNormalizer::normalize` + +`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` + +Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. +This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask +of normalizations to apply. The following normalizations are available: + +- `UriNormalizer::PRESERVING_NORMALIZATIONS` + + Default normalizations which only include the ones that preserve semantics. + +- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` + + All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. + + Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` + +- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` + + Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of + ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should + not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved + characters by URI normalizers. + + Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` + +- `UriNormalizer::CONVERT_EMPTY_PATH` + + Converts the empty path to "/" for http and https URIs. + + Example: `http://example.org` → `http://example.org/` + +- `UriNormalizer::REMOVE_DEFAULT_HOST` + + Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host + "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to + RFC 3986. + + Example: `file://localhost/myfile` → `file:///myfile` + +- `UriNormalizer::REMOVE_DEFAULT_PORT` + + Removes the default port of the given URI scheme from the URI. + + Example: `http://example.org:80/` → `http://example.org/` + +- `UriNormalizer::REMOVE_DOT_SEGMENTS` + + Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would + change the semantics of the URI reference. + + Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` + +- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` + + Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes + and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization + may change the semantics. Encoded slashes (%2F) are not removed. + + Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` + +- `UriNormalizer::SORT_QUERY_PARAMETERS` + + Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be + significant (this is not defined by the standard). So this normalization is not safe and may change the semantics + of the URI. + + Example: `?lang=en&article=fred` → `?article=fred&lang=en` + +### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` + +`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` + +Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given +`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. +This of course assumes they will be resolved against the same base URI. If this is not the case, determination of +equivalence or difference of relative references does not mean anything. + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information. + + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/composer.json new file mode 100644 index 0000000000..28d15f5714 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/composer.json @@ -0,0 +1,93 @@ +{ + "name": "guzzlehttp/psr7", + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "request", + "response", + "message", + "stream", + "http", + "uri", + "url", + "psr-7" + ], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan-baseline.neon b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan-baseline.neon new file mode 100644 index 0000000000..d2dcc75cff --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan-baseline.neon @@ -0,0 +1,246 @@ +parameters: + ignoreErrors: + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/AppendStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/CachingStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/DroppingStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn___toString\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_close\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_detach\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_eof\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_getContents\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_getMetadata\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_getSize\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_isReadable\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_isSeekable\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_isWritable\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_read\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_rewind\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_seek\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_tell\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Access to an undefined property GuzzleHttp\\\\Psr7\\\\FnStream\\:\\:\\$_fn_write\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/FnStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/InflateStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/LazyOpenStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/LimitStream.php + + - + message: "#^Parameter \\#1 \\$haystack of function substr_count expects string, string\\|null given\\.$#" + count: 1 + path: src/Message.php + + - + message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|null given\\.$#" + count: 1 + path: src/Message.php + + - + message: "#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|null given\\.$#" + count: 1 + path: src/Message.php + + - + message: "#^Variable \\$headerLines in PHPDoc tag @var does not match assigned variable \\$count\\.$#" + count: 1 + path: src/Message.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/MultipartStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/NoSeekStream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/PumpStream.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\ServerRequest\\:\\:normalizeNestedFileSpec\\(\\) should return array\\ but returns array\\\\|Psr\\\\Http\\\\Message\\\\UploadedFileInterface\\>\\.$#" + count: 1 + path: src/ServerRequest.php + + - + message: "#^Offset 'size' on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: int, 4\\: int, 5\\: int, 6\\: int, 7\\: int, \\.\\.\\.\\} in isset\\(\\) always exists and is not nullable\\.$#" + count: 1 + path: src/Stream.php + + - + message: "#^Property GuzzleHttp\\\\Psr7\\\\Stream\\:\\:\\$stream \\(resource\\) in isset\\(\\) is not nullable\\.$#" + count: 10 + path: src/Stream.php + + - + message: "#^Property GuzzleHttp\\\\Psr7\\\\Stream\\:\\:\\$uri \\(string\\|null\\) does not accept mixed\\.$#" + count: 1 + path: src/Stream.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/Stream.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\StreamWrapper\\:\\:getResource\\(\\) should return resource but returns resource\\|false\\.$#" + count: 1 + path: src/StreamWrapper.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\UploadedFile\\:\\:isStringNotEmpty\\(\\) has parameter \\$param with no type specified\\.$#" + count: 1 + path: src/UploadedFile.php + + - + message: "#^Cannot cast mixed to int\\.$#" + count: 1 + path: src/Uri.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\Uri\\:\\:filterPath\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/Uri.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\Uri\\:\\:filterQueryAndFragment\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/Uri.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\Uri\\:\\:filterUserInfoComponent\\(\\) should return string but returns string\\|null\\.$#" + count: 1 + path: src/Uri.php + + - + message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(int\\<0, 65535\\>\\|string\\)\\: mixed\\)\\|null, 'urldecode' given\\.$#" + count: 1 + path: src/Uri.php + + - + message: "#^Parameter \\#1 \\$path of method Psr\\\\Http\\\\Message\\\\UriInterface\\:\\:withPath\\(\\) expects string, string\\|null given\\.$#" + count: 3 + path: src/UriNormalizer.php + + - + message: "#^Parameter \\#1 \\$query of method Psr\\\\Http\\\\Message\\\\UriInterface\\:\\:withQuery\\(\\) expects string, string\\|null given\\.$#" + count: 2 + path: src/UriNormalizer.php + + - + message: "#^Strict comparison using \\=\\=\\= between '' and non\\-falsy\\-string will always evaluate to false\\.$#" + count: 1 + path: src/UriResolver.php + + - + message: "#^Method GuzzleHttp\\\\Psr7\\\\Utils\\:\\:tryGetContents\\(\\) should return string but returns string\\|false\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Parameter \\#1 \\$source of class GuzzleHttp\\\\Psr7\\\\PumpStream constructor expects callable\\(int\\)\\: \\(string\\|false\\|null\\), Closure\\(\\)\\: mixed given\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Variable \\$contents might not be defined\\.$#" + count: 1 + path: src/Utils.php + + - + message: "#^Variable \\$handle might not be defined\\.$#" + count: 1 + path: src/Utils.php diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan.neon.dist b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan.neon.dist new file mode 100644 index 0000000000..00a0c1b709 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpstan.neon.dist @@ -0,0 +1,11 @@ +includes: + - phpstan-baseline.neon + - vendor-bin/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon + +parameters: + ignoreErrors: + - + identifier: missingType.iterableValue + level: max + paths: + - src diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpunit.xml.dist b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpunit.xml.dist new file mode 100644 index 0000000000..5135b9b578 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/phpunit.xml.dist @@ -0,0 +1,35 @@ + + + + + tests + tests/Integration + + + tests/Integration + + + ./vendor/http-interop/http-factory-tests/test + + + + + src + + + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm-baseline.xml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm-baseline.xml new file mode 100644 index 0000000000..b0fc135766 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm-baseline.xml @@ -0,0 +1,137 @@ + + + + + _fn___toString)()]]> + _fn_close)()]]> + _fn_detach)()]]> + _fn_eof)()]]> + _fn_getContents)()]]> + _fn_getMetadata)($key)]]> + _fn_getSize)()]]> + _fn_isReadable)()]]> + _fn_isSeekable)()]]> + _fn_isWritable)()]]> + _fn_read)($length)]]> + _fn_rewind)()]]> + _fn_seek)($offset, $whence)]]> + _fn_tell)()]]> + _fn_write)($string)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stream]]> + + + + + + stream)]]> + stream)]]> + stream)]]> + stream)]]> + stream)]]> + stream)]]> + stream)]]> + stream)]]> + stream)]]> + stream)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm.xml b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm.xml new file mode 100644 index 0000000000..86d8671da8 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/AppendStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 0000000000..ee8f37882f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,248 @@ +addStream($stream); + } + } + + public function __toString(): string + { + try { + $this->rewind(); + + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream): void + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents(): string + { + return Utils::copyToString($this); + } + + /** + * Closes each attached stream. + */ + public function close(): void + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + + return null; + } + + public function tell(): int + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + */ + public function getSize(): ?int + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof(): bool + { + return !$this->streams + || ($this->current >= count($this->streams) - 1 + && $this->streams[$this->current]->eof()); + } + + public function rewind(): void + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + */ + public function seek($offset, $whence = SEEK_SET): void + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' + .$i.' of the AppendStream', 0, $e); + } + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + */ + public function read($length): string + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = false; + + while ($remaining > 0) { + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = false; + if ($this->current === $total) { + break; + } + ++$this->current; + } + + $result = $this->streams[$this->current]->read($remaining); + + if ($result === '') { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable(): bool + { + return true; + } + + public function isWritable(): bool + { + return false; + } + + public function isSeekable(): bool + { + return $this->seekable; + } + + public function write($string): int + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + /** + * @return mixed + */ + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/BufferStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 0000000000..2b0eb77be0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,147 @@ +hwm = $hwm; + } + + public function __toString(): string + { + return $this->getContents(); + } + + public function getContents(): string + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close(): void + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + + return null; + } + + public function getSize(): ?int + { + return strlen($this->buffer); + } + + public function isReadable(): bool + { + return true; + } + + public function isWritable(): bool + { + return true; + } + + public function isSeekable(): bool + { + return false; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof(): bool + { + return strlen($this->buffer) === 0; + } + + public function tell(): int + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length): string + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string): int + { + $this->buffer .= $string; + + if (strlen($this->buffer) >= $this->hwm) { + return 0; + } + + return strlen($string); + } + + /** + * @return mixed + */ + public function getMetadata($key = null) + { + if ($key === 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/CachingStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 0000000000..7e4554d5c7 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,153 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+')); + } + + public function getSize(): ?int + { + $remoteSize = $this->remoteStream->getSize(); + + if (null === $remoteSize) { + return null; + } + + return max($this->stream->getSize(), $remoteSize); + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + if ($whence === SEEK_SET) { + $byte = $offset; + } elseif ($whence === SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence === SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + + $diff = $byte - $this->stream->getSize(); + + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + + public function read($length): string + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string): int + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof(): bool + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close(): void + { + $this->remoteStream->close(); + $this->stream->close(); + } + + private function cacheEntireStream(): int + { + $target = new FnStream(['write' => 'strlen']); + Utils::copyToStream($this, $target); + + return $this->tell(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/DroppingStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000000..6e3d209d0e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,49 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string): int + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Exception/MalformedUriException.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Exception/MalformedUriException.php new file mode 100644 index 0000000000..3a084779a8 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Exception/MalformedUriException.php @@ -0,0 +1,14 @@ + */ + private $methods; + + /** + * @param array $methods Hash of method name to a callable. + */ + public function __construct(array $methods) + { + $this->methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_'.$name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * + * @throws \BadMethodCallException + */ + public function __get(string $name): void + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + .'() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + ($this->_fn_close)(); + } + } + + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * + * @throws \LogicException + */ + public function __wakeup(): void + { + throw new \LogicException('FnStream should never be unserialized'); + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::SLOTS, array_keys($methods)) as $diff) { + /** @var callable $callable */ + $callable = [$stream, $diff]; + $methods[$diff] = $callable; + } + + return new self($methods); + } + + public function __toString(): string + { + try { + /** @var string */ + return ($this->_fn___toString)(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + + return ''; + } + } + + public function close(): void + { + ($this->_fn_close)(); + } + + public function detach() + { + return ($this->_fn_detach)(); + } + + public function getSize(): ?int + { + return ($this->_fn_getSize)(); + } + + public function tell(): int + { + return ($this->_fn_tell)(); + } + + public function eof(): bool + { + return ($this->_fn_eof)(); + } + + public function isSeekable(): bool + { + return ($this->_fn_isSeekable)(); + } + + public function rewind(): void + { + ($this->_fn_rewind)(); + } + + public function seek($offset, $whence = SEEK_SET): void + { + ($this->_fn_seek)($offset, $whence); + } + + public function isWritable(): bool + { + return ($this->_fn_isWritable)(); + } + + public function write($string): int + { + return ($this->_fn_write)($string); + } + + public function isReadable(): bool + { + return ($this->_fn_isReadable)(); + } + + public function read($length): string + { + return ($this->_fn_read)($length); + } + + public function getContents(): string + { + return ($this->_fn_getContents)(); + } + + /** + * @return mixed + */ + public function getMetadata($key = null) + { + return ($this->_fn_getMetadata)($key); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Header.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Header.php new file mode 100644 index 0000000000..bbce8b03d2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Header.php @@ -0,0 +1,134 @@ +]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + } + + return $params; + } + + /** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @deprecated Use self::splitList() instead. + */ + public static function normalize($header): array + { + $result = []; + foreach ((array) $header as $value) { + foreach (self::splitList($value) as $parsed) { + $result[] = $parsed; + } + } + + return $result; + } + + /** + * Splits a HTTP header defined to contain a comma-separated list into + * each individual value. Empty values will be removed. + * + * Example headers include 'accept', 'cache-control' and 'if-none-match'. + * + * This method must not be used to parse headers that are not defined as + * a list, such as 'user-agent' or 'set-cookie'. + * + * @param string|string[] $values Header value as returned by MessageInterface::getHeader() + * + * @return string[] + */ + public static function splitList($values): array + { + if (!\is_array($values)) { + $values = [$values]; + } + + $result = []; + foreach ($values as $value) { + if (!\is_string($value)) { + throw new \TypeError('$header must either be a string or an array containing strings.'); + } + + $v = ''; + $isQuoted = false; + $isEscaped = false; + for ($i = 0, $max = \strlen($value); $i < $max; ++$i) { + if ($isEscaped) { + $v .= $value[$i]; + $isEscaped = false; + + continue; + } + + if (!$isQuoted && $value[$i] === ',') { + $v = \trim($v); + if ($v !== '') { + $result[] = $v; + } + + $v = ''; + continue; + } + + if ($isQuoted && $value[$i] === '\\') { + $isEscaped = true; + $v .= $value[$i]; + + continue; + } + if ($value[$i] === '"') { + $isQuoted = !$isQuoted; + $v .= $value[$i]; + + continue; + } + + $v .= $value[$i]; + } + + $v = \trim($v); + if ($v !== '') { + $result[] = $v; + } + } + + return $result; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/HttpFactory.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/HttpFactory.php new file mode 100644 index 0000000000..3ef15103a7 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/HttpFactory.php @@ -0,0 +1,94 @@ +getSize(); + } + + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } + + public function createStream(string $content = ''): StreamInterface + { + return Utils::streamFor($content); + } + + public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface + { + try { + $resource = Utils::tryFopen($file, $mode); + } catch (\RuntimeException $e) { + if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) { + throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e); + } + + throw $e; + } + + return Utils::streamFor($resource); + } + + public function createStreamFromResource($resource): StreamInterface + { + return Utils::streamFor($resource); + } + + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface + { + if (empty($method)) { + if (!empty($serverParams['REQUEST_METHOD'])) { + $method = $serverParams['REQUEST_METHOD']; + } else { + throw new \InvalidArgumentException('Cannot determine HTTP method'); + } + } + + return new ServerRequest($method, $uri, [], null, '1.1', $serverParams); + } + + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + return new Response($code, [], null, '1.1', $reasonPhrase); + } + + public function createRequest(string $method, $uri): RequestInterface + { + return new Request($method, $uri); + } + + public function createUri(string $uri = ''): UriInterface + { + return new Uri($uri); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/InflateStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 0000000000..e674c9ab66 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,37 @@ + 15 + 32]); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LazyOpenStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 0000000000..f6c84904ed --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,49 @@ +filename = $filename; + $this->mode = $mode; + + // unsetting the property forces the first access to go through + // __get(). + unset($this->stream); + } + + /** + * Creates the underlying stream lazily when required. + */ + protected function createStream(): StreamInterface + { + return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LimitStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 0000000000..fb2232557b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,157 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof(): bool + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit === -1) { + return false; + } + + return $this->stream->tell() >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + */ + public function getSize(): ?int + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit === -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + */ + public function seek($offset, $whence = SEEK_SET): void + { + if ($whence !== SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf( + 'Cannot seek to offset %s with whence %s', + $offset, + $whence + )); + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + $this->stream->seek($offset); + } + + /** + * Give a relative tell() + */ + public function tell(): int + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset(int $offset): void + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset $offset"); + } else { + $this->stream->read($offset - $current); + } + } + + $this->offset = $offset; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit(int $limit): void + { + $this->limit = $limit; + } + + public function read($length): string + { + if ($this->limit === -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + + return ''; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Message.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Message.php new file mode 100644 index 0000000000..5561a5130d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Message.php @@ -0,0 +1,246 @@ +getMethod().' ' + .$message->getRequestTarget()) + .' HTTP/'.$message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: ".$message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/'.$message->getProtocolVersion().' ' + .$message->getStatusCode().' ' + .$message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + + foreach ($message->getHeaders() as $name => $values) { + if (is_string($name) && strtolower($name) === 'set-cookie') { + foreach ($values as $value) { + $msg .= "\r\n{$name}: ".$value; + } + } else { + $msg .= "\r\n{$name}: ".implode(', ', $values); + } + } + + return "{$msg}\r\n\r\n".$message->getBody(); + } + + /** + * Get a short summary of the message body. + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + */ + public static function bodySummary(MessageInterface $message, int $truncateAt = 120): ?string + { + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $body->rewind(); + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary) !== 0) { + return null; + } + + return $summary; + } + + /** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` + * returns a value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ + public static function rewindBody(MessageInterface $message): void + { + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } + } + + /** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + */ + public static function parseMessage(string $message): array + { + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + + $message = ltrim($message, "\r\n"); + + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + [$rawHeaders, $body] = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + [$startLine, $rawHeaders] = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + + throw new \InvalidArgumentException('Invalid header syntax'); + } + + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; + } + + /** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + */ + public static function parseRequestUri(string $path, array $headers): string + { + $hostKey = array_filter(array_keys($headers), function ($k) { + // Numeric array keys are converted to int by PHP. + $k = (string) $k; + + return strtolower($k) === 'host'; + }); + + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + + return $scheme.'://'.$host.'/'.ltrim($path, '/'); + } + + /** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + */ + public static function parseRequest(string $message): RequestInterface + { + $data = self::parseMessage($message); + $matches = []; + if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + + $request = new Request( + $parts[0], + $matches[1] === '/' ? self::parseRequestUri($parts[1], $data['headers']) : $parts[1], + $data['headers'], + $data['body'], + $version + ); + + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); + } + + /** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + */ + public static function parseResponse(string $message): ResponseInterface + { + $data = self::parseMessage($message); + // According to https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2 + // the space between status-code and reason-phrase is required. But + // browsers accept responses without space and reason as well. + if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: '.$data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + + return new Response( + (int) $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + $parts[2] ?? null + ); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MessageTrait.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 0000000000..65dbc4ba0a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,265 @@ + array of values */ + private $headers = []; + + /** @var string[] Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface|null */ + private $stream; + + public function getProtocolVersion(): string + { + return $this->protocol; + } + + public function withProtocolVersion($version): MessageInterface + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + + return $new; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function hasHeader($header): bool + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header): array + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header): string + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value): MessageInterface + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value): MessageInterface + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header): MessageInterface + { + $normalized = strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody(): StreamInterface + { + if (!$this->stream) { + $this->stream = Utils::streamFor(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body): MessageInterface + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + + return $new; + } + + /** + * @param (string|string[])[] $headers + */ + private function setHeaders(array $headers): void + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + // Numeric array keys are converted to int by PHP. + $header = (string) $header; + + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + /** + * @param mixed $value + * + * @return string[] + */ + private function normalizeHeaderValue($value): array + { + if (!is_array($value)) { + return $this->trimAndValidateHeaderValues([$value]); + } + + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + + return $this->trimAndValidateHeaderValues($value); + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param mixed[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4 + */ + private function trimAndValidateHeaderValues(array $values): array + { + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf( + 'Header value must be scalar or null but %s provided.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + $trimmed = trim((string) $value, " \t"); + $this->assertValue($trimmed); + + return $trimmed; + }, array_values($values)); + } + + /** + * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 + * + * @param mixed $header + */ + private function assertHeader($header): void + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf( + 'Header name must be a string but %s provided.', + is_object($header) ? get_class($header) : gettype($header) + )); + } + + if (!preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { + throw new \InvalidArgumentException( + sprintf('"%s" is not valid header name.', $header) + ); + } + } + + /** + * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 + * + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * VCHAR = %x21-7E + * obs-text = %x80-FF + * obs-fold = CRLF 1*( SP / HTAB ) + */ + private function assertValue(string $value): void + { + // The regular expression intentionally does not support the obs-fold production, because as + // per RFC 7230#3.2.4: + // + // A sender MUST NOT generate a message that includes + // line folding (i.e., that has any field-value that contains a match to + // the obs-fold rule) unless the message is intended for packaging + // within the message/http media type. + // + // Clients must not send a request with line folding and a server sending folded headers is + // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting + // folding is not likely to break any legitimate use case. + if (!preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { + throw new \InvalidArgumentException( + sprintf('"%s" is not valid header value.', $value) + ); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MimeType.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MimeType.php new file mode 100644 index 0000000000..b131bdbe7a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MimeType.php @@ -0,0 +1,1259 @@ + 'application/vnd.1000minds.decision-model+xml', + '3dml' => 'text/vnd.in3d.3dml', + '3ds' => 'image/x-3ds', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + '3gpp' => 'video/3gpp', + '3mf' => 'model/3mf', + '7z' => 'application/x-7z-compressed', + '7zip' => 'application/x-7z-compressed', + '123' => 'application/vnd.lotus-1-2-3', + 'aab' => 'application/x-authorware-bin', + 'aac' => 'audio/aac', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abw' => 'application/x-abiword', + 'ac' => 'application/vnd.nokia.n-gage.ac+xml', + 'ac3' => 'audio/ac3', + 'acc' => 'application/vnd.americandynamics.acc', + 'ace' => 'application/x-ace-compressed', + 'acu' => 'application/vnd.acucobol', + 'acutc' => 'application/vnd.acucorp', + 'adp' => 'audio/adpcm', + 'adts' => 'audio/aac', + 'aep' => 'application/vnd.audiograph', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'age' => 'application/vnd.age', + 'ahead' => 'application/vnd.ahead.space', + 'ai' => 'application/pdf', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'ait' => 'application/vnd.dvb.ait', + 'ami' => 'application/vnd.amiga.ami', + 'aml' => 'application/automationml-aml+xml', + 'amlx' => 'application/automationml-amlx+zip', + 'amr' => 'audio/amr', + 'apk' => 'application/vnd.android.package-archive', + 'apng' => 'image/apng', + 'appcache' => 'text/cache-manifest', + 'appinstaller' => 'application/appinstaller', + 'application' => 'application/x-ms-application', + 'appx' => 'application/appx', + 'appxbundle' => 'application/appxbundle', + 'apr' => 'application/vnd.lotus-approach', + 'arc' => 'application/x-freearc', + 'arj' => 'application/x-arj', + 'asc' => 'application/pgp-signature', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'aso' => 'application/vnd.accpac.simply.aso', + 'asx' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomdeleted' => 'application/atomdeleted+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'atx' => 'application/vnd.antix.game-component', + 'au' => 'audio/x-au', + 'avci' => 'image/avci', + 'avcs' => 'image/avcs', + 'avi' => 'video/x-msvideo', + 'avif' => 'image/avif', + 'aw' => 'application/applixware', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azv' => 'image/vnd.airzip.accelerator.azv', + 'azw' => 'application/vnd.amazon.ebook', + 'b16' => 'image/vnd.pco.b16', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bdf' => 'application/x-font-bdf', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'bdoc' => 'application/x-bdoc', + 'bed' => 'application/vnd.realvnc.bed', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'bin' => 'application/octet-stream', + 'blb' => 'application/x-blorb', + 'blorb' => 'application/x-blorb', + 'bmi' => 'application/vnd.bmi', + 'bmml' => 'application/vnd.balsamiq.bmml+xml', + 'bmp' => 'image/bmp', + 'book' => 'application/vnd.framemaker', + 'box' => 'application/vnd.previewsystems.box', + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'bsp' => 'model/vnd.valve.source.compiled-map', + 'btf' => 'image/prs.btif', + 'btif' => 'image/prs.btif', + 'buffer' => 'application/octet-stream', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'cab' => 'application/vnd.ms-cab-compressed', + 'caf' => 'audio/x-caf', + 'cap' => 'application/vnd.tcpdump.pcap', + 'car' => 'application/vnd.curl.car', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'cco' => 'application/x-cocoa', + 'cct' => 'application/x-director', + 'ccxml' => 'application/ccxml+xml', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cdf' => 'application/x-netcdf', + 'cdfx' => 'application/cdfx+xml', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cdr' => 'application/cdr', + 'cdx' => 'chemical/x-cdx', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'cdy' => 'application/vnd.cinderella', + 'cer' => 'application/pkix-cert', + 'cfs' => 'application/x-cfs-compressed', + 'cgm' => 'image/cgm', + 'chat' => 'application/x-chat', + 'chm' => 'application/vnd.ms-htmlhelp', + 'chrt' => 'application/vnd.kde.kchart', + 'cif' => 'chemical/x-cif', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'cil' => 'application/vnd.ms-artgalry', + 'cjs' => 'application/node', + 'cla' => 'application/vnd.claymore', + 'class' => 'application/octet-stream', + 'cld' => 'model/vnd.cld', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'clkx' => 'application/vnd.crick.clicker', + 'clp' => 'application/x-msclip', + 'cmc' => 'application/vnd.cosmocaller', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'cmx' => 'image/x-cmx', + 'cod' => 'application/vnd.rim.cod', + 'coffee' => 'text/coffeescript', + 'com' => 'application/x-msdownload', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpl' => 'application/cpl+xml', + 'cpp' => 'text/x-c', + 'cpt' => 'application/mac-compactpro', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'crx' => 'application/x-chrome-extension', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'csh' => 'application/x-csh', + 'csl' => 'application/vnd.citationstyles.style+xml', + 'csml' => 'chemical/x-csml', + 'csp' => 'application/vnd.commonspace', + 'csr' => 'application/octet-stream', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'curl' => 'text/vnd.curl', + 'cwl' => 'application/cwl', + 'cww' => 'application/prs.cww', + 'cxt' => 'application/x-director', + 'cxx' => 'text/x-c', + 'dae' => 'model/vnd.collada+xml', + 'daf' => 'application/vnd.mobius.daf', + 'dart' => 'application/vnd.dart', + 'dataless' => 'application/vnd.fdsn.seed', + 'davmount' => 'application/davmount+xml', + 'dbf' => 'application/vnd.dbf', + 'dbk' => 'application/docbook+xml', + 'dcr' => 'application/x-director', + 'dcurl' => 'text/vnd.curl.dcurl', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'ddf' => 'application/vnd.syncml.dmddf+xml', + 'dds' => 'image/vnd.ms-dds', + 'deb' => 'application/x-debian-package', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dfac' => 'application/vnd.dreamfactory', + 'dgc' => 'application/x-dgc-compressed', + 'dib' => 'image/bmp', + 'dic' => 'text/x-c', + 'dir' => 'application/x-director', + 'dis' => 'application/vnd.mobius.dis', + 'disposition-notification' => 'message/disposition-notification', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/octet-stream', + 'dmg' => 'application/x-apple-diskimage', + 'dmn' => 'application/octet-stream', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'dna' => 'application/vnd.dna', + 'doc' => 'application/msword', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dp' => 'application/vnd.osgi.dp', + 'dpg' => 'application/vnd.dpgraph', + 'dpx' => 'image/dpx', + 'dra' => 'audio/vnd.dra', + 'drle' => 'image/dicom-rle', + 'dsc' => 'text/prs.lines.tag', + 'dssc' => 'application/dssc+der', + 'dtb' => 'application/x-dtbook+xml', + 'dtd' => 'application/xml-dtd', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'dump' => 'application/octet-stream', + 'dvb' => 'video/vnd.dvb.file', + 'dvi' => 'application/x-dvi', + 'dwd' => 'application/atsc-dwd+xml', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'dxp' => 'application/vnd.spotfire.dxp', + 'dxr' => 'application/x-director', + 'ear' => 'application/java-archive', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'ecma' => 'application/ecmascript', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'efif' => 'application/vnd.picsel', + 'ei6' => 'application/vnd.pg.osasli', + 'elc' => 'application/octet-stream', + 'emf' => 'image/emf', + 'eml' => 'message/rfc822', + 'emma' => 'application/emma+xml', + 'emotionml' => 'application/emotionml+xml', + 'emz' => 'application/x-msmetafile', + 'eol' => 'audio/vnd.digital-winds', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'es3' => 'application/vnd.eszigno3+xml', + 'esa' => 'application/vnd.osgi.subsystem', + 'esf' => 'application/vnd.epson.esf', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'eva' => 'application/x-eva', + 'evy' => 'application/x-envoy', + 'exe' => 'application/octet-stream', + 'exi' => 'application/exi', + 'exp' => 'application/express', + 'exr' => 'image/aces', + 'ext' => 'application/vnd.novadigm.ext', + 'ez' => 'application/andrew-inset', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'f' => 'text/x-fortran', + 'f4v' => 'video/mp4', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fbs' => 'image/vnd.fastbidsheet', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fcs' => 'application/vnd.isac.fcs', + 'fdf' => 'application/vnd.fdf', + 'fdt' => 'application/fdt+xml', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fig' => 'application/x-xfig', + 'fits' => 'image/fits', + 'flac' => 'audio/x-flac', + 'fli' => 'video/x-fli', + 'flo' => 'application/vnd.micrografx.flo', + 'flv' => 'video/x-flv', + 'flw' => 'application/vnd.kde.kivio', + 'flx' => 'text/vnd.fmi.flexstor', + 'fly' => 'text/vnd.fly', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'fo' => 'application/vnd.software602.filler.form+xml', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frame' => 'application/vnd.framemaker', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'fst' => 'image/vnd.fst', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'fvt' => 'video/vnd.fvt', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'fzs' => 'application/vnd.fuzzysheet', + 'g2w' => 'application/vnd.geoplan', + 'g3' => 'image/g3fax', + 'g3w' => 'application/vnd.geospace', + 'gac' => 'application/vnd.groove-account', + 'gam' => 'application/x-tads', + 'gbr' => 'application/rpki-ghostbusters', + 'gca' => 'application/x-gca-compressed', + 'gdl' => 'model/vnd.gdl', + 'gdoc' => 'application/vnd.google-apps.document', + 'ged' => 'text/vnd.familysearch.gedcom', + 'geo' => 'application/vnd.dynageo', + 'geojson' => 'application/geo+json', + 'gex' => 'application/vnd.geometry-explorer', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'ghf' => 'application/vnd.groove-help', + 'gif' => 'image/gif', + 'gim' => 'application/vnd.groove-identity-message', + 'glb' => 'model/gltf-binary', + 'gltf' => 'model/gltf+json', + 'gml' => 'application/gml+xml', + 'gmx' => 'application/vnd.gmx', + 'gnumeric' => 'application/x-gnumeric', + 'gpg' => 'application/gpg-keys', + 'gph' => 'application/vnd.flographit', + 'gpx' => 'application/gpx+xml', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gram' => 'application/srgs', + 'gramps' => 'application/x-gramps-xml', + 'gre' => 'application/vnd.geometry-explorer', + 'grv' => 'application/vnd.groove-injector', + 'grxml' => 'application/srgs+xml', + 'gsf' => 'application/x-font-ghostscript', + 'gsheet' => 'application/vnd.google-apps.spreadsheet', + 'gslides' => 'application/vnd.google-apps.presentation', + 'gtar' => 'application/x-gtar', + 'gtm' => 'application/vnd.groove-tool-message', + 'gtw' => 'model/vnd.gtw', + 'gv' => 'text/vnd.graphviz', + 'gxf' => 'application/gxf', + 'gxt' => 'application/vnd.geonext', + 'gz' => 'application/gzip', + 'gzip' => 'application/gzip', + 'h' => 'text/x-c', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'hal' => 'application/vnd.hal+xml', + 'hbci' => 'application/vnd.hbci', + 'hbs' => 'text/x-handlebars-template', + 'hdd' => 'application/x-virtualbox-hdd', + 'hdf' => 'application/x-hdf', + 'heic' => 'image/heic', + 'heics' => 'image/heic-sequence', + 'heif' => 'image/heif', + 'heifs' => 'image/heif-sequence', + 'hej2' => 'image/hej2k', + 'held' => 'application/atsc-held+xml', + 'hh' => 'text/x-c', + 'hjson' => 'application/hjson', + 'hlp' => 'application/winhlp', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'hqx' => 'application/mac-binhex40', + 'hsj2' => 'image/hsj2', + 'htc' => 'text/x-component', + 'htke' => 'application/vnd.kenameaapp', + 'htm' => 'text/html', + 'html' => 'text/html', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'i2g' => 'application/vnd.intergeo', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'iges' => 'model/iges', + 'igl' => 'application/vnd.igloader', + 'igm' => 'application/vnd.insors.igm', + 'igs' => 'model/iges', + 'igx' => 'application/vnd.micrografx.igx', + 'iif' => 'application/vnd.shana.informed.interchange', + 'img' => 'application/octet-stream', + 'imp' => 'application/vnd.accpac.simply.imp', + 'ims' => 'application/vnd.ms-ims', + 'in' => 'text/plain', + 'ini' => 'text/plain', + 'ink' => 'application/inkml+xml', + 'inkml' => 'application/inkml+xml', + 'install' => 'application/x-install-instructions', + 'iota' => 'application/vnd.astraea-software.iota', + 'ipfix' => 'application/ipfix', + 'ipk' => 'application/vnd.shana.informed.package', + 'irm' => 'application/vnd.ibm.rights-management', + 'irp' => 'application/vnd.irepository.package+xml', + 'iso' => 'application/x-iso9660-image', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'its' => 'application/its+xml', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jade' => 'text/jade', + 'jam' => 'application/vnd.jam', + 'jar' => 'application/java-archive', + 'jardiff' => 'application/x-java-archive-diff', + 'java' => 'text/x-java-source', + 'jhc' => 'image/jphc', + 'jisp' => 'application/vnd.jisp', + 'jls' => 'image/jls', + 'jlt' => 'application/vnd.hp-jlyt', + 'jng' => 'image/x-jng', + 'jnlp' => 'application/x-java-jnlp-file', + 'joda' => 'application/vnd.joost.joda-archive', + 'jp2' => 'image/jp2', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpf' => 'image/jpx', + 'jpg' => 'image/jpeg', + 'jpg2' => 'image/jp2', + 'jpgm' => 'video/jpm', + 'jpgv' => 'video/jpeg', + 'jph' => 'image/jph', + 'jpm' => 'video/jpm', + 'jpx' => 'image/jpx', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'json5' => 'application/json5', + 'jsonld' => 'application/ld+json', + 'jsonml' => 'application/jsonml+json', + 'jsx' => 'text/jsx', + 'jt' => 'model/jt', + 'jxr' => 'image/jxr', + 'jxra' => 'image/jxra', + 'jxrs' => 'image/jxrs', + 'jxs' => 'image/jxs', + 'jxsc' => 'image/jxsc', + 'jxsi' => 'image/jxsi', + 'jxss' => 'image/jxss', + 'kar' => 'audio/midi', + 'karbon' => 'application/vnd.kde.karbon', + 'kdb' => 'application/octet-stream', + 'kdbx' => 'application/x-keepass2', + 'key' => 'application/x-iwork-keynote-sffkey', + 'kfo' => 'application/vnd.kde.kformula', + 'kia' => 'application/vnd.kidspiration', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ksp' => 'application/vnd.kde.kspread', + 'ktr' => 'application/vnd.kahootz', + 'ktx' => 'image/ktx', + 'ktx2' => 'image/ktx2', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'lasxml' => 'application/vnd.las.las+xml', + 'latex' => 'application/x-latex', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + 'les' => 'application/vnd.hhe.lesson-player', + 'less' => 'text/less', + 'lgr' => 'application/lgr+xml', + 'lha' => 'application/octet-stream', + 'link66' => 'application/vnd.route66.link66+xml', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'litcoffee' => 'text/coffeescript', + 'lnk' => 'application/x-ms-shortcut', + 'log' => 'text/plain', + 'lostxml' => 'application/lost+xml', + 'lrf' => 'application/octet-stream', + 'lrm' => 'application/vnd.ms-lrm', + 'ltf' => 'application/vnd.frogans.ltf', + 'lua' => 'text/x-lua', + 'luac' => 'application/x-lua-bytecode', + 'lvp' => 'audio/vnd.lucent.voice', + 'lwp' => 'application/vnd.lotus-wordpro', + 'lzh' => 'application/octet-stream', + 'm1v' => 'video/mpeg', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'text/plain', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'm4a' => 'audio/x-m4a', + 'm4p' => 'application/mp4', + 'm4s' => 'video/iso.segment', + 'm4u' => 'application/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm21' => 'application/mp21', + 'ma' => 'application/mathematica', + 'mads' => 'application/mads+xml', + 'maei' => 'application/mmt-aei+xml', + 'mag' => 'application/vnd.ecowin.chart', + 'maker' => 'application/vnd.framemaker', + 'man' => 'text/troff', + 'manifest' => 'text/cache-manifest', + 'map' => 'application/json', + 'mar' => 'application/octet-stream', + 'markdown' => 'text/markdown', + 'mathml' => 'application/mathml+xml', + 'mb' => 'application/mathematica', + 'mbk' => 'application/vnd.mobius.mbk', + 'mbox' => 'application/mbox', + 'mc1' => 'application/vnd.medcalcdata', + 'mcd' => 'application/vnd.mcd', + 'mcurl' => 'text/vnd.curl.mcurl', + 'md' => 'text/markdown', + 'mdb' => 'application/x-msaccess', + 'mdi' => 'image/vnd.ms-modi', + 'mdx' => 'text/mdx', + 'me' => 'text/troff', + 'mesh' => 'model/mesh', + 'meta4' => 'application/metalink4+xml', + 'metalink' => 'application/metalink+xml', + 'mets' => 'application/mets+xml', + 'mfm' => 'application/vnd.mfmp', + 'mft' => 'application/rpki-manifest', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'mgz' => 'application/vnd.proteus.magazine', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mie' => 'application/x-mie', + 'mif' => 'application/vnd.mif', + 'mime' => 'message/rfc822', + 'mj2' => 'video/mj2', + 'mjp2' => 'video/mj2', + 'mjs' => 'text/javascript', + 'mk3d' => 'video/x-matroska', + 'mka' => 'audio/x-matroska', + 'mkd' => 'text/x-markdown', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mlp' => 'application/vnd.dolby.mlp', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'mmf' => 'application/vnd.smaf', + 'mml' => 'text/mathml', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'mng' => 'video/x-mng', + 'mny' => 'application/x-msmoney', + 'mobi' => 'application/x-mobipocket-ebook', + 'mods' => 'application/mods+xml', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp2a' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4s' => 'application/mp4', + 'mp4v' => 'video/mp4', + 'mp21' => 'application/mp21', + 'mpc' => 'application/vnd.mophun.certificate', + 'mpd' => 'application/dash+xml', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpf' => 'application/media-policy-dataset+xml', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'mpm' => 'application/vnd.blueice.multipass', + 'mpn' => 'application/vnd.mophun.application', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/vnd.ms-project', + 'mpy' => 'application/vnd.ibm.minipay', + 'mqy' => 'application/vnd.mobius.mqy', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ms' => 'text/troff', + 'mscml' => 'application/mediaservercontrol+xml', + 'mseed' => 'application/vnd.fdsn.mseed', + 'mseq' => 'application/vnd.mseq', + 'msf' => 'application/vnd.epson.msf', + 'msg' => 'application/vnd.ms-outlook', + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'msix' => 'application/msix', + 'msixbundle' => 'application/msixbundle', + 'msl' => 'application/vnd.mobius.msl', + 'msm' => 'application/octet-stream', + 'msp' => 'application/octet-stream', + 'msty' => 'application/vnd.muvee.style', + 'mtl' => 'model/mtl', + 'mts' => 'model/vnd.mts', + 'mus' => 'application/vnd.musician', + 'musd' => 'application/mmt-usd+xml', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'mvb' => 'application/x-msmediaview', + 'mvt' => 'application/vnd.mapbox-vector-tile', + 'mwf' => 'application/vnd.mfer', + 'mxf' => 'application/mxf', + 'mxl' => 'application/vnd.recordare.musicxml', + 'mxmf' => 'audio/mobile-xmf', + 'mxml' => 'application/xv+xml', + 'mxs' => 'application/vnd.triscape.mxs', + 'mxu' => 'video/vnd.mpegurl', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'n3' => 'text/n3', + 'nb' => 'application/mathematica', + 'nbp' => 'application/vnd.wolfram.player', + 'nc' => 'application/x-netcdf', + 'ncx' => 'application/x-dtbncx+xml', + 'nfo' => 'text/x-nfo', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'nitf' => 'application/vnd.nitf', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'nml' => 'application/vnd.enliven', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'npx' => 'image/vnd.net-fpx', + 'nq' => 'application/n-quads', + 'nsc' => 'application/x-conference', + 'nsf' => 'application/vnd.lotus-notes', + 'nt' => 'application/n-triples', + 'ntf' => 'application/vnd.nitf', + 'numbers' => 'application/x-iwork-numbers-sffnumbers', + 'nzb' => 'application/x-nzb', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'oas' => 'application/vnd.fujitsu.oasys', + 'obd' => 'application/x-msbinder', + 'obgx' => 'application/vnd.openblox.game+xml', + 'obj' => 'model/obj', + 'oda' => 'application/oda', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogex' => 'model/vnd.opengex', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'opf' => 'application/oebps-package+xml', + 'opml' => 'text/x-opml', + 'oprc' => 'application/vnd.palm', + 'opus' => 'audio/ogg', + 'org' => 'text/x-org', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'osm' => 'application/vnd.openstreetmap.data+xml', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'otf' => 'font/otf', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'ova' => 'application/x-virtualbox-ova', + 'ovf' => 'application/x-virtualbox-ovf', + 'owl' => 'application/rdf+xml', + 'oxps' => 'application/oxps', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'p' => 'text/x-pascal', + 'p7a' => 'application/x-pkcs7-signature', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'pac' => 'application/x-ns-proxy-autoconfig', + 'pages' => 'application/x-iwork-pages-sffpages', + 'pas' => 'text/x-pascal', + 'paw' => 'application/vnd.pawaafile', + 'pbd' => 'application/vnd.powerbuilder6', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcf' => 'application/x-font-pcf', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'pct' => 'image/x-pict', + 'pcurl' => 'application/vnd.curl.pcurl', + 'pcx' => 'image/x-pcx', + 'pdb' => 'application/x-pilot', + 'pde' => 'text/x-processing', + 'pdf' => 'application/pdf', + 'pem' => 'application/x-x509-user-cert', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfr' => 'application/font-tdpfr', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pgp' => 'application/pgp', + 'phar' => 'application/octet-stream', + 'php' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'phtml' => 'application/x-httpd-php', + 'pic' => 'image/x-pict', + 'pkg' => 'application/octet-stream', + 'pki' => 'application/pkixcmp', + 'pkipath' => 'application/pkix-pkipath', + 'pkpass' => 'application/vnd.apple.pkpass', + 'pl' => 'application/x-perl', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'plc' => 'application/vnd.mobius.plc', + 'plf' => 'application/vnd.pocketlearn', + 'pls' => 'application/pls+xml', + 'pm' => 'application/x-perl', + 'pml' => 'application/vnd.ctc-posml', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'portpkg' => 'application/vnd.macports.portpkg', + 'pot' => 'application/vnd.ms-powerpoint', + 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppa' => 'application/vnd.ms-powerpoint', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'ppd' => 'application/vnd.cups-ppd', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => 'application/powerpoint', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pqa' => 'application/vnd.palm', + 'prc' => 'model/prc', + 'pre' => 'application/vnd.lotus-freelance', + 'prf' => 'application/pics-rules', + 'provx' => 'application/provenance+xml', + 'ps' => 'application/postscript', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'psd' => 'application/x-photoshop', + 'psf' => 'application/x-font-linux-psf', + 'pskcxml' => 'application/pskc+xml', + 'pti' => 'image/prs.pti', + 'ptid' => 'application/vnd.pvi.ptid1', + 'pub' => 'application/x-mspublisher', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyo' => 'model/vnd.pytha.pyox', + 'pyox' => 'model/vnd.pytha.pyox', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'qam' => 'application/vnd.epson.quickanime', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'qps' => 'application/vnd.publishare-delta-tree', + 'qt' => 'video/quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => 'audio/x-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'raml' => 'application/raml+yaml', + 'rapd' => 'application/route-apd+xml', + 'rar' => 'application/x-rar', + 'ras' => 'image/x-cmu-raster', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'rdf' => 'application/rdf+xml', + 'rdz' => 'application/vnd.data-vision.rdz', + 'relo' => 'application/p2p-overlay+xml', + 'rep' => 'application/vnd.businessobjects', + 'res' => 'application/x-dtbresource+xml', + 'rgb' => 'image/x-rgb', + 'rif' => 'application/reginfo+xml', + 'rip' => 'audio/vnd.rip', + 'ris' => 'application/x-research-info-systems', + 'rl' => 'application/resource-lists+xml', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'rld' => 'application/resource-lists-diff+xml', + 'rm' => 'audio/x-pn-realaudio', + 'rmi' => 'audio/midi', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'rnc' => 'application/relax-ng-compact-syntax', + 'rng' => 'application/xml', + 'roa' => 'application/rpki-roa', + 'roff' => 'text/troff', + 'rp9' => 'application/vnd.cloanto.rp9', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rq' => 'application/sparql-query', + 'rs' => 'application/rls-services+xml', + 'rsa' => 'application/x-pkcs7', + 'rsat' => 'application/atsc-rsat+xml', + 'rsd' => 'application/rsd+xml', + 'rsheet' => 'application/urc-ressheet+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'text/rtf', + 'rtx' => 'text/richtext', + 'run' => 'application/x-makeself', + 'rusd' => 'application/route-usd+xml', + 'rv' => 'video/vnd.rn-realvideo', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'sass' => 'text/x-sass', + 'sbml' => 'application/sbml+xml', + 'sc' => 'application/vnd.ibm.secure-container', + 'scd' => 'application/x-msschedule', + 'scm' => 'application/vnd.lotus-screencam', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'scss' => 'text/x-scss', + 'scurl' => 'text/vnd.curl.scurl', + 'sda' => 'application/vnd.stardivision.draw', + 'sdc' => 'application/vnd.stardivision.calc', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdp' => 'application/sdp', + 'sdw' => 'application/vnd.stardivision.writer', + 'sea' => 'application/octet-stream', + 'see' => 'application/vnd.seemail', + 'seed' => 'application/vnd.fdsn.seed', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'senmlx' => 'application/senml+xml', + 'sensmlx' => 'application/sensml+xml', + 'ser' => 'application/java-serialized-object', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sfv' => 'text/x-sfv', + 'sgi' => 'image/sgi', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'shex' => 'text/shex', + 'shf' => 'application/shf+xml', + 'shtml' => 'text/html', + 'sid' => 'image/x-mrsid-image', + 'sieve' => 'application/sieve', + 'sig' => 'application/pgp-signature', + 'sil' => 'audio/silk', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'siv' => 'application/sieve', + 'skd' => 'application/vnd.koan', + 'skm' => 'application/vnd.koan', + 'skp' => 'application/vnd.koan', + 'skt' => 'application/vnd.koan', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'slim' => 'text/slim', + 'slm' => 'text/slim', + 'sls' => 'application/route-s-tsid+xml', + 'slt' => 'application/vnd.epson.salt', + 'sm' => 'application/vnd.stepmania.stepchart', + 'smf' => 'application/vnd.stardivision.math', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'smv' => 'video/x-smv', + 'smzip' => 'application/vnd.stepmania.package', + 'snd' => 'audio/basic', + 'snf' => 'application/x-font-snf', + 'so' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spdx' => 'text/spdx', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'spl' => 'application/x-futuresplash', + 'spot' => 'text/vnd.in3d.spot', + 'spp' => 'application/scvp-vp-response', + 'spq' => 'application/scvp-vp-request', + 'spx' => 'audio/ogg', + 'sql' => 'application/x-sql', + 'src' => 'application/x-wais-source', + 'srt' => 'application/x-subrip', + 'sru' => 'application/sru+xml', + 'srx' => 'application/sparql-results+xml', + 'ssdl' => 'application/ssdl+xml', + 'sse' => 'application/vnd.kodak-descriptor', + 'ssf' => 'application/vnd.epson.ssf', + 'ssml' => 'application/ssml+xml', + 'sst' => 'application/octet-stream', + 'st' => 'application/vnd.sailingtracker.track', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'step' => 'application/STEP', + 'stf' => 'application/vnd.wt.stf', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stk' => 'application/hyperstudio', + 'stl' => 'model/stl', + 'stp' => 'application/STEP', + 'stpx' => 'model/step+xml', + 'stpxz' => 'model/step-xml+zip', + 'stpz' => 'model/step+zip', + 'str' => 'application/vnd.pg.format', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'styl' => 'text/stylus', + 'stylus' => 'text/stylus', + 'sub' => 'text/vnd.dvb.subtitle', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svc' => 'application/vnd.dvb.service', + 'svd' => 'application/vnd.svd', + 'svg' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 'swi' => 'application/vnd.aristanetworks.swi', + 'swidtag' => 'application/swid+xml', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 't' => 'text/troff', + 't3' => 'application/x-t3vm-image', + 't38' => 'image/t38', + 'taglet' => 'application/vnd.mynfc', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'tap' => 'image/vnd.tencent.tap', + 'tar' => 'application/x-tar', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'tcl' => 'application/x-tcl', + 'td' => 'application/urc-targetdesc+xml', + 'teacher' => 'application/vnd.smart.teacher', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tfi' => 'application/thraud+xml', + 'tfm' => 'application/x-tex-tfm', + 'tfx' => 'image/tiff-fx', + 'tga' => 'image/x-tga', + 'tgz' => 'application/x-tar', + 'thmx' => 'application/vnd.ms-officetheme', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tk' => 'application/x-tcl', + 'tmo' => 'application/vnd.tmobile-livetv', + 'toml' => 'application/toml', + 'torrent' => 'application/x-bittorrent', + 'tpl' => 'application/vnd.groove-tool-template', + 'tpt' => 'application/vnd.trid.tpt', + 'tr' => 'text/troff', + 'tra' => 'application/vnd.trueapp', + 'trig' => 'application/trig', + 'trm' => 'application/x-msterminal', + 'ts' => 'video/mp2t', + 'tsd' => 'application/timestamped-data', + 'tsv' => 'text/tab-separated-values', + 'ttc' => 'font/collection', + 'ttf' => 'font/ttf', + 'ttl' => 'text/turtle', + 'ttml' => 'application/ttml+xml', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'txf' => 'application/vnd.mobius.txf', + 'txt' => 'text/plain', + 'u3d' => 'model/u3d', + 'u8dsn' => 'message/global-delivery-status', + 'u8hdr' => 'message/global-headers', + 'u8mdn' => 'message/global-disposition-notification', + 'u8msg' => 'message/global', + 'u32' => 'application/x-authorware-bin', + 'ubj' => 'application/ubjson', + 'udeb' => 'application/x-debian-package', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'ulx' => 'application/x-glulx', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uo' => 'application/vnd.uoml+xml', + 'uoml' => 'application/vnd.uoml+xml', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'usda' => 'model/vnd.usda', + 'usdz' => 'model/vnd.usdz+zip', + 'ustar' => 'application/x-ustar', + 'utz' => 'application/vnd.uiq.theme', + 'uu' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vbox' => 'application/x-virtualbox-vbox', + 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', + 'vcard' => 'text/vcard', + 'vcd' => 'application/x-cdlink', + 'vcf' => 'text/x-vcard', + 'vcg' => 'application/vnd.groove-vcard', + 'vcs' => 'text/x-vcalendar', + 'vcx' => 'application/vnd.vcx', + 'vdi' => 'application/x-virtualbox-vdi', + 'vds' => 'model/vnd.sap.vds', + 'vhd' => 'application/x-virtualbox-vhd', + 'vis' => 'application/vnd.visionary', + 'viv' => 'video/vnd.vivo', + 'vlc' => 'application/videolan', + 'vmdk' => 'application/x-virtualbox-vmdk', + 'vob' => 'video/x-ms-vob', + 'vor' => 'application/vnd.stardivision.writer', + 'vox' => 'application/x-authorware-bin', + 'vrml' => 'model/vrml', + 'vsd' => 'application/vnd.visio', + 'vsf' => 'application/vnd.vsf', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vtf' => 'image/vnd.valve.source.texture', + 'vtt' => 'text/vtt', + 'vtu' => 'model/vnd.vtu', + 'vxml' => 'application/voicexml+xml', + 'w3d' => 'application/x-director', + 'wad' => 'application/x-doom', + 'wadl' => 'application/vnd.sun.wadl+xml', + 'war' => 'application/java-archive', + 'wasm' => 'application/wasm', + 'wav' => 'audio/x-wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'wbxml' => 'application/wbxml', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wdp' => 'image/vnd.ms-photo', + 'weba' => 'audio/webm', + 'webapp' => 'application/x-web-app-manifest+json', + 'webm' => 'video/webm', + 'webmanifest' => 'application/manifest+json', + 'webp' => 'image/webp', + 'wg' => 'application/vnd.pmi.widget', + 'wgsl' => 'text/wgsl', + 'wgt' => 'application/widget', + 'wif' => 'application/watcherinfo+xml', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'image/wmf', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-msmetafile', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', + 'word' => 'application/msword', + 'wpd' => 'application/vnd.wordperfect', + 'wpl' => 'application/vnd.ms-wpl', + 'wps' => 'application/vnd.ms-works', + 'wqd' => 'application/vnd.wqd', + 'wri' => 'application/x-mswrite', + 'wrl' => 'model/vrml', + 'wsc' => 'message/vnd.wfa.wsc', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + 'wtb' => 'application/vnd.webturbo', + 'wvx' => 'video/x-ms-wvx', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+fastinfoset', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d-vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'x32' => 'application/x-authorware-bin', + 'x_b' => 'model/vnd.parasolid.transmit.binary', + 'x_t' => 'model/vnd.parasolid.transmit.text', + 'xaml' => 'application/xaml+xml', + 'xap' => 'application/x-silverlight-app', + 'xar' => 'application/vnd.xara', + 'xav' => 'application/xcap-att+xml', + 'xbap' => 'application/x-ms-xbap', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'xbm' => 'image/x-xbitmap', + 'xca' => 'application/xcap-caps+xml', + 'xcs' => 'application/calendar+xml', + 'xdf' => 'application/xcap-diff+xml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xdssc' => 'application/dssc+xml', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xel' => 'application/xcap-el+xml', + 'xenc' => 'application/xenc+xml', + 'xer' => 'application/patch-ops-error+xml', + 'xfdf' => 'application/xfdf', + 'xfdl' => 'application/vnd.xfdl', + 'xht' => 'application/xhtml+xml', + 'xhtm' => 'application/vnd.pwg-xhtml-print+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xl' => 'application/excel', + 'xla' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'xlc' => 'application/vnd.ms-excel', + 'xlf' => 'application/xliff+xml', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlt' => 'application/vnd.ms-excel', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlw' => 'application/vnd.ms-excel', + 'xm' => 'audio/xm', + 'xml' => 'application/xml', + 'xns' => 'application/xcap-ns+xml', + 'xo' => 'application/vnd.olpc-sugar', + 'xop' => 'application/xop+xml', + 'xpi' => 'application/x-xpinstall', + 'xpl' => 'application/xproc+xml', + 'xpm' => 'image/x-xpixmap', + 'xpr' => 'application/vnd.is-xpr', + 'xps' => 'application/vnd.ms-xpsdocument', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsd' => 'application/xml', + 'xsf' => 'application/prs.xsf+xml', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xsm' => 'application/vnd.syncml+xml', + 'xspf' => 'application/xspf+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + 'xz' => 'application/x-xz', + 'yaml' => 'text/yaml', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'yml' => 'text/yaml', + 'ymp' => 'text/x-suse-ymp', + 'z' => 'application/x-compress', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'zip' => 'application/zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + 'zsh' => 'text/x-scriptzsh', + ]; + + /** + * Determines the mimetype of a file by looking at its extension. + * + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + */ + public static function fromFilename(string $filename): ?string + { + return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION)); + } + + /** + * Maps a file extensions to a mimetype. + * + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + */ + public static function fromExtension(string $extension): ?string + { + return self::MIME_TYPES[strtolower($extension)] ?? null; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MultipartStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 0000000000..43d718f658 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,165 @@ +boundary = $boundary ?: bin2hex(random_bytes(20)); + $this->stream = $this->createStream($elements); + } + + public function getBoundary(): string + { + return $this->boundary; + } + + public function isWritable(): bool + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + * + * @param string[] $headers + */ + private function getHeaders(array $headers): string + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + + return "--{$this->boundary}\r\n".trim($str)."\r\n\r\n"; + } + + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements = []): StreamInterface + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + if (!is_array($element)) { + throw new \UnexpectedValueException('An array is expected'); + } + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element): void + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = Utils::streamFor($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if ($uri && \is_string($uri) && \substr($uri, 0, 6) !== 'php://' && \substr($uri, 0, 7) !== 'data://') { + $element['filename'] = $uri; + } + } + + [$body, $headers] = $this->createElement( + $element['name'], + $element['contents'], + $element['filename'] ?? null, + $element['headers'] ?? [] + ); + + $stream->addStream(Utils::streamFor($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(Utils::streamFor("\r\n")); + } + + /** + * @param string[] $headers + * + * @return array{0: StreamInterface, 1: string[]} + */ + private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array + { + // Set a default content-disposition header if one was no provided + $disposition = self::getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = ($filename === '0' || $filename) + ? sprintf( + 'form-data; name="%s"; filename="%s"', + $name, + basename($filename) + ) + : "form-data; name=\"{$name}\""; + } + + // Set a default content-length header if one was no provided + $length = self::getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + + // Set a default Content-Type if one was not supplied + $type = self::getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + $headers['Content-Type'] = MimeType::fromFilename($filename) ?? 'application/octet-stream'; + } + + return [$stream, $headers]; + } + + /** + * @param string[] $headers + */ + private static function getHeader(array $headers, string $key): ?string + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower((string) $k) === $lowercaseHeader) { + return $v; + } + } + + return null; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/NoSeekStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 0000000000..161a224f02 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,28 @@ +source = $source; + $this->size = $options['size'] ?? null; + $this->metadata = $options['metadata'] ?? []; + $this->buffer = new BufferStream(); + } + + public function __toString(): string + { + try { + return Utils::copyToString($this); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + + return ''; + } + } + + public function close(): void + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = 0; + $this->source = null; + + return null; + } + + public function getSize(): ?int + { + return $this->size; + } + + public function tell(): int + { + return $this->tellPos; + } + + public function eof(): bool + { + return $this->source === null; + } + + public function isSeekable(): bool + { + return false; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable(): bool + { + return false; + } + + public function write($string): int + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable(): bool + { + return true; + } + + public function read($length): string + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents(): string + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + /** + * @return mixed + */ + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return $this->metadata[$key] ?? null; + } + + private function pump(int $length): void + { + if ($this->source !== null) { + do { + $data = ($this->source)($length); + if ($data === false || $data === null) { + $this->source = null; + + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Query.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Query.php new file mode 100644 index 0000000000..ccf867a0bd --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Query.php @@ -0,0 +1,118 @@ + '1', 'foo[b]' => '2'])`. + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + */ + public static function parse(string $str, $urlEncoding = true): array + { + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', (string) $value)); + }; + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { + return $str; + }; + } + + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!array_key_exists($key, $result)) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + + return $result; + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, + * PHP_QUERY_RFC3986 to encode using + * RFC3986, or PHP_QUERY_RFC1738 to + * encode using RFC1738. + * @param bool $treatBoolsAsInts Set to true to encode as 0/1, and + * false as false/true. + */ + public static function build(array $params, $encoding = PHP_QUERY_RFC3986, bool $treatBoolsAsInts = true): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = $treatBoolsAsInts ? static function ($v) { return (int) $v; } : static function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Request.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Request.php new file mode 100644 index 0000000000..faafe1ad8b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,159 @@ +assertMethod($method); + if (!($uri instanceof UriInterface)) { + $uri = new Uri($uri); + } + + $this->method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($body); + } + } + + public function getRequestTarget(): string + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($target === '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?'.$this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget): RequestInterface + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + + return $new; + } + + public function getMethod(): string + { + return $this->method; + } + + public function withMethod($method): RequestInterface + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + + return $new; + } + + public function getUri(): UriInterface + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri(): void + { + $host = $this->uri->getHost(); + + if ($host == '') { + return; + } + + if (($port = $this->uri->getPort()) !== null) { + $host .= ':'.$port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + + /** + * @param mixed $method + */ + private function assertMethod($method): void + { + if (!is_string($method) || $method === '') { + throw new InvalidArgumentException('Method must be a non-empty string.'); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Response.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Response.php new file mode 100644 index 0000000000..34e612fda5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,161 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 308 => 'Permanent Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 510 => 'Not Extended', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase; + + /** @var int */ + private $statusCode; + + /** + * @param int $status Status code + * @param (string|string[])[] $headers Response headers + * @param string|resource|StreamInterface|null $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + int $status = 200, + array $headers = [], + $body = null, + string $version = '1.1', + ?string $reason = null + ) { + $this->assertStatusCodeRange($status); + + $this->statusCode = $status; + + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($body); + } + + $this->setHeaders($headers); + if ($reason == '' && isset(self::PHRASES[$this->statusCode])) { + $this->reasonPhrase = self::PHRASES[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode(): int + { + return $this->statusCode; + } + + public function getReasonPhrase(): string + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = ''): ResponseInterface + { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + + $new = clone $this; + $new->statusCode = $code; + if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) { + $reasonPhrase = self::PHRASES[$new->statusCode]; + } + $new->reasonPhrase = (string) $reasonPhrase; + + return $new; + } + + /** + * @param mixed $statusCode + */ + private function assertStatusCodeIsInteger($statusCode): void + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange(int $statusCode): void + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Rfc7230.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000000..8219dba4dc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,23 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/ServerRequest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 0000000000..3cc953453b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,340 @@ +serverParams = $serverParams; + + parent::__construct($method, $uri, $headers, $body, $version); + } + + /** + * Return an UploadedFile instance array. + * + * @param array $files An array which respect $_FILES structure + * + * @throws InvalidArgumentException for unrecognized values + */ + public static function normalizeFiles(array $files): array + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + + return $normalized; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * + * @return UploadedFileInterface|UploadedFileInterface[] + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + + return new UploadedFile( + $value['tmp_name'], + (int) $value['size'], + (int) $value['error'], + $value['name'], + $value['type'] + ); + } + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []): array + { + $normalizedFiles = []; + + foreach (array_keys($files['tmp_name']) as $key) { + $spec = [ + 'tmp_name' => $files['tmp_name'][$key], + 'size' => $files['size'][$key] ?? null, + 'error' => $files['error'][$key] ?? null, + 'name' => $files['name'][$key] ?? null, + 'type' => $files['type'][$key] ?? null, + ]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + + return $normalizedFiles; + } + + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + */ + public static function fromGlobals(): ServerRequestInterface + { + $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + + return $serverRequest + ->withCookieParams($_COOKIE) + ->withQueryParams($_GET) + ->withParsedBody($_POST) + ->withUploadedFiles(self::normalizeFiles($_FILES)); + } + + private static function extractHostAndPortFromAuthority(string $authority): array + { + $uri = 'http://'.$authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = $parts['host'] ?? null; + $port = $parts['port'] ?? null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + */ + public static function getUriFromGlobals(): UriInterface + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + [$host, $port] = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { + $hasPort = true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + + return $uri; + } + + public function getServerParams(): array + { + return $this->serverParams; + } + + public function getUploadedFiles(): array + { + return $this->uploadedFiles; + } + + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + public function getCookieParams(): array + { + return $this->cookieParams; + } + + public function withCookieParams(array $cookies): ServerRequestInterface + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + public function getQueryParams(): array + { + return $this->queryParams; + } + + public function withQueryParams(array $query): ServerRequestInterface + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * @return array|object|null + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + public function withParsedBody($data): ServerRequestInterface + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + public function getAttributes(): array + { + return $this->attributes; + } + + /** + * @return mixed + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + public function withAttribute($attribute, $value): ServerRequestInterface + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + public function withoutAttribute($attribute): ServerRequestInterface + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + + $new = clone $this; + unset($new->attributes[$attribute]); + + return $new; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Stream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 0000000000..0aff9b2b7a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,283 @@ +size = $options['size']; + } + + $this->customMetadata = $options['metadata'] ?? []; + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = (bool) preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool) preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString(): string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + + return ''; + } + } + + public function getContents(): string + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + + return Utils::tryGetContents($this->stream); + } + + public function close(): void + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize(): ?int + { + if ($this->size !== null) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (is_array($stats) && isset($stats['size'])) { + $this->size = $stats['size']; + + return $this->size; + } + + return null; + } + + public function isReadable(): bool + { + return $this->readable; + } + + public function isWritable(): bool + { + return $this->writable; + } + + public function isSeekable(): bool + { + return $this->seekable; + } + + public function eof(): bool + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell(): int + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if ($result === false) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + $whence = (int) $whence; + + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' + .$offset.' with whence '.var_export($whence, true)); + } + } + + public function read($length): string + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + try { + $string = fread($this->stream, $length); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to read from stream', 0, $e); + } + + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string): int + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if ($result === false) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + /** + * @return mixed + */ + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return $meta[$key] ?? null; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 0000000000..601c13afb3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,156 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @return StreamInterface + */ + public function __get(string $name) + { + if ($name === 'stream') { + $this->stream = $this->createStream(); + + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString(): string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + + return ''; + } + } + + public function getContents(): string + { + return Utils::copyToString($this); + } + + /** + * Allow decorators to implement custom methods + * + * @return mixed + */ + public function __call(string $method, array $args) + { + /** @var callable $callable */ + $callable = [$this->stream, $method]; + $result = ($callable)(...$args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close(): void + { + $this->stream->close(); + } + + /** + * @return mixed + */ + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize(): ?int + { + return $this->stream->getSize(); + } + + public function eof(): bool + { + return $this->stream->eof(); + } + + public function tell(): int + { + return $this->stream->tell(); + } + + public function isReadable(): bool + { + return $this->stream->isReadable(); + } + + public function isWritable(): bool + { + return $this->stream->isWritable(); + } + + public function isSeekable(): bool + { + return $this->stream->isSeekable(); + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + $this->stream->seek($offset, $whence); + } + + public function read($length): string + { + return $this->stream->read($length); + } + + public function write($string): int + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @throws \BadMethodCallException + */ + protected function createStream(): StreamInterface + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamWrapper.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 0000000000..77b04d7471 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,207 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + .'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, false, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ + 'guzzle' => ['stream' => $stream], + ]); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register(): void + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open(string $path, string $mode, int $options, ?string &$opened_path = null): bool + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read(int $count): string + { + return $this->stream->read($count); + } + + public function stream_write(string $data): int + { + return $this->stream->write($data); + } + + public function stream_tell(): int + { + return $this->stream->tell(); + } + + public function stream_eof(): bool + { + return $this->stream->eof(); + } + + public function stream_seek(int $offset, int $whence): bool + { + $this->stream->seek($offset, $whence); + + return true; + } + + /** + * @return resource|false + */ + public function stream_cast(int $cast_as) + { + $stream = clone $this->stream; + $resource = $stream->detach(); + + return $resource ?? false; + } + + /** + * @return array{ + * dev: int, + * ino: int, + * mode: int, + * nlink: int, + * uid: int, + * gid: int, + * rdev: int, + * size: int, + * atime: int, + * mtime: int, + * ctime: int, + * blksize: int, + * blocks: int + * }|false + */ + public function stream_stat() + { + if ($this->stream->getSize() === null) { + return false; + } + + static $modeMap = [ + 'r' => 33060, + 'rb' => 33060, + 'r+' => 33206, + 'w' => 33188, + 'wb' => 33188, + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0, + ]; + } + + /** + * @return array{ + * dev: int, + * ino: int, + * mode: int, + * nlink: int, + * uid: int, + * gid: int, + * rdev: int, + * size: int, + * atime: int, + * mtime: int, + * ctime: int, + * blksize: int, + * blocks: int + * } + */ + public function url_stat(string $path, int $flags): array + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0, + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UploadedFile.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 0000000000..9c9ea49fbd --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,211 @@ +setError($errorStatus); + $this->size = $size; + $this->clientFilename = $clientFilename; + $this->clientMediaType = $clientMediaType; + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param StreamInterface|string|resource $streamOrFile + * + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile): void + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException( + 'Invalid stream or file provided for UploadedFile' + ); + } + } + + /** + * @throws InvalidArgumentException + */ + private function setError(int $error): void + { + if (false === in_array($error, UploadedFile::ERRORS, true)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + private static function isStringNotEmpty($param): bool + { + return is_string($param) && false === empty($param); + } + + /** + * Return true if there is no upload error + */ + private function isOk(): bool + { + return $this->error === UPLOAD_ERR_OK; + } + + public function isMoved(): bool + { + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive(): void + { + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + + public function getStream(): StreamInterface + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + /** @var string $file */ + $file = $this->file; + + return new LazyOpenStream($file, 'r+'); + } + + public function moveTo($targetPath): void + { + $this->validateActive(); + + if (false === self::isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + if ($this->file) { + $this->moved = PHP_SAPI === 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + Utils::copyToStream( + $this->getStream(), + new LazyOpenStream($targetPath, 'w') + ); + + $this->moved = true; + } + + if (false === $this->moved) { + throw new RuntimeException( + sprintf('Uploaded file could not be moved to %s', $targetPath) + ); + } + } + + public function getSize(): ?int + { + return $this->size; + } + + public function getError(): int + { + return $this->error; + } + + public function getClientFilename(): ?string + { + return $this->clientFilename; + } + + public function getClientMediaType(): ?string + { + return $this->clientMediaType; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Uri.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 0000000000..481dfca946 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,743 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + /** + * Unreserved characters for use in a regex. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.3 + */ + private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; + + /** + * Sub-delims for use in a regex. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 + */ + private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; + private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** @var string|null String representation */ + private $composedComponents; + + public function __construct(string $uri = '') + { + if ($uri !== '') { + $parts = self::parse($uri); + if ($parts === false) { + throw new MalformedUriException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + + /** + * UTF-8 aware \parse_url() replacement. + * + * The internal function produces broken output for non ASCII domain names + * (IDN) when used with locales other than "C". + * + * On the other hand, cURL understands IDN correctly only when UTF-8 locale + * is configured ("C.UTF-8", "en_US.UTF-8", etc.). + * + * @see https://bugs.php.net/bug.php?id=52923 + * @see https://www.php.net/manual/en/function.parse-url.php#114817 + * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING + * + * @return array|false + */ + private static function parse(string $url) + { + // If IPv6 + $prefix = ''; + if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { + /** @var array{0:string, 1:string, 2:string} $matches */ + $prefix = $matches[1]; + $url = $matches[2]; + } + + /** @var string */ + $encodedUrl = preg_replace_callback( + '%[^:/@?&=#]+%usD', + static function ($matches) { + return urlencode($matches[0]); + }, + $url + ); + + $result = parse_url($prefix.$encodedUrl); + + if ($result === false) { + return false; + } + + return array_map('urldecode', $result); + } + + public function __toString(): string + { + if ($this->composedComponents === null) { + $this->composedComponents = self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + return $this->composedComponents; + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.3 + */ + public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme.':'; + } + + if ($authority != '' || $scheme === 'file') { + $uri .= '//'.$authority; + } + + if ($authority != '' && $path != '' && $path[0] != '/') { + $path = '/'.$path; + } + + $uri .= $path; + + if ($query != '') { + $uri .= '?'.$query; + } + + if ($fragment != '') { + $uri .= '#'.$fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + */ + public static function isDefaultPort(UriInterface $uri): bool + { + return $uri->getPort() === null + || (isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri): bool + { + return $uri->getScheme() !== ''; + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri): bool + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri): bool + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && isset($uri->getPath()[0]) + && $uri->getPath()[0] === '/'; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri): bool + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null): bool + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + */ + public static function withoutQueryValue(UriInterface $uri, string $key): UriInterface + { + $result = self::getFilteredQueryString($uri, [$key]); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + */ + public static function withQueryValue(UriInterface $uri, string $key, ?string $value): UriInterface + { + $result = self::getFilteredQueryString($uri, [$key]); + + $result[] = self::generateQueryString($key, $value); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param (string|null)[] $keyValueArray Associative array of key and values + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @see https://www.php.net/manual/en/function.parse-url.php + * + * @throws MalformedUriException If the components do not form a valid URI. + */ + public static function fromParts(array $parts): UriInterface + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme(): string + { + return $this->scheme; + } + + public function getAuthority(): string + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo.'@'.$authority; + } + + if ($this->port !== null) { + $authority .= ':'.$this->port; + } + + return $authority; + } + + public function getUserInfo(): string + { + return $this->userInfo; + } + + public function getHost(): string + { + return $this->host; + } + + public function getPort(): ?int + { + return $this->port; + } + + public function getPath(): string + { + return $this->path; + } + + public function getQuery(): string + { + return $this->query; + } + + public function getFragment(): string + { + return $this->fragment; + } + + public function withScheme($scheme): UriInterface + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null): UriInterface + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':'.$this->filterUserInfoComponent($password); + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withHost($host): UriInterface + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withPort($port): UriInterface + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path): UriInterface + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withQuery($query): UriInterface + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + $new->composedComponents = null; + + return $new; + } + + public function withFragment($fragment): UriInterface + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + $new->composedComponents = null; + + return $new; + } + + public function jsonSerialize(): string + { + return $this->__toString(); + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts): void + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) + ? $this->filterUserInfoComponent($parts['user']) + : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':'.$this->filterUserInfoComponent($parts['pass']); + } + + $this->removeDefaultPort(); + } + + /** + * @param mixed $scheme + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme): string + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + + /** + * @param mixed $component + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component): string + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + + /** + * @param mixed $host + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host): string + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + + /** + * @param mixed $port + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port): ?int + { + if ($port === null) { + return null; + } + + $port = (int) $port; + if (0 > $port || 0xFFFF < $port) { + throw new \InvalidArgumentException( + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) + ); + } + + return $port; + } + + /** + * @param (string|int)[] $keys + * + * @return string[] + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys): array + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map(function ($k): string { + return rawurldecode((string) $k); + }, $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + private static function generateQueryString(string $key, ?string $value): string + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT); + + if ($value !== null) { + $queryString .= '='.strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); + } + + return $queryString; + } + + private function removeDefaultPort(): void + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param mixed $path + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path): string + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param mixed $str + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str): string + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match): string + { + return rawurlencode($match[0]); + } + + private function validateState(): void + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriComparator.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriComparator.php new file mode 100644 index 0000000000..70c582aa0f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriComparator.php @@ -0,0 +1,52 @@ +getHost(), $modified->getHost()) !== 0) { + return true; + } + + if ($original->getScheme() !== $modified->getScheme()) { + return true; + } + + if (self::computePort($original) !== self::computePort($modified)) { + return true; + } + + return false; + } + + private static function computePort(UriInterface $uri): int + { + $port = $uri->getPort(); + + if (null !== $port) { + return $port; + } + + return 'https' === $uri->getScheme() ? 443 : 80; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriNormalizer.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 0000000000..e174557379 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,220 @@ +getPath() === '' + && ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') + ) { + $uri = $uri->withPath('/'); + } + + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + + return $uri; + } + + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri): UriInterface + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + + $callback = function (array $match): string { + return strtoupper($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private static function decodeUnreservedCharacters(UriInterface $uri): UriInterface + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + + $callback = function (array $match): string { + return rawurldecode($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriResolver.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 0000000000..3737be1e57 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,211 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/'.$rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1).$rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + */ + public static function relativize(UriInterface $base, UriInterface $target): UriInterface + { + if ($target->getScheme() !== '' + && ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + /** @var string $lastSegment */ + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target): string + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)).implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Utils.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Utils.php new file mode 100644 index 0000000000..4785e2deb6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/src/Utils.php @@ -0,0 +1,477 @@ + $v) { + if (!in_array(strtolower((string) $k), $keys)) { + $result[$k] = $v; + } + } + + return $result; + } + + /** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ + public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void + { + $bufferSize = 8192; + + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } + } + + /** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ + public static function copyToString(StreamInterface $stream, int $maxLen = -1): string + { + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + if ($buf === '') { + break; + } + $buffer .= $buf; + } + + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + if ($buf === '') { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; + } + + /** + * Calculate a hash of a stream. + * + * This method reads the entire stream to calculate a rolling hash, based + * on PHP's `hash_init` functions. + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @throws \RuntimeException on error. + */ + public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string + { + $pos = $stream->tell(); + + if ($pos > 0) { + $stream->rewind(); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, $rawOutput); + $stream->seek($pos); + + return $out; + } + + /** + * Clone and modify a request with the given changes. + * + * This method is useful for reducing the number of clones needed to mutate + * a message. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + */ + public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface + { + if (!$changes) { + return $request; + } + + $headers = $request->getHeaders(); + + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':'.$port; + } + } + } + $uri = $changes['uri']; + } + + if (!empty($changes['remove_headers'])) { + $headers = self::caselessRemove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = self::caselessRemove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + $new = (new ServerRequest( + $changes['method'] ?? $request->getMethod(), + $uri, + $headers, + $changes['body'] ?? $request->getBody(), + $changes['version'] ?? $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + + foreach ($request->getAttributes() as $key => $value) { + $new = $new->withAttribute($key, $value); + } + + return $new; + } + + return new Request( + $changes['method'] ?? $request->getMethod(), + $uri, + $headers, + $changes['body'] ?? $request->getBody(), // this method does not exist on Request + $changes['version'] ?? $request->getProtocolVersion() + ); + } + + /** + * Read a line from the stream up to the maximum allowed buffer length. + * + * @param StreamInterface $stream Stream to read from + * @param int|null $maxLength Maximum buffer length + */ + public static function readLine(StreamInterface $stream, ?int $maxLength = null): string + { + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + if ('' === ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + + return $buffer; + } + + /** + * Redact the password in the user info part of a URI. + */ + public static function redactUserInfo(UriInterface $uri): UriInterface + { + $userInfo = $uri->getUserInfo(); + + if (false !== ($pos = \strpos($userInfo, ':'))) { + return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***'); + } + + return $uri; + } + + /** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * This method accepts the following `$resource` types: + * - `Psr\Http\Message\StreamInterface`: Returns the value as-is. + * - `string`: Creates a stream object that uses the given string as the contents. + * - `resource`: Creates a stream object that wraps the given PHP stream resource. + * - `Iterator`: If the provided value implements `Iterator`, then a read-only + * stream object will be created that wraps the given iterable. Each time the + * stream is read from, data from the iterator will fill a buffer and will be + * continuously called until the buffer is equal to the requested read size. + * Subsequent read calls will first read from the buffer and then call `next` + * on the underlying iterator until it is exhausted. + * - `object` with `__toString()`: If the object has the `__toString()` method, + * the object will be cast to a string and then a stream will be returned that + * uses the string value. + * - `NULL`: When `null` is passed, an empty stream object is returned. + * - `callable` When a callable is passed, a read-only stream object will be + * created that invokes the given callable. The callable is invoked with the + * number of suggested bytes to read. The callable can return any number of + * bytes, but MUST return `false` when there is no more data to return. The + * stream object that wraps the callable will invoke the callable until the + * number of requested bytes are available. Any additional bytes will be + * buffered and used in subsequent reads. + * + * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data + * @param array{size?: int, metadata?: array} $options Additional options + * + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ + public static function streamFor($resource = '', array $options = []): StreamInterface + { + if (is_scalar($resource)) { + $stream = self::tryFopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, (string) $resource); + fseek($stream, 0); + } + + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + /* + * The 'php://input' is a special stream with quirks and inconsistencies. + * We avoid using that stream by reading it into php://temp + */ + + /** @var resource $resource */ + if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') { + $stream = self::tryFopen('php://temp', 'w+'); + stream_copy_to_stream($resource, $stream); + fseek($stream, 0); + $resource = $stream; + } + + return new Stream($resource, $options); + case 'object': + /** @var object $resource */ + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return self::streamFor((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(self::tryFopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource)); + } + + /** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * + * @throws \RuntimeException if the file cannot be opened + */ + public static function tryFopen(string $filename, string $mode) + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool { + $ex = new \RuntimeException(sprintf( + 'Unable to open "%s" using mode "%s": %s', + $filename, + $mode, + $errstr + )); + + return true; + }); + + try { + /** @var resource $handle */ + $handle = fopen($filename, $mode); + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf( + 'Unable to open "%s" using mode "%s": %s', + $filename, + $mode, + $e->getMessage() + ), 0, $e); + } + + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; + } + + /** + * Safely gets the contents of a given stream. + * + * When stream_get_contents fails, PHP normally raises a warning. This + * function adds an error handler that checks for errors and throws an + * exception instead. + * + * @param resource $stream + * + * @throws \RuntimeException if the stream cannot be read + */ + public static function tryGetContents($stream): string + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use (&$ex): bool { + $ex = new \RuntimeException(sprintf( + 'Unable to read stream contents: %s', + $errstr + )); + + return true; + }); + + try { + /** @var string|false $contents */ + $contents = stream_get_contents($stream); + + if ($contents === false) { + $ex = new \RuntimeException('Unable to read stream contents'); + } + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf( + 'Unable to read stream contents: %s', + $e->getMessage() + ), 0, $e); + } + + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $contents; + } + + /** + * Returns a UriInterface for the given value. + * + * This function accepts a string or UriInterface and returns a + * UriInterface for the given value. If the value is already a + * UriInterface, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @throws \InvalidArgumentException + */ + public static function uriFor($uri): UriInterface + { + if ($uri instanceof UriInterface) { + return $uri; + } + + if (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/AppendStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/AppendStreamTest.php new file mode 100644 index 0000000000..302470a20d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/AppendStreamTest.php @@ -0,0 +1,221 @@ +createMock(StreamInterface::class); + $s->expects(self::once()) + ->method('isReadable') + ->willReturn(false); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Each stream must be readable'); + $a->addStream($s); + } + + public function testValidatesSeekType(): void + { + $a = new AppendStream(); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('The AppendStream can only seek with SEEK_SET'); + $a->seek(100, SEEK_CUR); + } + + public function testTriesToRewindOnSeek(): void + { + $a = new AppendStream(); + $s = $this->createMock(StreamInterface::class); + $s->expects(self::once()) + ->method('isReadable') + ->willReturn(true); + $s->expects(self::once()) + ->method('isSeekable') + ->willReturn(true); + $s->expects(self::once()) + ->method('rewind') + ->willThrowException(new \RuntimeException()); + $a->addStream($s); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to seek stream 0 of the AppendStream'); + $a->seek(10); + } + + public function testSeeksToPositionByReading(): void + { + $a = new AppendStream([ + Psr7\Utils::streamFor('foo'), + Psr7\Utils::streamFor('bar'), + Psr7\Utils::streamFor('baz'), + ]); + + $a->seek(3); + self::assertSame(3, $a->tell()); + self::assertSame('bar', $a->read(3)); + + $a->seek(6); + self::assertSame(6, $a->tell()); + self::assertSame('baz', $a->read(3)); + } + + public function testDetachWithoutStreams(): void + { + $s = new AppendStream(); + $s->detach(); + + self::assertSame(0, $s->getSize()); + self::assertTrue($s->eof()); + self::assertTrue($s->isReadable()); + self::assertSame('', (string) $s); + self::assertTrue($s->isSeekable()); + self::assertFalse($s->isWritable()); + } + + public function testDetachesEachStream(): void + { + $handle = fopen('php://temp', 'r'); + + $s1 = Psr7\Utils::streamFor($handle); + $s2 = Psr7\Utils::streamFor('bar'); + $a = new AppendStream([$s1, $s2]); + + $a->detach(); + + self::assertSame(0, $a->getSize()); + self::assertTrue($a->eof()); + self::assertTrue($a->isReadable()); + self::assertSame('', (string) $a); + self::assertTrue($a->isSeekable()); + self::assertFalse($a->isWritable()); + + self::assertNull($s1->detach()); + self::assertIsResource($handle, 'resource is not closed when detaching'); + fclose($handle); + } + + public function testClosesEachStream(): void + { + $handle = fopen('php://temp', 'r'); + + $s1 = Psr7\Utils::streamFor($handle); + $s2 = Psr7\Utils::streamFor('bar'); + $a = new AppendStream([$s1, $s2]); + + $a->close(); + + self::assertSame(0, $a->getSize()); + self::assertTrue($a->eof()); + self::assertTrue($a->isReadable()); + self::assertSame('', (string) $a); + self::assertTrue($a->isSeekable()); + self::assertFalse($a->isWritable()); + + self::assertFalse(is_resource($handle)); + } + + public function testIsNotWritable(): void + { + $a = new AppendStream([Psr7\Utils::streamFor('foo')]); + self::assertFalse($a->isWritable()); + self::assertTrue($a->isSeekable()); + self::assertTrue($a->isReadable()); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Cannot write to an AppendStream'); + $a->write('foo'); + } + + public function testDoesNotNeedStreams(): void + { + $a = new AppendStream(); + self::assertSame('', (string) $a); + } + + public function testCanReadFromMultipleStreams(): void + { + $a = new AppendStream([ + Psr7\Utils::streamFor('foo'), + Psr7\Utils::streamFor('bar'), + Psr7\Utils::streamFor('baz'), + ]); + self::assertFalse($a->eof()); + self::assertSame(0, $a->tell()); + self::assertSame('foo', $a->read(3)); + self::assertSame('bar', $a->read(3)); + self::assertSame('baz', $a->read(3)); + self::assertSame('', $a->read(1)); + self::assertTrue($a->eof()); + self::assertSame(9, $a->tell()); + self::assertSame('foobarbaz', (string) $a); + } + + public function testCanDetermineSizeFromMultipleStreams(): void + { + $a = new AppendStream([ + Psr7\Utils::streamFor('foo'), + Psr7\Utils::streamFor('bar'), + ]); + self::assertSame(6, $a->getSize()); + + $s = $this->createMock(StreamInterface::class); + $s->expects(self::once()) + ->method('isSeekable') + ->willReturn(false); + $s->expects(self::once()) + ->method('isReadable') + ->willReturn(true); + $a->addStream($s); + self::assertNull($a->getSize()); + } + + /** + * @requires PHP < 7.4 + */ + public function testCatchesExceptionsWhenCastingToString(): void + { + $s = $this->createMock(StreamInterface::class); + $s->expects(self::once()) + ->method('isSeekable') + ->willReturn(true); + $s->expects(self::once()) + ->method('read') + ->willThrowException(new \RuntimeException('foo')); + $s->expects(self::once()) + ->method('isReadable') + ->willReturn(true); + $s->expects(self::any()) + ->method('eof') + ->willReturn(false); + $a = new AppendStream([$s]); + self::assertFalse($a->eof()); + + $errors = []; + set_error_handler(static function (int $errorNumber, string $errorMessage) use (&$errors): bool { + $errors[] = ['number' => $errorNumber, 'message' => $errorMessage]; + + return true; + }); + (string) $a; + + restore_error_handler(); + + self::assertCount(1, $errors); + self::assertSame(E_USER_ERROR, $errors[0]['number']); + self::assertStringStartsWith('GuzzleHttp\Psr7\AppendStream::__toString exception:', $errors[0]['message']); + } + + public function testReturnsEmptyMetadata(): void + { + $s = new AppendStream(); + self::assertSame([], $s->getMetadata()); + self::assertNull($s->getMetadata('foo')); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/BufferStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/BufferStreamTest.php new file mode 100644 index 0000000000..987f294730 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/BufferStreamTest.php @@ -0,0 +1,65 @@ +isReadable()); + self::assertTrue($b->isWritable()); + self::assertFalse($b->isSeekable()); + self::assertNull($b->getMetadata('foo')); + self::assertSame(10, $b->getMetadata('hwm')); + self::assertSame([], $b->getMetadata()); + } + + public function testRemovesReadDataFromBuffer(): void + { + $b = new BufferStream(); + self::assertSame(3, $b->write('foo')); + self::assertSame(3, $b->getSize()); + self::assertFalse($b->eof()); + self::assertSame('foo', $b->read(10)); + self::assertTrue($b->eof()); + self::assertSame('', $b->read(10)); + } + + public function testCanCastToStringOrGetContents(): void + { + $b = new BufferStream(); + $b->write('foo'); + $b->write('baz'); + self::assertSame('foo', $b->read(3)); + $b->write('bar'); + self::assertSame('bazbar', (string) $b); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Cannot determine the position of a BufferStream'); + $b->tell(); + } + + public function testDetachClearsBuffer(): void + { + $b = new BufferStream(); + $b->write('foo'); + $b->detach(); + self::assertTrue($b->eof()); + self::assertSame(3, $b->write('abc')); + self::assertSame('abc', $b->read(10)); + } + + public function testExceedingHighwaterMarkReturnsFalseButStillBuffers(): void + { + $b = new BufferStream(5); + self::assertSame(3, $b->write('hi ')); + self::assertSame(0, $b->write('hello')); + self::assertSame('hi hello', (string) $b); + self::assertSame(4, $b->write('test')); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/CachingStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/CachingStreamTest.php new file mode 100644 index 0000000000..f7af1b7ef0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/CachingStreamTest.php @@ -0,0 +1,200 @@ +decorated = Psr7\Utils::streamFor('testing'); + $this->body = new CachingStream($this->decorated); + } + + protected function tearDown(): void + { + $this->decorated->close(); + $this->body->close(); + } + + public function testUsesRemoteSizeIfAvailable(): void + { + $body = Psr7\Utils::streamFor('test'); + $caching = new CachingStream($body); + self::assertSame(4, $caching->getSize()); + } + + public function testUsesRemoteSizeIfNotAvailable(): void + { + $body = new Psr7\PumpStream(function () { + return 'a'; + }); + $caching = new CachingStream($body); + self::assertNull($caching->getSize()); + } + + public function testReadsUntilCachedToByte(): void + { + $this->body->seek(5); + self::assertSame('n', $this->body->read(1)); + $this->body->seek(0); + self::assertSame('t', $this->body->read(1)); + } + + public function testCanSeekNearEndWithSeekEnd(): void + { + $baseStream = Psr7\Utils::streamFor(implode('', range('a', 'z'))); + $cached = new CachingStream($baseStream); + $cached->seek(-1, SEEK_END); + self::assertSame(25, $baseStream->tell()); + self::assertSame('z', $cached->read(1)); + self::assertSame(26, $cached->getSize()); + } + + public function testCanSeekToEndWithSeekEnd(): void + { + $baseStream = Psr7\Utils::streamFor(implode('', range('a', 'z'))); + $cached = new CachingStream($baseStream); + $cached->seek(0, SEEK_END); + self::assertSame(26, $baseStream->tell()); + self::assertSame('', $cached->read(1)); + self::assertSame(26, $cached->getSize()); + } + + public function testCanUseSeekEndWithUnknownSize(): void + { + $baseStream = Psr7\Utils::streamFor('testing'); + $decorated = Psr7\FnStream::decorate($baseStream, [ + 'getSize' => function () { + return null; + }, + ]); + $cached = new CachingStream($decorated); + $cached->seek(-1, SEEK_END); + self::assertSame('g', $cached->read(1)); + } + + public function testRewind(): void + { + $a = Psr7\Utils::streamFor('foo'); + $d = new CachingStream($a); + self::assertSame('foo', $d->read(3)); + $d->rewind(); + self::assertSame('foo', $d->read(3)); + } + + public function testCanSeekToReadBytes(): void + { + self::assertSame('te', $this->body->read(2)); + $this->body->seek(0); + self::assertSame('test', $this->body->read(4)); + self::assertSame(4, $this->body->tell()); + $this->body->seek(2); + self::assertSame(2, $this->body->tell()); + $this->body->seek(2, SEEK_CUR); + self::assertSame(4, $this->body->tell()); + self::assertSame('ing', $this->body->read(3)); + } + + public function testCanSeekToReadBytesWithPartialBodyReturned(): void + { + $stream = fopen('php://temp', 'r+'); + fwrite($stream, 'testing'); + fseek($stream, 0); + + $this->decorated = $this->getMockBuilder(Stream::class) + ->setConstructorArgs([$stream]) + ->onlyMethods(['read']) + ->getMock(); + + $this->decorated->expects(self::exactly(2)) + ->method('read') + ->willReturnCallback(function (int $length) use ($stream) { + return fread($stream, 2); + }); + + $this->body = new CachingStream($this->decorated); + + self::assertSame(0, $this->body->tell()); + $this->body->seek(4, SEEK_SET); + self::assertSame(4, $this->body->tell()); + + $this->body->seek(0); + self::assertSame('test', $this->body->read(4)); + } + + public function testWritesToBufferStream(): void + { + $this->body->read(2); + $this->body->write('hi'); + $this->body->seek(0); + self::assertSame('tehiing', (string) $this->body); + } + + public function testSkipsOverwrittenBytes(): void + { + $decorated = Psr7\Utils::streamFor( + implode("\n", array_map(function ($n) { + return str_pad((string) $n, 4, '0', STR_PAD_LEFT); + }, range(0, 25))) + ); + + $body = new CachingStream($decorated); + + self::assertSame("0000\n", Psr7\Utils::readLine($body)); + self::assertSame("0001\n", Psr7\Utils::readLine($body)); + // Write over part of the body yet to be read, so skip some bytes + self::assertSame(5, $body->write("TEST\n")); + // Read, which skips bytes, then reads + self::assertSame("0003\n", Psr7\Utils::readLine($body)); + self::assertSame("0004\n", Psr7\Utils::readLine($body)); + self::assertSame("0005\n", Psr7\Utils::readLine($body)); + + // Overwrite part of the cached body (so don't skip any bytes) + $body->seek(5); + self::assertSame(5, $body->write("ABCD\n")); + self::assertSame("TEST\n", Psr7\Utils::readLine($body)); + self::assertSame("0003\n", Psr7\Utils::readLine($body)); + self::assertSame("0004\n", Psr7\Utils::readLine($body)); + self::assertSame("0005\n", Psr7\Utils::readLine($body)); + self::assertSame("0006\n", Psr7\Utils::readLine($body)); + self::assertSame(5, $body->write("1234\n")); + + // Seek to 0 and ensure the overwritten bit is replaced + $body->seek(0); + self::assertSame("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", $body->read(50)); + + // Ensure that casting it to a string does not include the bit that was overwritten + self::assertStringContainsString("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", (string) $body); + } + + public function testClosesBothStreams(): void + { + $s = fopen('php://temp', 'r'); + $a = Psr7\Utils::streamFor($s); + $d = new CachingStream($a); + $d->close(); + self::assertFalse(is_resource($s)); + } + + public function testEnsuresValidWhence(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid whence'); + $this->body->seek(10, -123456); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/DroppingStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/DroppingStreamTest.php new file mode 100644 index 0000000000..d70bc9cb83 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/DroppingStreamTest.php @@ -0,0 +1,30 @@ +write('hel')); + self::assertSame(2, $drop->write('lo')); + self::assertSame(5, $drop->getSize()); + self::assertSame('hello', $drop->read(5)); + self::assertSame(0, $drop->getSize()); + $drop->write('12345678910'); + self::assertSame(5, $stream->getSize()); + self::assertSame(5, $drop->getSize()); + self::assertSame('12345', (string) $drop); + self::assertSame(0, $drop->getSize()); + $drop->write('hello'); + self::assertSame(0, $drop->write('test')); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/FnStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/FnStreamTest.php new file mode 100644 index 0000000000..33651acdbb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/FnStreamTest.php @@ -0,0 +1,128 @@ +expectException(\BadMethodCallException::class); + $this->expectExceptionMessage('seek() is not implemented in the FnStream'); + (new FnStream([]))->seek(1); + } + + public function testProxiesToFunction(): void + { + $s = new FnStream([ + 'read' => function ($len) { + $this->assertSame(3, $len); + + return 'foo'; + }, + ]); + + self::assertSame('foo', $s->read(3)); + } + + public function testCanCloseOnDestruct(): void + { + $called = false; + $s = new FnStream([ + 'close' => function () use (&$called): void { + $called = true; + }, + ]); + unset($s); + self::assertTrue($called); + } + + public function testDoesNotRequireClose(): void + { + $s = new FnStream([]); + unset($s); + self::assertTrue(true); // strict mode requires an assertion + } + + public function testDecoratesStream(): void + { + $a = Psr7\Utils::streamFor('foo'); + $b = FnStream::decorate($a, []); + self::assertSame(3, $b->getSize()); + self::assertSame($b->isWritable(), true); + self::assertSame($b->isReadable(), true); + self::assertSame($b->isSeekable(), true); + self::assertSame($b->read(3), 'foo'); + self::assertSame($b->tell(), 3); + self::assertSame($a->tell(), 3); + self::assertSame('', $a->read(1)); + self::assertSame($b->eof(), true); + self::assertSame($a->eof(), true); + $b->seek(0); + self::assertSame('foo', (string) $b); + $b->seek(0); + self::assertSame('foo', $b->getContents()); + self::assertSame($a->getMetadata(), $b->getMetadata()); + $b->seek(0, SEEK_END); + $b->write('bar'); + self::assertSame('foobar', (string) $b); + self::assertIsResource($b->detach()); + $b->close(); + } + + public function testDecoratesWithCustomizations(): void + { + $called = false; + $a = Psr7\Utils::streamFor('foo'); + $b = FnStream::decorate($a, [ + 'read' => function ($len) use (&$called, $a) { + $called = true; + + return $a->read($len); + }, + ]); + self::assertSame('foo', $b->read(3)); + self::assertTrue($called); + } + + public function testDoNotAllowUnserialization(): void + { + $a = new FnStream([]); + $b = serialize($a); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('FnStream should never be unserialized'); + unserialize($b); + } + + /** + * @requires PHP < 7.4 + */ + public function testThatConvertingStreamToStringWillTriggerErrorAndWillReturnEmptyString(): void + { + $a = new FnStream([ + '__toString' => function (): void { + throw new \Exception(); + }, + ]); + + $errors = []; + set_error_handler(function (int $errorNumber, string $errorMessage) use (&$errors): void { + $errors[] = ['number' => $errorNumber, 'message' => $errorMessage]; + }); + (string) $a; + + restore_error_handler(); + + self::assertCount(1, $errors); + self::assertSame(E_USER_ERROR, $errors[0]['number']); + self::assertStringStartsWith('GuzzleHttp\Psr7\FnStream::__toString exception:', $errors[0]['message']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/HasToString.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/HasToString.php new file mode 100644 index 0000000000..bcc503bd3c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/HasToString.php @@ -0,0 +1,13 @@ +', + 'rel' => 'front', + 'type' => 'image/jpeg', + ], + [ + '', + 'rel' => 'back', + 'type' => 'image/jpeg', + ], + ]; + + return [ + [ + '; rel="front"; type="image/jpeg", ; rel=back; type="image/jpeg"', + $res1, + ], + [ + '; rel="front"; type="image/jpeg",; rel=back; type="image/jpeg"', + $res1, + ], + [ + 'foo="baz"; bar=123, boo, test="123", foobar="foo;bar"', + [ + ['foo' => 'baz', 'bar' => '123'], + ['boo'], + ['test' => '123'], + ['foobar' => 'foo;bar'], + ], + ], + [ + '; rel="side"; type="image/jpeg",; rel=side; type="image/jpeg"', + [ + ['', 'rel' => 'side', 'type' => 'image/jpeg'], + ['', 'rel' => 'side', 'type' => 'image/jpeg'], + ], + ], + [ + '', + [], + ], + ]; + } + + /** + * @dataProvider parseParamsProvider + */ + public function testParseParams($header, $result): void + { + self::assertSame($result, Psr7\Header::parse($header)); + } + + public function normalizeProvider(): array + { + return [ + [ + '', + [], + ], + [ + ['a, b', 'c', 'd, e'], + ['a', 'b', 'c', 'd', 'e'], + ], + // Example 'accept-encoding' + [ + 'gzip, br', + ['gzip', 'br'], + ], + // https://httpwg.org/specs/rfc7231.html#rfc.section.5.3.2 + [ + 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c', + ['text/plain; q=0.5', 'text/html', 'text/x-dvi; q=0.8', 'text/x-c'], + ], + // Example 'If-None-Match' with comma within an ETag + [ + '"foo", "foo,bar", "bar"', + ['"foo"', '"foo,bar"', '"bar"'], + ], + // https://httpwg.org/specs/rfc7234.html#cache.control.extensions + [ + 'private, community="UCI"', + ['private', 'community="UCI"'], + ], + // The Cache-Control example with a comma within a community + [ + 'private, community="Guzzle,Psr7"', + ['private', 'community="Guzzle,Psr7"'], + ], + // The Cache-Control example with an escaped space (quoted-pair) within a community + [ + 'private, community="Guzzle\\ Psr7"', + ['private', 'community="Guzzle\\ Psr7"'], + ], + // The Cache-Control example with an escaped quote (quoted-pair) within a community + [ + 'private, community="Guzzle\\"Psr7"', + ['private', 'community="Guzzle\\"Psr7"'], + ], + // The Cache-Control example with an escaped quote (quoted-pair) and a comma within a community + [ + 'private, community="Guzzle\\",Psr7"', + ['private', 'community="Guzzle\\",Psr7"'], + ], + // The Cache-Control example with an escaped backslash (quoted-pair) within a community + [ + 'private, community="Guzzle\\\\Psr7"', + ['private', 'community="Guzzle\\\\Psr7"'], + ], + // The Cache-Control example with an escaped backslash (quoted-pair) within a community + [ + 'private, community="Guzzle\\\\", Psr7', + ['private', 'community="Guzzle\\\\"', 'Psr7'], + ], + // https://httpwg.org/specs/rfc7230.html#rfc.section.7 + [ + 'foo ,bar,', + ['foo', 'bar'], + ], + // https://httpwg.org/specs/rfc7230.html#rfc.section.7 + [ + 'foo , ,bar,charlie ', + ['foo', 'bar', 'charlie'], + ], + [ + "; rel=\"first\",\n; rel=\"next\",\n; rel=\"prev\",\n; rel=\"last\",", + ['; rel="first"', '; rel="next"', '; rel="prev"', '; rel="last"'], + ], + ]; + } + + /** + * @dataProvider normalizeProvider + */ + public function testNormalize($header, $result): void + { + self::assertSame($result, Psr7\Header::normalize([$header])); + self::assertSame($result, Psr7\Header::normalize($header)); + } + + /** + * @dataProvider normalizeProvider + */ + public function testSplitList($header, $result): void + { + self::assertSame($result, Psr7\Header::splitList($header)); + } + + public function testSplitListRejectsNestedArrays(): void + { + $this->expectException(\TypeError::class); + + Psr7\Header::splitList([['foo']]); + } + + public function testSplitListArrayContainingNonStrings(): void + { + $this->expectException(\TypeError::class); + + Psr7\Header::splitList(['foo', 'bar', 1, false]); + } + + public function testSplitListRejectsNonStrings(): void + { + $this->expectException(\TypeError::class); + + Psr7\Header::splitList(false); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/InflateStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/InflateStreamTest.php new file mode 100644 index 0000000000..9821efb015 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/InflateStreamTest.php @@ -0,0 +1,97 @@ +getGzipStringWithFilename('test'); + $a = Psr7\Utils::streamFor($content); + $b = new InflateStream($a); + self::assertSame('test', (string) $b); + } + + public function testInflatesRfc1950Streams(): void + { + $content = gzcompress('test'); + $a = Psr7\Utils::streamFor($content); + $b = new InflateStream($a); + self::assertSame('test', (string) $b); + } + + public function testInflatesRfc1952StreamsWithExtraFlags(): void + { + $content = gzdeflate('test'); // RFC 1951. Raw deflate. No header. + + // +---+---+---+---+---+---+---+---+---+---+ + // |ID1|ID2|CM |FLG| MTIME |XFL|OS | (more-->) + // +---+---+---+---+---+---+---+---+---+---+ + $header = "\x1f\x8B\x08"; + // set flags FHCRC, FEXTRA, FNAME and FCOMMENT + $header .= chr(0b00011110); + $header .= "\x00\x00\x00\x00"; // MTIME + $header .= "\x02\x03"; // XFL, OS + // 4 byte extra data + $header .= "\x04\x00\x41\x70\x00\x00"; /* XLEN + EXTRA */ + // file name (2 bytes + terminator) + $header .= "\x41\x70\x00"; + // file comment (3 bytes + terminator) + $header .= "\x41\x42\x43\x00"; + + // crc16 + $header .= pack('v', crc32($header)); + + $a = Psr7\Utils::streamFor($header.$content); + $b = new InflateStream($a); + self::assertSame('test', (string) $b); + } + + public function testInflatesStreamsPreserveSeekable(): void + { + $content = gzencode('test'); + $seekable = Psr7\Utils::streamFor($content); + + $seekableInflate = new InflateStream($seekable); + self::assertTrue($seekableInflate->isSeekable()); + self::assertSame('test', (string) $seekableInflate); + + $nonSeekable = new NoSeekStream(Psr7\Utils::streamFor($content)); + $nonSeekableInflate = new InflateStream($nonSeekable); + self::assertFalse($nonSeekableInflate->isSeekable()); + self::assertSame('test', (string) $nonSeekableInflate); + } + + private function getGzipStringWithFilename($original_string) + { + $gzipped = bin2hex(gzencode($original_string)); + + $header = substr($gzipped, 0, 20); + // set FNAME flag + $header[6] = 0; + $header[7] = 8; + // make a dummy filename + $filename = '64756d6d7900'; + $rest = substr($gzipped, 20); + + return hex2bin($header.$filename.$rest); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/ServerRequestFromGlobalsTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/ServerRequestFromGlobalsTest.php new file mode 100644 index 0000000000..e36a3fc516 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/ServerRequestFromGlobalsTest.php @@ -0,0 +1,44 @@ +getServerUri()) { + self::markTestSkipped(); + } + parent::setUp(); + } + + public function testBodyExists(): void + { + $curl = curl_init(); + + curl_setopt($curl, CURLOPT_URL, $this->getServerUri()); + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, 'foobar'); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($curl); + curl_close($curl); + + self::assertNotFalse($response); + $data = json_decode($response, true); + self::assertIsArray($data); + self::assertArrayHasKey('method', $data); + self::assertArrayHasKey('uri', $data); + self::assertArrayHasKey('body', $data); + + self::assertEquals('foobar', $data['body']); + } + + private function getServerUri() + { + return $_SERVER['TEST_SERVER'] ?? false; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/server.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/server.php new file mode 100644 index 0000000000..6d7edbfcc7 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/Integration/server.php @@ -0,0 +1,15 @@ + $request->getMethod(), + 'uri' => $request->getUri()->__toString(), + 'body' => $request->getBody()->__toString(), +]; + +echo json_encode($output); diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LazyOpenStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LazyOpenStreamTest.php new file mode 100644 index 0000000000..2f84870839 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LazyOpenStreamTest.php @@ -0,0 +1,68 @@ +fname = tempnam(sys_get_temp_dir(), 'tfile'); + + if (file_exists($this->fname)) { + unlink($this->fname); + } + } + + protected function tearDown(): void + { + if (file_exists($this->fname)) { + unlink($this->fname); + } + } + + public function testOpensLazily(): void + { + $l = new LazyOpenStream($this->fname, 'w+'); + $l->write('foo'); + self::assertIsArray($l->getMetadata()); + self::assertFileExists($this->fname); + self::assertSame('foo', file_get_contents($this->fname)); + self::assertSame('foo', (string) $l); + } + + public function testProxiesToFile(): void + { + file_put_contents($this->fname, 'foo'); + $l = new LazyOpenStream($this->fname, 'r'); + self::assertSame('foo', $l->read(4)); + self::assertTrue($l->eof()); + self::assertSame(3, $l->tell()); + self::assertTrue($l->isReadable()); + self::assertTrue($l->isSeekable()); + self::assertFalse($l->isWritable()); + $l->seek(1); + self::assertSame('oo', $l->getContents()); + self::assertSame('foo', (string) $l); + self::assertSame(3, $l->getSize()); + self::assertIsArray($l->getMetadata()); + $l->close(); + } + + public function testDetachesUnderlyingStream(): void + { + file_put_contents($this->fname, 'foo'); + $l = new LazyOpenStream($this->fname, 'r'); + $r = $l->detach(); + self::assertIsResource($r); + fseek($r, 0); + self::assertSame('foo', stream_get_contents($r)); + fclose($r); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LimitStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LimitStreamTest.php new file mode 100644 index 0000000000..179f71bd1d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/LimitStreamTest.php @@ -0,0 +1,165 @@ +decorated = Psr7\Utils::streamFor(fopen(__FILE__, 'r')); + $this->body = new LimitStream($this->decorated, 10, 3); + } + + public function testReturnsSubset(): void + { + $body = new LimitStream(Psr7\Utils::streamFor('foo'), -1, 1); + self::assertSame('oo', (string) $body); + self::assertTrue($body->eof()); + $body->seek(0); + self::assertFalse($body->eof()); + self::assertSame('oo', $body->read(100)); + self::assertSame('', $body->read(1)); + self::assertTrue($body->eof()); + } + + public function testReturnsSubsetWhenCastToString(): void + { + $body = Psr7\Utils::streamFor('foo_baz_bar'); + $limited = new LimitStream($body, 3, 4); + self::assertSame('baz', (string) $limited); + } + + public function testReturnsSubsetOfEmptyBodyWhenCastToString(): void + { + $body = Psr7\Utils::streamFor('01234567891234'); + $limited = new LimitStream($body, 0, 10); + self::assertSame('', (string) $limited); + } + + public function testReturnsSpecificSubsetOBodyWhenCastToString(): void + { + $body = Psr7\Utils::streamFor('0123456789abcdef'); + $limited = new LimitStream($body, 3, 10); + self::assertSame('abc', (string) $limited); + } + + public function testSeeksWhenConstructed(): void + { + self::assertSame(0, $this->body->tell()); + self::assertSame(3, $this->decorated->tell()); + } + + public function testAllowsBoundedSeek(): void + { + $this->body->seek(100); + self::assertSame(10, $this->body->tell()); + self::assertSame(13, $this->decorated->tell()); + $this->body->seek(0); + self::assertSame(0, $this->body->tell()); + self::assertSame(3, $this->decorated->tell()); + try { + $this->body->seek(-10); + self::fail(); + } catch (\RuntimeException $e) { + } + self::assertSame(0, $this->body->tell()); + self::assertSame(3, $this->decorated->tell()); + $this->body->seek(5); + self::assertSame(5, $this->body->tell()); + self::assertSame(8, $this->decorated->tell()); + // Fail + try { + $this->body->seek(1000, SEEK_END); + self::fail(); + } catch (\RuntimeException $e) { + } + } + + public function testReadsOnlySubsetOfData(): void + { + $data = $this->body->read(100); + self::assertSame(10, strlen($data)); + self::assertSame('', $this->body->read(1000)); + + $this->body->setOffset(10); + $newData = $this->body->read(100); + self::assertSame(10, strlen($newData)); + self::assertNotSame($data, $newData); + } + + public function testThrowsWhenCurrentGreaterThanOffsetSeek(): void + { + $a = Psr7\Utils::streamFor('foo_bar'); + $b = new NoSeekStream($a); + $c = new LimitStream($b); + $a->getContents(); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Could not seek to stream offset 2'); + $c->setOffset(2); + } + + public function testCanGetContentsWithoutSeeking(): void + { + $a = Psr7\Utils::streamFor('foo_bar'); + $b = new NoSeekStream($a); + $c = new LimitStream($b); + self::assertSame('foo_bar', $c->getContents()); + } + + public function testClaimsConsumedWhenReadLimitIsReached(): void + { + self::assertFalse($this->body->eof()); + $this->body->read(1000); + self::assertTrue($this->body->eof()); + } + + public function testContentLengthIsBounded(): void + { + self::assertSame(10, $this->body->getSize()); + } + + public function testGetContentsIsBasedOnSubset(): void + { + $body = new LimitStream(Psr7\Utils::streamFor('foobazbar'), 3, 3); + self::assertSame('baz', $body->getContents()); + } + + public function testReturnsNullIfSizeCannotBeDetermined(): void + { + $a = new FnStream([ + 'getSize' => function () { + return null; + }, + 'tell' => function () { + return 0; + }, + ]); + $b = new LimitStream($a); + self::assertNull($b->getSize()); + } + + public function testLengthLessOffsetWhenNoLimitSize(): void + { + $a = Psr7\Utils::streamFor('foo_bar'); + $b = new LimitStream($a, -1, 4); + self::assertSame(3, $b->getSize()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MessageTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MessageTest.php new file mode 100644 index 0000000000..1a43152dda --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MessageTest.php @@ -0,0 +1,299 @@ + 'bar', + 'Qux' => 'ipsum', + ], 'hello', '1.0'); + self::assertSame( + "PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello", + Psr7\Message::toString($request) + ); + } + + public function testConvertsResponsesToStrings(): void + { + $response = new Psr7\Response(200, [ + 'Baz' => 'bar', + 'Qux' => 'ipsum', + ], 'hello', '1.0', 'FOO'); + self::assertSame( + "HTTP/1.0 200 FOO\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello", + Psr7\Message::toString($response) + ); + } + + public function testCorrectlyRendersSetCookieHeadersToString(): void + { + $response = new Psr7\Response(200, [ + 'Set-Cookie' => ['bar', 'baz', 'qux'], + ], 'hello', '1.0', 'FOO'); + self::assertSame( + "HTTP/1.0 200 FOO\r\nSet-Cookie: bar\r\nSet-Cookie: baz\r\nSet-Cookie: qux\r\n\r\nhello", + Psr7\Message::toString($response) + ); + } + + public function testRewindsBody(): void + { + $body = Psr7\Utils::streamFor('abc'); + $res = new Psr7\Response(200, [], $body); + Psr7\Message::rewindBody($res); + self::assertSame(0, $body->tell()); + $body->rewind(); + Psr7\Message::rewindBody($res); + self::assertSame(0, $body->tell()); + } + + public function testThrowsWhenBodyCannotBeRewound(): void + { + $body = Psr7\Utils::streamFor('abc'); + $body->read(1); + $body = FnStream::decorate($body, [ + 'rewind' => function (): void { + throw new \RuntimeException('a'); + }, + ]); + $res = new Psr7\Response(200, [], $body); + + $this->expectException(\RuntimeException::class); + + Psr7\Message::rewindBody($res); + } + + public function testParsesRequestMessages(): void + { + $req = "GET /abc HTTP/1.0\r\nHost: foo.com\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('GET', $request->getMethod()); + self::assertSame('/abc', $request->getRequestTarget()); + self::assertSame('1.0', $request->getProtocolVersion()); + self::assertSame('foo.com', $request->getHeaderLine('Host')); + self::assertSame('Bar', $request->getHeaderLine('Foo')); + self::assertSame('Bam, Qux', $request->getHeaderLine('Baz')); + self::assertSame('Test', (string) $request->getBody()); + self::assertSame('http://foo.com/abc', (string) $request->getUri()); + } + + public function testParsesRequestMessagesWithHttpsScheme(): void + { + $req = "PUT /abc?baz=bar HTTP/1.1\r\nHost: foo.com:443\r\n\r\n"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('PUT', $request->getMethod()); + self::assertSame('/abc?baz=bar', $request->getRequestTarget()); + self::assertSame('1.1', $request->getProtocolVersion()); + self::assertSame('foo.com:443', $request->getHeaderLine('Host')); + self::assertSame('', (string) $request->getBody()); + self::assertSame('https://foo.com/abc?baz=bar', (string) $request->getUri()); + } + + public function testParsesRequestMessagesWithUriWhenHostIsNotFirst(): void + { + $req = "PUT / HTTP/1.1\r\nFoo: Bar\r\nHost: foo.com\r\n\r\n"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('PUT', $request->getMethod()); + self::assertSame('/', $request->getRequestTarget()); + self::assertSame('http://foo.com/', (string) $request->getUri()); + } + + public function testParsesRequestMessagesWithFullUri(): void + { + $req = "GET https://www.google.com:443/search?q=foobar HTTP/1.1\r\nHost: www.google.com\r\n\r\n"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('GET', $request->getMethod()); + self::assertSame('https://www.google.com:443/search?q=foobar', $request->getRequestTarget()); + self::assertSame('1.1', $request->getProtocolVersion()); + self::assertSame('www.google.com', $request->getHeaderLine('Host')); + self::assertSame('', (string) $request->getBody()); + self::assertSame('https://www.google.com/search?q=foobar', (string) $request->getUri()); + } + + public function testParsesRequestMessagesWithCustomMethod(): void + { + $req = "GET_DATA / HTTP/1.1\r\nFoo: Bar\r\nHost: foo.com\r\n\r\n"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('GET_DATA', $request->getMethod()); + } + + public function testParsesRequestMessagesWithNumericHeader(): void + { + $req = "GET /abc HTTP/1.0\r\nHost: foo.com\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n123: 456\r\n\r\nTest"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('GET', $request->getMethod()); + self::assertSame('/abc', $request->getRequestTarget()); + self::assertSame('1.0', $request->getProtocolVersion()); + self::assertSame('foo.com', $request->getHeaderLine('Host')); + self::assertSame('Bar', $request->getHeaderLine('Foo')); + self::assertSame('Bam, Qux', $request->getHeaderLine('Baz')); + self::assertSame('456', $request->getHeaderLine('123')); + self::assertSame('Test', (string) $request->getBody()); + self::assertSame('http://foo.com/abc', (string) $request->getUri()); + } + + public function testParsesRequestMessagesWithFoldedHeadersOnHttp10(): void + { + $req = "PUT / HTTP/1.0\r\nFoo: Bar\r\n Bam\r\n\r\n"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('PUT', $request->getMethod()); + self::assertSame('/', $request->getRequestTarget()); + self::assertSame('Bar Bam', $request->getHeaderLine('Foo')); + } + + public function testRequestParsingFailsWithFoldedHeadersOnHttp11(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid header syntax: Obsolete line folding'); + + Psr7\Message::parseResponse("GET_DATA / HTTP/1.1\r\nFoo: Bar\r\n Biz: Bam\r\n\r\n"); + } + + public function testParsesRequestMessagesWhenHeaderDelimiterIsOnlyALineFeed(): void + { + $req = "PUT / HTTP/1.0\nFoo: Bar\nBaz: Bam\n\n"; + $request = Psr7\Message::parseRequest($req); + self::assertSame('PUT', $request->getMethod()); + self::assertSame('/', $request->getRequestTarget()); + self::assertSame('Bar', $request->getHeaderLine('Foo')); + self::assertSame('Bam', $request->getHeaderLine('Baz')); + } + + public function testValidatesRequestMessages(): void + { + $this->expectException(\InvalidArgumentException::class); + + Psr7\Message::parseRequest("HTTP/1.1 200 OK\r\n\r\n"); + } + + public function testParsesResponseMessages(): void + { + $res = "HTTP/1.0 200 OK\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest"; + $response = Psr7\Message::parseResponse($res); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('1.0', $response->getProtocolVersion()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('Bam, Qux', $response->getHeaderLine('Baz')); + self::assertSame('Test', (string) $response->getBody()); + } + + public function testParsesResponseWithoutReason(): void + { + $res = "HTTP/1.0 200\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest"; + $response = Psr7\Message::parseResponse($res); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('1.0', $response->getProtocolVersion()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('Bam, Qux', $response->getHeaderLine('Baz')); + self::assertSame('Test', (string) $response->getBody()); + } + + public function testParsesResponseWithLeadingDelimiter(): void + { + $res = "\r\nHTTP/1.0 200\r\nFoo: Bar\r\n\r\nTest"; + $response = Psr7\Message::parseResponse($res); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('1.0', $response->getProtocolVersion()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('Test', (string) $response->getBody()); + } + + public function testParsesResponseWithFoldedHeadersOnHttp10(): void + { + $res = "HTTP/1.0 200\r\nFoo: Bar\r\n Bam\r\n\r\nTest"; + $response = Psr7\Message::parseResponse($res); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('1.0', $response->getProtocolVersion()); + self::assertSame('Bar Bam', $response->getHeaderLine('Foo')); + self::assertSame('Test', (string) $response->getBody()); + } + + public function testResponseParsingFailsWithFoldedHeadersOnHttp11(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid header syntax: Obsolete line folding'); + Psr7\Message::parseResponse("HTTP/1.1 200\r\nFoo: Bar\r\n Biz: Bam\r\nBaz: Qux\r\n\r\nTest"); + } + + public function testParsesResponseWhenHeaderDelimiterIsOnlyALineFeed(): void + { + $res = "HTTP/1.0 200\nFoo: Bar\nBaz: Bam\n\nTest\n\nOtherTest"; + $response = Psr7\Message::parseResponse($res); + self::assertSame(200, $response->getStatusCode()); + self::assertSame('OK', $response->getReasonPhrase()); + self::assertSame('1.0', $response->getProtocolVersion()); + self::assertSame('Bar', $response->getHeaderLine('Foo')); + self::assertSame('Bam', $response->getHeaderLine('Baz')); + self::assertSame("Test\n\nOtherTest", (string) $response->getBody()); + } + + public function testResponseParsingFailsWithoutHeaderDelimiter(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid message: Missing header delimiter'); + Psr7\Message::parseResponse("HTTP/1.0 200\r\nFoo: Bar\r\n Baz: Bam\r\nBaz: Qux\r\n"); + } + + public function testValidatesResponseMessages(): void + { + $this->expectException(\InvalidArgumentException::class); + Psr7\Message::parseResponse("GET / HTTP/1.1\r\n\r\n"); + } + + public function testMessageBodySummaryWithSmallBody(): void + { + $message = new Psr7\Response(200, [], 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); + self::assertSame('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', Psr7\Message::bodySummary($message)); + } + + public function testMessageBodySummaryWithLargeBody(): void + { + $message = new Psr7\Response(200, [], 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); + self::assertSame('Lorem ipsu (truncated...)', Psr7\Message::bodySummary($message, 10)); + } + + public function testMessageBodySummaryWithSpecialUTF8Characters(): void + { + $message = new Psr7\Response(200, [], '’é€௵ဪ‱'); + self::assertSame('’é€௵ဪ‱', Psr7\Message::bodySummary($message)); + } + + public function testMessageBodySummaryWithSpecialUTF8CharactersAndLargeBody(): void + { + $message = new Psr7\Response(200, [], '🤦🏾‍♀️'); + // The first Unicode codepoint of the body has four bytes. + self::assertNull(Psr7\Message::bodySummary($message, 3)); + } + + public function testMessageBodySummaryWithEmptyBody(): void + { + $message = new Psr7\Response(200, [], ''); + self::assertNull(Psr7\Message::bodySummary($message)); + } + + public function testMessageBodySummaryNotInitiallyRewound(): void + { + $message = new Psr7\Response(200, [], 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); + $message->getBody()->read(10); + self::assertSame('Lorem ipsu (truncated...)', Psr7\Message::bodySummary($message, 10)); + } + + public function testGetResponseBodySummaryOfNonReadableStream(): void + { + $message = new Psr7\Response(500, [], new ReadSeekOnlyStream()); + self::assertNull(Psr7\Message::bodySummary($message)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MimeTypeTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MimeTypeTest.php new file mode 100644 index 0000000000..3eca5e58bc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/MimeTypeTest.php @@ -0,0 +1,25 @@ +getBoundary()); + } + + public function testCanProvideBoundary(): void + { + $b = new MultipartStream([], 'foo'); + self::assertSame('foo', $b->getBoundary()); + } + + public function testIsNotWritable(): void + { + $b = new MultipartStream(); + self::assertFalse($b->isWritable()); + } + + public function testCanCreateEmptyStream(): void + { + $b = new MultipartStream(); + $boundary = $b->getBoundary(); + self::assertSame("--{$boundary}--\r\n", $b->getContents()); + self::assertSame(strlen($boundary) + 6, $b->getSize()); + } + + public function testValidatesFilesArrayElement(): void + { + $this->expectException(\InvalidArgumentException::class); + new MultipartStream([['foo' => 'bar']]); + } + + public function testEnsuresFileHasName(): void + { + $this->expectException(\InvalidArgumentException::class); + new MultipartStream([['contents' => 'bar']]); + } + + public function testSerializesFields(): void + { + $b = new MultipartStream([ + [ + 'name' => 'foo', + 'contents' => 'bar', + ], + [ + 'name' => 'baz', + 'contents' => 'bam', + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "Content-Disposition: form-data; name=\"foo\"\r\n", + "Content-Length: 3\r\n", + "\r\n", + "bar\r\n", + "--boundary\r\n", + "Content-Disposition: form-data; name=\"baz\"\r\n", + "Content-Length: 3\r\n", + "\r\n", + "bam\r\n", + "--boundary--\r\n", + ]); + + self::assertSame($expected, (string) $b); + } + + public function testSerializesNonStringFields(): void + { + $b = new MultipartStream([ + [ + 'name' => 'int', + 'contents' => (int) 1, + ], + [ + 'name' => 'bool', + 'contents' => (bool) false, + ], + [ + 'name' => 'bool2', + 'contents' => (bool) true, + ], + [ + 'name' => 'float', + 'contents' => (float) 1.1, + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "Content-Disposition: form-data; name=\"int\"\r\n", + "Content-Length: 1\r\n", + "\r\n", + "1\r\n", + "--boundary\r\n", + "Content-Disposition: form-data; name=\"bool\"\r\n", + "\r\n", + "\r\n", + '--boundary', + "\r\n", + "Content-Disposition: form-data; name=\"bool2\"\r\n", + "Content-Length: 1\r\n", + "\r\n", + "1\r\n", + "--boundary\r\n", + "Content-Disposition: form-data; name=\"float\"\r\n", + "Content-Length: 3\r\n", + "\r\n", + "1.1\r\n", + "--boundary--\r\n", + '', + ]); + + self::assertSame($expected, (string) $b); + } + + public function testSerializesFiles(): void + { + $f1 = Psr7\FnStream::decorate(Psr7\Utils::streamFor('foo'), [ + 'getMetadata' => static function (): string { + return '/foo/bar.txt'; + }, + ]); + + $f2 = Psr7\FnStream::decorate(Psr7\Utils::streamFor('baz'), [ + 'getMetadata' => static function (): string { + return '/foo/baz.jpg'; + }, + ]); + + $f3 = Psr7\FnStream::decorate(Psr7\Utils::streamFor('bar'), [ + 'getMetadata' => static function (): string { + return '/foo/bar.unknown'; + }, + ]); + + $b = new MultipartStream([ + [ + 'name' => 'foo', + 'contents' => $f1, + ], + [ + 'name' => 'qux', + 'contents' => $f2, + ], + [ + 'name' => 'qux', + 'contents' => $f3, + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "Content-Disposition: form-data; name=\"foo\"; filename=\"bar.txt\"\r\n", + "Content-Length: 3\r\n", + "Content-Type: text/plain\r\n", + "\r\n", + "foo\r\n", + "--boundary\r\n", + "Content-Disposition: form-data; name=\"qux\"; filename=\"baz.jpg\"\r\n", + "Content-Length: 3\r\n", + "Content-Type: image/jpeg\r\n", + "\r\n", + "baz\r\n", + "--boundary\r\n", + "Content-Disposition: form-data; name=\"qux\"; filename=\"bar.unknown\"\r\n", + "Content-Length: 3\r\n", + "Content-Type: application/octet-stream\r\n", + "\r\n", + "bar\r\n", + "--boundary--\r\n", + ]); + + self::assertSame($expected, (string) $b); + } + + public function testSerializesFilesWithMixedNewlines(): void + { + $content = "LF\nCRLF\r\nCR\r"; + $contentLength = \strlen($content); + + $f1 = Psr7\FnStream::decorate(Psr7\Utils::streamFor($content), [ + 'getMetadata' => static function (): string { + return '/foo/newlines.txt'; + }, + ]); + + $b = new MultipartStream([ + [ + 'name' => 'newlines', + 'contents' => $f1, + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "Content-Disposition: form-data; name=\"newlines\"; filename=\"newlines.txt\"\r\n", + "Content-Length: {$contentLength}\r\n", + "Content-Type: text/plain\r\n", + "\r\n", + "{$content}\r\n", + "--boundary--\r\n", + ]); + + // Do not perform newline normalization in the assertion! The `$content` must + // be embedded as-is in the payload. + self::assertSame($expected, (string) $b); + } + + public function testSerializesFilesWithCustomHeaders(): void + { + $f1 = Psr7\FnStream::decorate(Psr7\Utils::streamFor('foo'), [ + 'getMetadata' => static function (): string { + return '/foo/bar.txt'; + }, + ]); + + $b = new MultipartStream([ + [ + 'name' => 'foo', + 'contents' => $f1, + 'headers' => [ + 'x-foo' => 'bar', + 'content-disposition' => 'custom', + ], + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "x-foo: bar\r\n", + "content-disposition: custom\r\n", + "Content-Length: 3\r\n", + "Content-Type: text/plain\r\n", + "\r\n", + "foo\r\n", + "--boundary--\r\n", + ]); + + self::assertSame($expected, (string) $b); + } + + public function testSerializesFilesWithCustomHeadersAndMultipleValues(): void + { + $f1 = Psr7\FnStream::decorate(Psr7\Utils::streamFor('foo'), [ + 'getMetadata' => static function (): string { + return '/foo/bar.txt'; + }, + ]); + + $f2 = Psr7\FnStream::decorate(Psr7\Utils::streamFor('baz'), [ + 'getMetadata' => static function (): string { + return '/foo/baz.jpg'; + }, + ]); + + $b = new MultipartStream([ + [ + 'name' => 'foo', + 'contents' => $f1, + 'headers' => [ + 'x-foo' => 'bar', + 'content-disposition' => 'custom', + ], + ], + [ + 'name' => 'foo', + 'contents' => $f2, + 'headers' => ['cOntenT-Type' => 'custom'], + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "x-foo: bar\r\n", + "content-disposition: custom\r\n", + "Content-Length: 3\r\n", + "Content-Type: text/plain\r\n", + "\r\n", + "foo\r\n", + "--boundary\r\n", + "cOntenT-Type: custom\r\n", + "Content-Disposition: form-data; name=\"foo\"; filename=\"baz.jpg\"\r\n", + "Content-Length: 3\r\n", + "\r\n", + "baz\r\n", + "--boundary--\r\n", + ]); + + self::assertSame($expected, (string) $b); + } + + public function testCanCreateWithNoneMetadataStreamField(): void + { + $str = 'dummy text'; + $a = Psr7\Utils::streamFor(static function () use ($str): string { + return $str; + }); + $b = new Psr7\LimitStream($a, \strlen($str)); + $c = new MultipartStream([ + [ + 'name' => 'foo', + 'contents' => $b, + ], + ], 'boundary'); + + $expected = \implode('', [ + "--boundary\r\n", + "Content-Disposition: form-data; name=\"foo\"\r\n", + "\r\n", + $str."\r\n", + "--boundary--\r\n", + ]); + + self::assertSame($expected, (string) $c); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/NoSeekStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/NoSeekStreamTest.php new file mode 100644 index 0000000000..89b03bc277 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/NoSeekStreamTest.php @@ -0,0 +1,38 @@ +createMock(StreamInterface::class); + $s->expects(self::never())->method('seek'); + $s->expects(self::never())->method('isSeekable'); + $wrapped = new NoSeekStream($s); + self::assertFalse($wrapped->isSeekable()); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Cannot seek a NoSeekStream'); + $wrapped->seek(2); + } + + public function testToStringDoesNotSeek(): void + { + $s = \GuzzleHttp\Psr7\Utils::streamFor('foo'); + $s->seek(1); + $wrapped = new NoSeekStream($s); + self::assertSame('oo', (string) $wrapped); + + $wrapped->close(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/PumpStreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/PumpStreamTest.php new file mode 100644 index 0000000000..a4f3f2cdd5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/PumpStreamTest.php @@ -0,0 +1,105 @@ + ['foo' => 'bar'], + 'size' => 100, + ]); + + self::assertSame('bar', $p->getMetadata('foo')); + self::assertSame(['foo' => 'bar'], $p->getMetadata()); + self::assertSame(100, $p->getSize()); + } + + public function testCanReadFromCallable(): void + { + $p = Psr7\Utils::streamFor(function ($size) { + return 'a'; + }); + self::assertSame('a', $p->read(1)); + self::assertSame(1, $p->tell()); + self::assertSame('aaaaa', $p->read(5)); + self::assertSame(6, $p->tell()); + } + + public function testStoresExcessDataInBuffer(): void + { + $called = []; + $p = Psr7\Utils::streamFor(function ($size) use (&$called) { + $called[] = $size; + + return 'abcdef'; + }); + self::assertSame('a', $p->read(1)); + self::assertSame('b', $p->read(1)); + self::assertSame('cdef', $p->read(4)); + self::assertSame('abcdefabc', $p->read(9)); + self::assertSame([1, 9, 3], $called); + } + + public function testInifiniteStreamWrappedInLimitStream(): void + { + $p = Psr7\Utils::streamFor(function () { + return 'a'; + }); + $s = new LimitStream($p, 5); + self::assertSame('aaaaa', (string) $s); + } + + public function testDescribesCapabilities(): void + { + $p = Psr7\Utils::streamFor(function (): void { + }); + self::assertTrue($p->isReadable()); + self::assertFalse($p->isSeekable()); + self::assertFalse($p->isWritable()); + self::assertNull($p->getSize()); + self::assertSame('', $p->getContents()); + self::assertSame('', (string) $p); + $p->close(); + self::assertSame('', $p->read(10)); + self::assertTrue($p->eof()); + + try { + self::assertFalse($p->write('aa')); + self::fail(); + } catch (\RuntimeException $e) { + } + } + + /** + * @requires PHP < 7.4 + */ + public function testThatConvertingStreamToStringWillTriggerErrorAndWillReturnEmptyString(): void + { + $p = Psr7\Utils::streamFor(function ($size): void { + throw new \Exception(); + }); + self::assertInstanceOf(PumpStream::class, $p); + + $errors = []; + set_error_handler(function (int $errorNumber, string $errorMessage) use (&$errors): void { + $errors[] = ['number' => $errorNumber, 'message' => $errorMessage]; + }); + (string) $p; + + restore_error_handler(); + + self::assertCount(1, $errors); + self::assertSame(E_USER_ERROR, $errors[0]['number']); + self::assertStringStartsWith('GuzzleHttp\Psr7\PumpStream::__toString exception:', $errors[0]['message']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/QueryTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/QueryTest.php new file mode 100644 index 0000000000..af396378c5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/QueryTest.php @@ -0,0 +1,124 @@ + ['a', 'b']]], + // Can parse multi-valued items that use numeric indices + ['q[0]=a&q[1]=b', ['q[0]' => 'a', 'q[1]' => 'b']], + // Can parse duplicates and does not include numeric indices + ['q[]=a&q[]=b', ['q[]' => ['a', 'b']]], + // Ensures that the value of "q" is an array even though one value + ['q[]=a', ['q[]' => 'a']], + // Does not modify "." to "_" like PHP's parse_str() + ['q.a=a&q.b=b', ['q.a' => 'a', 'q.b' => 'b']], + // Can decode %20 to " " + ['q%20a=a%20b', ['q a' => 'a b']], + // Can parse funky strings with no values by assigning each to null + ['q&a', ['q' => null, 'a' => null]], + // Does not strip trailing equal signs + ['data=abc=', ['data' => 'abc=']], + // Can store duplicates without affecting other values + ['foo=a&foo=b&?µ=c', ['foo' => ['a', 'b'], '?µ' => 'c']], + // Sets value to null when no "=" is present + ['foo', ['foo' => null]], + // Preserves "0" keys. + ['0', ['0' => null]], + // Sets the value to an empty string when "=" is present + ['0=', ['0' => '']], + // Preserves falsey keys + ['var=0', ['var' => '0']], + ['a[b][c]=1&a[b][c]=2', ['a[b][c]' => ['1', '2']]], + ['a[b]=c&a[d]=e', ['a[b]' => 'c', 'a[d]' => 'e']], + // Ensure it doesn't leave things behind with repeated values + // Can parse mult-values items + ['q=a&q=b&q=c', ['q' => ['a', 'b', 'c']]], + // Keeps first null when parsing mult-values + ['q&q=&q=a', ['q' => [null, '', 'a']]], + ]; + } + + /** + * @dataProvider parseQueryProvider + */ + public function testParsesQueries($input, $output): void + { + $result = Psr7\Query::parse($input); + self::assertSame($output, $result); + } + + public function testDoesNotDecode(): void + { + $str = 'foo%20=bar'; + $data = Psr7\Query::parse($str, false); + self::assertSame(['foo%20' => 'bar'], $data); + } + + /** + * @dataProvider parseQueryProvider + */ + public function testParsesAndBuildsQueries($input): void + { + $result = Psr7\Query::parse($input, false); + self::assertSame($input, Psr7\Query::build($result, false)); + } + + public function testEncodesWithRfc1738(): void + { + $str = Psr7\Query::build(['foo bar' => 'baz+'], PHP_QUERY_RFC1738); + self::assertSame('foo+bar=baz%2B', $str); + } + + public function testEncodesWithRfc3986(): void + { + $str = Psr7\Query::build(['foo bar' => 'baz+'], PHP_QUERY_RFC3986); + self::assertSame('foo%20bar=baz%2B', $str); + } + + public function testDoesNotEncode(): void + { + $str = Psr7\Query::build(['foo bar' => 'baz+'], false); + self::assertSame('foo bar=baz+', $str); + } + + public function testCanControlDecodingType(): void + { + $result = Psr7\Query::parse('var=foo+bar', PHP_QUERY_RFC3986); + self::assertSame('foo+bar', $result['var']); + $result = Psr7\Query::parse('var=foo+bar', PHP_QUERY_RFC1738); + self::assertSame('foo bar', $result['var']); + } + + public function testBuildBooleans(): void + { + $data = [ + 'true' => true, + 'false' => false, + ]; + self::assertEquals(http_build_query($data), Psr7\Query::build($data)); + + $data = [ + 'foo' => [true, 'true'], + 'bar' => [false, 'false'], + ]; + self::assertEquals('foo=1&foo=true&bar=0&bar=false', Psr7\Query::build($data, PHP_QUERY_RFC1738)); + + $data = [ + 'foo' => true, + 'bar' => false, + ]; + self::assertEquals('foo=true&bar=false', Psr7\Query::build($data, PHP_QUERY_RFC3986, false)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ReadSeekOnlyStream.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ReadSeekOnlyStream.php new file mode 100644 index 0000000000..eef9bd3f0c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ReadSeekOnlyStream.php @@ -0,0 +1,26 @@ +getUri()); + } + + public function testRequestUriMayBeUri(): void + { + $uri = new Uri('/'); + $r = new Request('GET', $uri); + self::assertSame($uri, $r->getUri()); + } + + public function testValidateRequestUri(): void + { + $this->expectException(\InvalidArgumentException::class); + new Request('GET', '///'); + } + + public function testCanConstructWithBody(): void + { + $r = new Request('GET', '/', [], 'baz'); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('baz', (string) $r->getBody()); + } + + public function testNullBody(): void + { + $r = new Request('GET', '/', [], null); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('', (string) $r->getBody()); + } + + public function testFalseyBody(): void + { + $r = new Request('GET', '/', [], '0'); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('0', (string) $r->getBody()); + } + + public function testConstructorDoesNotReadStreamBody(): void + { + $streamIsRead = false; + $body = Psr7\FnStream::decorate(Psr7\Utils::streamFor(''), [ + '__toString' => function () use (&$streamIsRead) { + $streamIsRead = true; + + return ''; + }, + ]); + + $r = new Request('GET', '/', [], $body); + self::assertFalse($streamIsRead); + self::assertSame($body, $r->getBody()); + } + + public function testCapitalizesMethod(): void + { + $r = new Request('get', '/'); + self::assertSame('GET', $r->getMethod()); + } + + public function testCapitalizesWithMethod(): void + { + $r = new Request('GET', '/'); + self::assertSame('PUT', $r->withMethod('put')->getMethod()); + } + + public function testWithUri(): void + { + $r1 = new Request('GET', '/'); + $u1 = $r1->getUri(); + $u2 = new Uri('http://www.example.com'); + $r2 = $r1->withUri($u2); + self::assertNotSame($r1, $r2); + self::assertSame($u2, $r2->getUri()); + self::assertSame($u1, $r1->getUri()); + } + + /** + * @dataProvider invalidMethodsProvider + */ + public function testConstructWithInvalidMethods($method): void + { + $this->expectException(\TypeError::class); + new Request($method, '/'); + } + + /** + * @dataProvider invalidMethodsProvider + */ + public function testWithInvalidMethods($method): void + { + $r = new Request('get', '/'); + $this->expectException(\InvalidArgumentException::class); + $r->withMethod($method); + } + + public function invalidMethodsProvider(): iterable + { + return [ + [null], + [false], + [['foo']], + [new \stdClass()], + ]; + } + + public function testSameInstanceWhenSameUri(): void + { + $r1 = new Request('GET', 'http://foo.com'); + $r2 = $r1->withUri($r1->getUri()); + self::assertSame($r1, $r2); + } + + public function testWithRequestTarget(): void + { + $r1 = new Request('GET', '/'); + $r2 = $r1->withRequestTarget('*'); + self::assertSame('*', $r2->getRequestTarget()); + self::assertSame('/', $r1->getRequestTarget()); + } + + public function testRequestTargetDoesNotAllowSpaces(): void + { + $r1 = new Request('GET', '/'); + $this->expectException(\InvalidArgumentException::class); + $r1->withRequestTarget('/foo bar'); + } + + public function testRequestTargetDefaultsToSlash(): void + { + $r1 = new Request('GET', ''); + self::assertSame('/', $r1->getRequestTarget()); + $r2 = new Request('GET', '*'); + self::assertSame('*', $r2->getRequestTarget()); + $r3 = new Request('GET', 'http://foo.com/bar baz/'); + self::assertSame('/bar%20baz/', $r3->getRequestTarget()); + } + + public function testBuildsRequestTarget(): void + { + $r1 = new Request('GET', 'http://foo.com/baz?bar=bam'); + self::assertSame('/baz?bar=bam', $r1->getRequestTarget()); + } + + public function testBuildsRequestTargetWithFalseyQuery(): void + { + $r1 = new Request('GET', 'http://foo.com/baz?0'); + self::assertSame('/baz?0', $r1->getRequestTarget()); + } + + public function testHostIsAddedFirst(): void + { + $r = new Request('GET', 'http://foo.com/baz?bar=bam', ['Foo' => 'Bar']); + self::assertSame([ + 'Host' => ['foo.com'], + 'Foo' => ['Bar'], + ], $r->getHeaders()); + } + + public function testHeaderValueWithWhitespace(): void + { + $r = new Request('GET', 'https://example.com/', [ + 'User-Agent' => 'Linux f0f489981e90 5.10.104-linuxkit 1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64', + ]); + self::assertSame([ + 'Host' => ['example.com'], + 'User-Agent' => ['Linux f0f489981e90 5.10.104-linuxkit 1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64'], + ], $r->getHeaders()); + } + + public function testCanGetHeaderAsCsv(): void + { + $r = new Request('GET', 'http://foo.com/baz?bar=bam', [ + 'Foo' => ['a', 'b', 'c'], + ]); + self::assertSame('a, b, c', $r->getHeaderLine('Foo')); + self::assertSame('', $r->getHeaderLine('Bar')); + } + + /** + * @dataProvider provideHeadersContainingNotAllowedChars + */ + public function testContainsNotAllowedCharsOnHeaderField($header): void + { + $this->expectExceptionMessage( + sprintf( + '"%s" is not valid header name', + $header + ) + ); + $r = new Request( + 'GET', + 'http://foo.com/baz?bar=bam', + [ + $header => 'value', + ] + ); + } + + public function provideHeadersContainingNotAllowedChars(): iterable + { + return [[' key '], ['key '], [' key'], ['key/'], ['key('], ['key\\'], [' ']]; + } + + /** + * @dataProvider provideHeadersContainsAllowedChar + */ + public function testContainsAllowedCharsOnHeaderField($header): void + { + $r = new Request( + 'GET', + 'http://foo.com/baz?bar=bam', + [ + $header => 'value', + ] + ); + self::assertArrayHasKey($header, $r->getHeaders()); + } + + public function provideHeadersContainsAllowedChar(): iterable + { + return [ + ['key'], + ['key#'], + ['key$'], + ['key%'], + ['key&'], + ['key*'], + ['key+'], + ['key.'], + ['key^'], + ['key_'], + ['key|'], + ['key~'], + ['key!'], + ['key-'], + ["key'"], + ['key`'], + ]; + } + + public function testHostIsNotOverwrittenWhenPreservingHost(): void + { + $r = new Request('GET', 'http://foo.com/baz?bar=bam', ['Host' => 'a.com']); + self::assertSame(['Host' => ['a.com']], $r->getHeaders()); + $r2 = $r->withUri(new Uri('http://www.foo.com/bar'), true); + self::assertSame('a.com', $r2->getHeaderLine('Host')); + } + + public function testWithUriSetsHostIfNotSet(): void + { + $r = (new Request('GET', 'http://foo.com/baz?bar=bam'))->withoutHeader('Host'); + self::assertSame([], $r->getHeaders()); + $r2 = $r->withUri(new Uri('http://www.baz.com/bar'), true); + self::assertSame('www.baz.com', $r2->getHeaderLine('Host')); + } + + public function testOverridesHostWithUri(): void + { + $r = new Request('GET', 'http://foo.com/baz?bar=bam'); + self::assertSame(['Host' => ['foo.com']], $r->getHeaders()); + $r2 = $r->withUri(new Uri('http://www.baz.com/bar')); + self::assertSame('www.baz.com', $r2->getHeaderLine('Host')); + } + + public function testAggregatesHeaders(): void + { + $r = new Request('GET', '', [ + 'ZOO' => 'zoobar', + 'zoo' => ['foobar', 'zoobar'], + ]); + self::assertSame(['ZOO' => ['zoobar', 'foobar', 'zoobar']], $r->getHeaders()); + self::assertSame('zoobar, foobar, zoobar', $r->getHeaderLine('zoo')); + } + + public function testAddsPortToHeader(): void + { + $r = new Request('GET', 'http://foo.com:8124/bar'); + self::assertSame('foo.com:8124', $r->getHeaderLine('host')); + } + + public function testAddsPortToHeaderAndReplacePreviousPort(): void + { + $r = new Request('GET', 'http://foo.com:8124/bar'); + $r = $r->withUri(new Uri('http://foo.com:8125/bar')); + self::assertSame('foo.com:8125', $r->getHeaderLine('host')); + } + + /** + * @dataProvider provideHeaderValuesContainingNotAllowedChars + */ + public function testContainsNotAllowedCharsOnHeaderValue(string $value): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage(sprintf('"%s" is not valid header value', $value)); + + $r = new Request( + 'GET', + 'http://foo.com/baz?bar=bam', + [ + 'testing' => $value, + ] + ); + } + + public function provideHeaderValuesContainingNotAllowedChars(): iterable + { + // Explicit tests for newlines as the most common exploit vector. + $tests = [ + ["new\nline"], + ["new\r\nline"], + ["new\rline"], + // Line folding is technically allowed, but deprecated. + // We don't support it. + ["new\r\n line"], + ["newline\n"], + ["\nnewline"], + ["newline\r\n"], + ["\r\nnewline"], + ]; + + for ($i = 0; $i <= 0xFF; ++$i) { + if (\chr($i) == "\t") { + continue; + } + if (\chr($i) == ' ') { + continue; + } + if ($i >= 0x21 && $i <= 0x7E) { + continue; + } + if ($i >= 0x80) { + continue; + } + + $tests[] = ['foo'.\chr($i).'bar']; + $tests[] = ['foo'.\chr($i)]; + } + + return $tests; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ResponseTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ResponseTest.php new file mode 100644 index 0000000000..0d97ac8914 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ResponseTest.php @@ -0,0 +1,391 @@ +getStatusCode()); + self::assertSame('1.1', $r->getProtocolVersion()); + self::assertSame('OK', $r->getReasonPhrase()); + self::assertSame([], $r->getHeaders()); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('', (string) $r->getBody()); + } + + public function testCanConstructWithStatusCode(): void + { + $r = new Response(404); + self::assertSame(404, $r->getStatusCode()); + self::assertSame('Not Found', $r->getReasonPhrase()); + } + + public function testConstructorDoesNotReadStreamBody(): void + { + $streamIsRead = false; + $body = Psr7\FnStream::decorate(Psr7\Utils::streamFor(''), [ + '__toString' => function () use (&$streamIsRead) { + $streamIsRead = true; + + return ''; + }, + ]); + + $r = new Response(200, [], $body); + self::assertFalse($streamIsRead); + self::assertSame($body, $r->getBody()); + } + + public function testStatusCanBeNumericString(): void + { + $r = (new Response())->withStatus('201'); + + self::assertSame(201, $r->getStatusCode()); + self::assertSame('Created', $r->getReasonPhrase()); + } + + public function testCanConstructWithHeaders(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame('Bar', $r->getHeaderLine('Foo')); + self::assertSame(['Bar'], $r->getHeader('Foo')); + } + + public function testCanConstructWithHeadersAsArray(): void + { + $r = new Response(200, [ + 'Foo' => ['baz', 'bar'], + ]); + self::assertSame(['Foo' => ['baz', 'bar']], $r->getHeaders()); + self::assertSame('baz, bar', $r->getHeaderLine('Foo')); + self::assertSame(['baz', 'bar'], $r->getHeader('Foo')); + } + + public function testCanConstructWithBody(): void + { + $r = new Response(200, [], 'baz'); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('baz', (string) $r->getBody()); + } + + public function testNullBody(): void + { + $r = new Response(200, [], null); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('', (string) $r->getBody()); + } + + public function testFalseyBody(): void + { + $r = new Response(200, [], '0'); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('0', (string) $r->getBody()); + } + + public function testCanConstructWithReason(): void + { + $r = new Response(200, [], null, '1.1', 'bar'); + self::assertSame('bar', $r->getReasonPhrase()); + + $r = new Response(200, [], null, '1.1', '0'); + self::assertSame('0', $r->getReasonPhrase(), 'Falsey reason works'); + } + + public function testCanConstructWithProtocolVersion(): void + { + $r = new Response(200, [], null, '1000'); + self::assertSame('1000', $r->getProtocolVersion()); + } + + public function testWithStatusCodeAndNoReason(): void + { + $r = (new Response())->withStatus(201); + self::assertSame(201, $r->getStatusCode()); + self::assertSame('Created', $r->getReasonPhrase()); + } + + public function testWithStatusCodeAndReason(): void + { + $r = (new Response())->withStatus(201, 'Foo'); + self::assertSame(201, $r->getStatusCode()); + self::assertSame('Foo', $r->getReasonPhrase()); + + $r = (new Response())->withStatus(201, '0'); + self::assertSame(201, $r->getStatusCode()); + self::assertSame('0', $r->getReasonPhrase(), 'Falsey reason works'); + } + + public function testWithProtocolVersion(): void + { + $r = (new Response())->withProtocolVersion('1000'); + self::assertSame('1000', $r->getProtocolVersion()); + } + + public function testSameInstanceWhenSameProtocol(): void + { + $r = new Response(); + self::assertSame($r, $r->withProtocolVersion('1.1')); + } + + public function testWithBody(): void + { + $b = Psr7\Utils::streamFor('0'); + $r = (new Response())->withBody($b); + self::assertInstanceOf(StreamInterface::class, $r->getBody()); + self::assertSame('0', (string) $r->getBody()); + } + + public function testSameInstanceWhenSameBody(): void + { + $r = new Response(); + $b = $r->getBody(); + self::assertSame($r, $r->withBody($b)); + } + + public function testWithHeader(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + $r2 = $r->withHeader('baZ', 'Bam'); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame(['Foo' => ['Bar'], 'baZ' => ['Bam']], $r2->getHeaders()); + self::assertSame('Bam', $r2->getHeaderLine('baz')); + self::assertSame(['Bam'], $r2->getHeader('baz')); + } + + public function testNumericHeaderValue(): void + { + $r = (new Response())->withHeader('Api-Version', 1); + self::assertSame(['Api-Version' => ['1']], $r->getHeaders()); + } + + public function testWithHeaderAsArray(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + $r2 = $r->withHeader('baZ', ['Bam', 'Bar']); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame(['Foo' => ['Bar'], 'baZ' => ['Bam', 'Bar']], $r2->getHeaders()); + self::assertSame('Bam, Bar', $r2->getHeaderLine('baz')); + self::assertSame(['Bam', 'Bar'], $r2->getHeader('baz')); + } + + public function testWithHeaderReplacesDifferentCase(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + $r2 = $r->withHeader('foO', 'Bam'); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame(['foO' => ['Bam']], $r2->getHeaders()); + self::assertSame('Bam', $r2->getHeaderLine('foo')); + self::assertSame(['Bam'], $r2->getHeader('foo')); + } + + public function testWithAddedHeader(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + $r2 = $r->withAddedHeader('foO', 'Baz'); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame(['Foo' => ['Bar', 'Baz']], $r2->getHeaders()); + self::assertSame('Bar, Baz', $r2->getHeaderLine('foo')); + self::assertSame(['Bar', 'Baz'], $r2->getHeader('foo')); + } + + public function testWithAddedHeaderAsArray(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + $r2 = $r->withAddedHeader('foO', ['Baz', 'Bam']); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame(['Foo' => ['Bar', 'Baz', 'Bam']], $r2->getHeaders()); + self::assertSame('Bar, Baz, Bam', $r2->getHeaderLine('foo')); + self::assertSame(['Bar', 'Baz', 'Bam'], $r2->getHeader('foo')); + } + + public function testWithAddedHeaderThatDoesNotExist(): void + { + $r = new Response(200, ['Foo' => 'Bar']); + $r2 = $r->withAddedHeader('nEw', 'Baz'); + self::assertSame(['Foo' => ['Bar']], $r->getHeaders()); + self::assertSame(['Foo' => ['Bar'], 'nEw' => ['Baz']], $r2->getHeaders()); + self::assertSame('Baz', $r2->getHeaderLine('new')); + self::assertSame(['Baz'], $r2->getHeader('new')); + } + + public function testWithoutHeaderThatExists(): void + { + $r = new Response(200, ['Foo' => 'Bar', 'Baz' => 'Bam']); + $r2 = $r->withoutHeader('foO'); + self::assertTrue($r->hasHeader('foo')); + self::assertSame(['Foo' => ['Bar'], 'Baz' => ['Bam']], $r->getHeaders()); + self::assertFalse($r2->hasHeader('foo')); + self::assertSame(['Baz' => ['Bam']], $r2->getHeaders()); + } + + public function testWithoutHeaderThatDoesNotExist(): void + { + $r = new Response(200, ['Baz' => 'Bam']); + $r2 = $r->withoutHeader('foO'); + self::assertSame($r, $r2); + self::assertFalse($r2->hasHeader('foo')); + self::assertSame(['Baz' => ['Bam']], $r2->getHeaders()); + } + + public function testSameInstanceWhenRemovingMissingHeader(): void + { + $r = new Response(); + self::assertSame($r, $r->withoutHeader('foo')); + } + + public function testPassNumericHeaderNameInConstructor(): void + { + $r = new Response(200, ['Location' => 'foo', '123' => 'bar']); + self::assertSame('bar', $r->getHeaderLine('123')); + } + + /** + * @dataProvider invalidHeaderProvider + */ + public function testConstructResponseInvalidHeader($header, $headerValue, $expectedMessage): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage($expectedMessage); + new Response(200, [$header => $headerValue]); + } + + public function invalidHeaderProvider(): iterable + { + return [ + ['foo', [], 'Header value can not be an empty array.'], + ['', '', '"" is not valid header name'], + ['foo', new \stdClass(), 'Header value must be scalar or null but stdClass provided.'], + ]; + } + + /** + * @dataProvider invalidWithHeaderProvider + */ + public function testWithInvalidHeader($header, $headerValue, $expectedMessage): void + { + $r = new Response(); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage($expectedMessage); + $r->withHeader($header, $headerValue); + } + + public function invalidWithHeaderProvider(): iterable + { + yield from $this->invalidHeaderProvider(); + yield [[], 'foo', 'Header name must be a string but array provided.']; + yield [false, 'foo', 'Header name must be a string but boolean provided.']; + yield [new \stdClass(), 'foo', 'Header name must be a string but stdClass provided.']; + yield ['', 'foo', '"" is not valid header name.']; + yield ["Content-Type\r\n\r\n", 'foo', "\"Content-Type\r\n\r\n\" is not valid header name."]; + yield ["Content-Type\r\n", 'foo', "\"Content-Type\r\n\" is not valid header name."]; + yield ["Content-Type\n", 'foo', "\"Content-Type\n\" is not valid header name."]; + yield ["\r\nContent-Type", 'foo', "\"\r\nContent-Type\" is not valid header name."]; + yield ["\nContent-Type", 'foo', "\"\nContent-Type\" is not valid header name."]; + yield ["\n", 'foo', "\"\n\" is not valid header name."]; + yield ["\r\n", 'foo', "\"\r\n\" is not valid header name."]; + yield ["\t", 'foo', "\"\t\" is not valid header name."]; + } + + public function testHeaderValuesAreTrimmed(): void + { + $r1 = new Response(200, ['OWS' => " \t \tFoo\t \t "]); + $r2 = (new Response())->withHeader('OWS', " \t \tFoo\t \t "); + $r3 = (new Response())->withAddedHeader('OWS', " \t \tFoo\t \t "); + + foreach ([$r1, $r2, $r3] as $r) { + self::assertSame(['OWS' => ['Foo']], $r->getHeaders()); + self::assertSame('Foo', $r->getHeaderLine('OWS')); + self::assertSame(['Foo'], $r->getHeader('OWS')); + } + } + + public function testWithAddedHeaderArrayValueAndKeys(): void + { + $message = (new Response())->withAddedHeader('list', ['foo' => 'one']); + $message = $message->withAddedHeader('list', ['foo' => 'two', 'bar' => 'three']); + + $headerLine = $message->getHeaderLine('list'); + self::assertSame('one, two, three', $headerLine); + } + + /** + * @dataProvider nonIntegerStatusCodeProvider + * + * @param mixed $invalidValues + */ + public function testConstructResponseWithNonIntegerStatusCode($invalidValues): void + { + $this->expectException(\TypeError::class); + new Response($invalidValues); + } + + /** + * @dataProvider nonIntegerStatusCodeProvider + * + * @param mixed $invalidValues + */ + public function testResponseChangeStatusCodeWithNonInteger($invalidValues): void + { + $response = new Response(); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Status code must be an integer value.'); + $response->withStatus($invalidValues); + } + + public function nonIntegerStatusCodeProvider(): iterable + { + return [ + ['whatever'], + ['1.01'], + [1.01], + [new \stdClass()], + ]; + } + + /** + * @dataProvider invalidStatusCodeRangeProvider + * + * @param mixed $invalidValues + */ + public function testConstructResponseWithInvalidRangeStatusCode($invalidValues): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Status code must be an integer value between 1xx and 5xx.'); + new Response($invalidValues); + } + + /** + * @dataProvider invalidStatusCodeRangeProvider + * + * @param mixed $invalidValues + */ + public function testResponseChangeStatusCodeWithWithInvalidRange($invalidValues): void + { + $response = new Response(); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Status code must be an integer value between 1xx and 5xx.'); + $response->withStatus($invalidValues); + } + + public function invalidStatusCodeRangeProvider(): iterable + { + return [ + [600], + [99], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ServerRequestTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ServerRequestTest.php new file mode 100644 index 0000000000..1baf11cb17 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/ServerRequestTest.php @@ -0,0 +1,566 @@ + [ + [ + 'file' => [ + 'name' => 'MyFile.txt', + 'type' => 'text/plain', + 'tmp_name' => '/tmp/php/php1h4j1o', + 'error' => '0', + 'size' => '123', + ], + ], + [ + 'file' => new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + ], + ], + 'Empty file' => [ + [ + 'image_file' => [ + 'name' => '', + 'type' => '', + 'tmp_name' => '', + 'error' => '4', + 'size' => '0', + ], + ], + [ + 'image_file' => new UploadedFile( + '', + 0, + UPLOAD_ERR_NO_FILE, + '', + '' + ), + ], + ], + 'Already Converted' => [ + [ + 'file' => new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + ], + [ + 'file' => new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + ], + ], + 'Already Converted array' => [ + [ + 'file' => [ + new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + new UploadedFile( + '', + 0, + UPLOAD_ERR_NO_FILE, + '', + '' + ), + ], + ], + [ + 'file' => [ + new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + new UploadedFile( + '', + 0, + UPLOAD_ERR_NO_FILE, + '', + '' + ), + ], + ], + ], + 'Multiple files' => [ + [ + 'text_file' => [ + 'name' => 'MyFile.txt', + 'type' => 'text/plain', + 'tmp_name' => '/tmp/php/php1h4j1o', + 'error' => '0', + 'size' => '123', + ], + 'image_file' => [ + 'name' => '', + 'type' => '', + 'tmp_name' => '', + 'error' => '4', + 'size' => '0', + ], + ], + [ + 'text_file' => new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + 'image_file' => new UploadedFile( + '', + 0, + UPLOAD_ERR_NO_FILE, + '', + '' + ), + ], + ], + 'Nested files' => [ + [ + 'file' => [ + 'name' => [ + 0 => 'MyFile.txt', + 1 => 'Image.png', + ], + 'type' => [ + 0 => 'text/plain', + 1 => 'image/png', + ], + 'tmp_name' => [ + 0 => '/tmp/php/hp9hskjhf', + 1 => '/tmp/php/php1h4j1o', + 2 => '/tmp/php/w0ensl4ar', + ], + 'error' => [ + 0 => '0', + 1 => '0', + ], + 'size' => [ + 0 => '123', + 1 => '7349', + ], + ], + 'minimum_data' => [ + 'tmp_name' => [ + 0 => '/tmp/php/hp9hskjhf', + ], + ], + 'nested' => [ + 'name' => [ + 'other' => 'Flag.txt', + 'test' => [ + 0 => 'Stuff.txt', + 1 => '', + ], + ], + 'type' => [ + 'other' => 'text/plain', + 'test' => [ + 0 => 'text/plain', + 1 => '', + ], + ], + 'tmp_name' => [ + 'other' => '/tmp/php/hp9hskjhf', + 'test' => [ + 0 => '/tmp/php/asifu2gp3', + 1 => '', + ], + ], + 'error' => [ + 'other' => '0', + 'test' => [ + 0 => '0', + 1 => '4', + ], + ], + 'size' => [ + 'other' => '421', + 'test' => [ + 0 => '32', + 1 => '0', + ], + ], + ], + ], + [ + 'file' => [ + 0 => new UploadedFile( + '/tmp/php/hp9hskjhf', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + 1 => new UploadedFile( + '/tmp/php/php1h4j1o', + 7349, + UPLOAD_ERR_OK, + 'Image.png', + 'image/png' + ), + 2 => new UploadedFile( + '/tmp/php/w0ensl4ar', + null, + UPLOAD_ERR_OK + ), + ], + 'minimum_data' => [ + 0 => new UploadedFile( + '/tmp/php/hp9hskjhf', + 0, + UPLOAD_ERR_OK + ), + ], + 'nested' => [ + 'other' => new UploadedFile( + '/tmp/php/hp9hskjhf', + 421, + UPLOAD_ERR_OK, + 'Flag.txt', + 'text/plain' + ), + 'test' => [ + 0 => new UploadedFile( + '/tmp/php/asifu2gp3', + 32, + UPLOAD_ERR_OK, + 'Stuff.txt', + 'text/plain' + ), + 1 => new UploadedFile( + '', + 0, + UPLOAD_ERR_NO_FILE, + '', + '' + ), + ], + ], + ], + ], + ]; + } + + /** + * @dataProvider dataNormalizeFiles + */ + public function testNormalizeFiles($files, $expected): void + { + $result = ServerRequest::normalizeFiles($files); + + self::assertEquals($expected, $result); + } + + public function testNormalizeFilesRaisesException(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value in files specification'); + ServerRequest::normalizeFiles(['test' => 'something']); + } + + public function dataGetUriFromGlobals(): iterable + { + $server = [ + 'REQUEST_URI' => '/blog/article.php?id=10&user=foo', + 'SERVER_PORT' => '443', + 'SERVER_ADDR' => '217.112.82.20', + 'SERVER_NAME' => 'www.example.org', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'REQUEST_METHOD' => 'POST', + 'QUERY_STRING' => 'id=10&user=foo', + 'DOCUMENT_ROOT' => '/path/to/your/server/root/', + 'HTTP_HOST' => 'www.example.org', + 'HTTPS' => 'on', + 'REMOTE_ADDR' => '193.60.168.69', + 'REMOTE_PORT' => '5390', + 'SCRIPT_NAME' => '/blog/article.php', + 'SCRIPT_FILENAME' => '/path/to/your/server/root/blog/article.php', + 'PHP_SELF' => '/blog/article.php', + ]; + + return [ + 'HTTPS request' => [ + 'https://www.example.org/blog/article.php?id=10&user=foo', + $server, + ], + 'HTTPS request with different on value' => [ + 'https://www.example.org/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTPS' => '1']), + ], + 'HTTP request' => [ + 'http://www.example.org/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTPS' => 'off', 'SERVER_PORT' => '80']), + ], + 'HTTP_HOST missing -> fallback to SERVER_NAME' => [ + 'https://www.example.org/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTP_HOST' => null]), + ], + 'HTTP_HOST and SERVER_NAME missing -> fallback to SERVER_ADDR' => [ + 'https://217.112.82.20/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTP_HOST' => null, 'SERVER_NAME' => null]), + ], + 'Query string with ?' => [ + 'https://www.example.org/path?continue=https://example.com/path?param=1', + array_merge($server, ['REQUEST_URI' => '/path?continue=https://example.com/path?param=1', 'QUERY_STRING' => '']), + ], + 'No query String' => [ + 'https://www.example.org/blog/article.php', + array_merge($server, ['REQUEST_URI' => '/blog/article.php', 'QUERY_STRING' => '']), + ], + 'Host header with port' => [ + 'https://www.example.org:8324/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTP_HOST' => 'www.example.org:8324']), + ], + 'IPv6 local loopback address' => [ + 'https://[::1]:8000/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTP_HOST' => '[::1]:8000']), + ], + 'Invalid host' => [ + 'https://localhost/blog/article.php?id=10&user=foo', + array_merge($server, ['HTTP_HOST' => 'a:b']), + ], + 'Different port with SERVER_PORT' => [ + 'https://www.example.org:8324/blog/article.php?id=10&user=foo', + array_merge($server, ['SERVER_PORT' => '8324']), + ], + 'REQUEST_URI missing query string' => [ + 'https://www.example.org/blog/article.php?id=10&user=foo', + array_merge($server, ['REQUEST_URI' => '/blog/article.php']), + ], + 'Empty server variable' => [ + 'http://localhost', + [], + ], + ]; + } + + /** + * @dataProvider dataGetUriFromGlobals + */ + public function testGetUriFromGlobals($expected, $serverParams): void + { + $_SERVER = $serverParams; + + self::assertEquals(new Uri($expected), ServerRequest::getUriFromGlobals()); + } + + public function testFromGlobals(): void + { + $_SERVER = [ + 'REQUEST_URI' => '/blog/article.php?id=10&user=foo', + 'SERVER_PORT' => '443', + 'SERVER_ADDR' => '217.112.82.20', + 'SERVER_NAME' => 'www.example.org', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'REQUEST_METHOD' => 'POST', + 'QUERY_STRING' => 'id=10&user=foo', + 'DOCUMENT_ROOT' => '/path/to/your/server/root/', + 'CONTENT_TYPE' => 'text/plain', + 'HTTP_HOST' => 'www.example.org', + 'HTTP_ACCEPT' => 'text/html', + 'HTTP_REFERRER' => 'https://example.com', + 'HTTP_USER_AGENT' => 'My User Agent', + 'HTTPS' => 'on', + 'REMOTE_ADDR' => '193.60.168.69', + 'REMOTE_PORT' => '5390', + 'SCRIPT_NAME' => '/blog/article.php', + 'SCRIPT_FILENAME' => '/path/to/your/server/root/blog/article.php', + 'PHP_SELF' => '/blog/article.php', + ]; + + $_COOKIE = [ + 'logged-in' => 'yes!', + ]; + + $_POST = [ + 'name' => 'Pesho', + 'email' => 'pesho@example.com', + ]; + + $_GET = [ + 'id' => 10, + 'user' => 'foo', + ]; + + $_FILES = [ + 'file' => [ + 'name' => 'MyFile.txt', + 'type' => 'text/plain', + 'tmp_name' => '/tmp/php/php1h4j1o', + 'error' => UPLOAD_ERR_OK, + 'size' => 123, + ], + ]; + + $server = ServerRequest::fromGlobals(); + + self::assertSame('POST', $server->getMethod()); + self::assertEquals([ + 'Host' => ['www.example.org'], + 'Content-Type' => ['text/plain'], + 'Accept' => ['text/html'], + 'Referrer' => ['https://example.com'], + 'User-Agent' => ['My User Agent'], + ], $server->getHeaders()); + self::assertSame('', (string) $server->getBody()); + self::assertSame('1.1', $server->getProtocolVersion()); + self::assertSame($_COOKIE, $server->getCookieParams()); + self::assertSame($_POST, $server->getParsedBody()); + self::assertSame($_GET, $server->getQueryParams()); + + self::assertEquals( + new Uri('https://www.example.org/blog/article.php?id=10&user=foo'), + $server->getUri() + ); + + $expectedFiles = [ + 'file' => new UploadedFile( + '/tmp/php/php1h4j1o', + 123, + UPLOAD_ERR_OK, + 'MyFile.txt', + 'text/plain' + ), + ]; + + self::assertEquals($expectedFiles, $server->getUploadedFiles()); + } + + public function testUploadedFiles(): void + { + $request1 = new ServerRequest('GET', '/'); + + $files = [ + 'file' => new UploadedFile('test', 123, UPLOAD_ERR_OK), + ]; + + $request2 = $request1->withUploadedFiles($files); + + self::assertNotSame($request2, $request1); + self::assertSame([], $request1->getUploadedFiles()); + self::assertSame($files, $request2->getUploadedFiles()); + } + + public function testServerParams(): void + { + $params = ['name' => 'value']; + + $request = new ServerRequest('GET', '/', [], null, '1.1', $params); + self::assertSame($params, $request->getServerParams()); + } + + public function testCookieParams(): void + { + $request1 = new ServerRequest('GET', '/'); + + $params = ['name' => 'value']; + + $request2 = $request1->withCookieParams($params); + + self::assertNotSame($request2, $request1); + self::assertEmpty($request1->getCookieParams()); + self::assertSame($params, $request2->getCookieParams()); + } + + public function testQueryParams(): void + { + $request1 = new ServerRequest('GET', '/'); + + $params = ['name' => 'value']; + + $request2 = $request1->withQueryParams($params); + + self::assertNotSame($request2, $request1); + self::assertEmpty($request1->getQueryParams()); + self::assertSame($params, $request2->getQueryParams()); + } + + public function testParsedBody(): void + { + $request1 = new ServerRequest('GET', '/'); + + $params = ['name' => 'value']; + + $request2 = $request1->withParsedBody($params); + + self::assertNotSame($request2, $request1); + self::assertEmpty($request1->getParsedBody()); + self::assertSame($params, $request2->getParsedBody()); + } + + public function testAttributes(): void + { + $request1 = new ServerRequest('GET', '/'); + + $request2 = $request1->withAttribute('name', 'value'); + $request3 = $request2->withAttribute('other', 'otherValue'); + $request4 = $request3->withoutAttribute('other'); + $request5 = $request3->withoutAttribute('unknown'); + + self::assertNotSame($request2, $request1); + self::assertNotSame($request3, $request2); + self::assertNotSame($request4, $request3); + self::assertSame($request5, $request3); + + self::assertSame([], $request1->getAttributes()); + self::assertNull($request1->getAttribute('name')); + self::assertSame( + 'something', + $request1->getAttribute('name', 'something'), + 'Should return the default value' + ); + + self::assertSame('value', $request2->getAttribute('name')); + self::assertSame(['name' => 'value'], $request2->getAttributes()); + self::assertSame(['name' => 'value', 'other' => 'otherValue'], $request3->getAttributes()); + self::assertSame(['name' => 'value'], $request4->getAttributes()); + } + + public function testNullAttribute(): void + { + $request = (new ServerRequest('GET', '/'))->withAttribute('name', null); + + self::assertSame(['name' => null], $request->getAttributes()); + self::assertNull($request->getAttribute('name', 'different-default')); + + $requestWithoutAttribute = $request->withoutAttribute('name'); + + self::assertSame([], $requestWithoutAttribute->getAttributes()); + self::assertSame('different-default', $requestWithoutAttribute->getAttribute('name', 'different-default')); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php new file mode 100644 index 0000000000..aaa9f28ca5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php @@ -0,0 +1,148 @@ +c = fopen('php://temp', 'r+'); + fwrite($this->c, 'foo'); + fseek($this->c, 0); + $this->a = Psr7\Utils::streamFor($this->c); + $this->b = new Str($this->a); + } + + /** + * @requires PHP < 7.4 + */ + public function testCatchesExceptionsWhenCastingToString(): void + { + $s = $this->createMock(Str::class); + $s->expects(self::once()) + ->method('read') + ->willThrowException(new \RuntimeException('foo')); + $msg = ''; + set_error_handler(function (int $errNo, string $str) use (&$msg): void { + $msg = $str; + }); + echo new Str($s); + restore_error_handler(); + self::assertStringContainsString('foo', $msg); + } + + public function testToString(): void + { + self::assertSame('foo', (string) $this->b); + } + + public function testHasSize(): void + { + self::assertSame(3, $this->b->getSize()); + } + + public function testReads(): void + { + self::assertSame('foo', $this->b->read(10)); + } + + public function testCheckMethods(): void + { + self::assertSame($this->a->isReadable(), $this->b->isReadable()); + self::assertSame($this->a->isWritable(), $this->b->isWritable()); + self::assertSame($this->a->isSeekable(), $this->b->isSeekable()); + } + + public function testSeeksAndTells(): void + { + $this->b->seek(1); + self::assertSame(1, $this->a->tell()); + self::assertSame(1, $this->b->tell()); + $this->b->seek(0); + self::assertSame(0, $this->a->tell()); + self::assertSame(0, $this->b->tell()); + $this->b->seek(0, SEEK_END); + self::assertSame(3, $this->a->tell()); + self::assertSame(3, $this->b->tell()); + } + + public function testGetsContents(): void + { + self::assertSame('foo', $this->b->getContents()); + self::assertSame('', $this->b->getContents()); + $this->b->seek(1); + self::assertSame('oo', $this->b->getContents()); + } + + public function testCloses(): void + { + $this->b->close(); + self::assertFalse(is_resource($this->c)); + } + + public function testDetaches(): void + { + $this->b->detach(); + self::assertFalse($this->b->isReadable()); + } + + public function testWrapsMetadata(): void + { + self::assertSame($this->b->getMetadata(), $this->a->getMetadata()); + self::assertSame($this->b->getMetadata('uri'), $this->a->getMetadata('uri')); + } + + public function testWrapsWrites(): void + { + $this->b->seek(0, SEEK_END); + $this->b->write('foo'); + self::assertSame('foofoo', (string) $this->a); + } + + public function testThrowsWithInvalidGetter(): void + { + $this->expectException(\UnexpectedValueException::class); + $this->b->foo; + } + + public function testThrowsWhenGetterNotImplemented(): void + { + $this->expectException(\BadMethodCallException::class); + $s = new BadStream(); + $s->stream; + } +} + +class BadStream +{ + use StreamDecoratorTrait; + + public function __construct() + { + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamTest.php new file mode 100644 index 0000000000..75261c3572 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamTest.php @@ -0,0 +1,447 @@ +expectException(\InvalidArgumentException::class); + new Stream(true); + } + + public function testConstructorInitializesProperties(): void + { + $handle = fopen('php://temp', 'r+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + self::assertTrue($stream->isReadable()); + self::assertTrue($stream->isWritable()); + self::assertTrue($stream->isSeekable()); + self::assertSame('php://temp', $stream->getMetadata('uri')); + self::assertIsArray($stream->getMetadata()); + self::assertSame(4, $stream->getSize()); + self::assertFalse($stream->eof()); + $stream->close(); + } + + public function testConstructorInitializesPropertiesWithRbPlus(): void + { + $handle = fopen('php://temp', 'rb+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + self::assertTrue($stream->isReadable()); + self::assertTrue($stream->isWritable()); + self::assertTrue($stream->isSeekable()); + self::assertSame('php://temp', $stream->getMetadata('uri')); + self::assertIsArray($stream->getMetadata()); + self::assertSame(4, $stream->getSize()); + self::assertFalse($stream->eof()); + $stream->close(); + } + + public function testStreamClosesHandleOnDestruct(): void + { + $handle = fopen('php://temp', 'r'); + $stream = new Stream($handle); + unset($stream); + self::assertFalse(is_resource($handle)); + } + + public function testConvertsToString(): void + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + self::assertSame('data', (string) $stream); + self::assertSame('data', (string) $stream); + $stream->close(); + } + + public function testConvertsToStringNonSeekableStream(): void + { + $handle = popen('echo foo', 'r'); + $stream = new Stream($handle); + self::assertFalse($stream->isSeekable()); + self::assertSame('foo', trim((string) $stream)); + } + + public function testConvertsToStringNonSeekablePartiallyReadStream(): void + { + $handle = popen('echo bar', 'r'); + $stream = new Stream($handle); + $firstLetter = $stream->read(1); + self::assertFalse($stream->isSeekable()); + self::assertSame('b', $firstLetter); + self::assertSame('ar', trim((string) $stream)); + } + + public function testGetsContents(): void + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + self::assertSame('', $stream->getContents()); + $stream->seek(0); + self::assertSame('data', $stream->getContents()); + self::assertSame('', $stream->getContents()); + $stream->close(); + } + + public function testChecksEof(): void + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + self::assertSame(4, $stream->tell(), 'Stream cursor already at the end'); + self::assertFalse($stream->eof(), 'Stream still not eof'); + self::assertSame('', $stream->read(1), 'Need to read one more byte to reach eof'); + self::assertTrue($stream->eof()); + $stream->close(); + } + + public function testGetSize(): void + { + $size = filesize(__FILE__); + $handle = fopen(__FILE__, 'r'); + $stream = new Stream($handle); + self::assertSame($size, $stream->getSize()); + // Load from cache + self::assertSame($size, $stream->getSize()); + $stream->close(); + } + + public function testEnsuresSizeIsConsistent(): void + { + $h = fopen('php://temp', 'w+'); + self::assertSame(3, fwrite($h, 'foo')); + $stream = new Stream($h); + self::assertSame(3, $stream->getSize()); + self::assertSame(4, $stream->write('test')); + self::assertSame(7, $stream->getSize()); + self::assertSame(7, $stream->getSize()); + $stream->close(); + } + + public function testProvidesStreamPosition(): void + { + $handle = fopen('php://temp', 'w+'); + $stream = new Stream($handle); + self::assertSame(0, $stream->tell()); + $stream->write('foo'); + self::assertSame(3, $stream->tell()); + $stream->seek(1); + self::assertSame(1, $stream->tell()); + self::assertSame(ftell($handle), $stream->tell()); + $stream->close(); + } + + public function testDetachStreamAndClearProperties(): void + { + $handle = fopen('php://temp', 'r'); + $stream = new Stream($handle); + self::assertSame($handle, $stream->detach()); + self::assertIsResource($handle, 'Stream is not closed'); + self::assertNull($stream->detach()); + + $this->assertStreamStateAfterClosedOrDetached($stream); + + $stream->close(); + } + + public function testCloseResourceAndClearProperties(): void + { + $handle = fopen('php://temp', 'r'); + $stream = new Stream($handle); + $stream->close(); + + self::assertFalse(is_resource($handle)); + + $this->assertStreamStateAfterClosedOrDetached($stream); + } + + private function assertStreamStateAfterClosedOrDetached(Stream $stream): void + { + self::assertFalse($stream->isReadable()); + self::assertFalse($stream->isWritable()); + self::assertFalse($stream->isSeekable()); + self::assertNull($stream->getSize()); + self::assertSame([], $stream->getMetadata()); + self::assertNull($stream->getMetadata('foo')); + + $throws = function (callable $fn): void { + try { + $fn(); + } catch (\Exception $e) { + $this->assertStringContainsString('Stream is detached', $e->getMessage()); + + return; + } + + $this->fail('Exception should be thrown after the stream is detached.'); + }; + + $throws(function () use ($stream): void { + $stream->read(10); + }); + $throws(function () use ($stream): void { + $stream->write('bar'); + }); + $throws(function () use ($stream): void { + $stream->seek(10); + }); + $throws(function () use ($stream): void { + $stream->tell(); + }); + $throws(function () use ($stream): void { + $stream->eof(); + }); + $throws(function () use ($stream): void { + $stream->getContents(); + }); + + if (\PHP_VERSION_ID >= 70400) { + $throws(function () use ($stream): void { + (string) $stream; + }); + } else { + $errors = []; + set_error_handler(function (int $errorNumber, string $errorMessage) use (&$errors): void { + $errors[] = ['message' => $errorMessage, 'number' => $errorNumber]; + }); + self::assertSame('', (string) $stream); + restore_error_handler(); + + self::assertCount(1, $errors); + self::assertStringStartsWith('GuzzleHttp\Psr7\Stream::__toString exception', $errors[0]['message']); + self::assertSame(E_USER_ERROR, $errors[0]['number']); + } + } + + public function testStreamReadingWithZeroLength(): void + { + $r = fopen('php://temp', 'r'); + $stream = new Stream($r); + + self::assertSame('', $stream->read(0)); + + $stream->close(); + } + + public function testStreamReadingWithNegativeLength(): void + { + $r = fopen('php://temp', 'r'); + $stream = new Stream($r); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Length parameter cannot be negative'); + + try { + $stream->read(-1); + } catch (\Exception $e) { + $stream->close(); + throw $e; + } + + $stream->close(); + } + + public function testStreamReadingFreadFalse(): void + { + self::$isFReadError = true; + $r = fopen('php://temp', 'r'); + $stream = new Stream($r); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to read from stream'); + + try { + $stream->read(1); + } catch (\Exception $e) { + self::$isFReadError = false; + $stream->close(); + throw $e; + } + + self::$isFReadError = false; + $stream->close(); + } + + public function testStreamReadingFreadException(): void + { + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to read from stream'); + + $r = StreamWrapper::getResource(new FnStream([ + 'read' => function ($len): string { + throw new \ErrorException('Some error'); + }, + 'isReadable' => function (): bool { + return true; + }, + 'isWritable' => function (): bool { + return false; + }, + 'eof' => function (): bool { + return false; + }, + ])); + + $stream = new Stream($r); + $stream->read(1); + } + + /** + * @requires extension zlib + * + * @dataProvider gzipModeProvider + */ + public function testGzipStreamModes(string $mode, bool $readable, bool $writable): void + { + $r = gzopen('php://temp', $mode); + $stream = new Stream($r); + + self::assertSame($readable, $stream->isReadable()); + self::assertSame($writable, $stream->isWritable()); + + $stream->close(); + } + + public function gzipModeProvider(): iterable + { + return [ + ['mode' => 'rb9', 'readable' => true, 'writable' => false], + ['mode' => 'wb2', 'readable' => false, 'writable' => true], + ]; + } + + /** + * @dataProvider readableModeProvider + */ + public function testReadableStream(string $mode): void + { + $r = fopen('php://temp', $mode); + $stream = new Stream($r); + + self::assertTrue($stream->isReadable()); + + $stream->close(); + } + + public function readableModeProvider(): iterable + { + return [ + ['r'], + ['w+'], + ['r+'], + ['x+'], + ['c+'], + ['rb'], + ['w+b'], + ['r+b'], + ['x+b'], + ['c+b'], + ['rt'], + ['w+t'], + ['r+t'], + ['x+t'], + ['c+t'], + ['a+'], + ['rb+'], + ]; + } + + public function testWriteOnlyStreamIsNotReadable(): void + { + $r = fopen('php://output', 'w'); + $stream = new Stream($r); + + self::assertFalse($stream->isReadable()); + + $stream->close(); + } + + /** + * @dataProvider writableModeProvider + */ + public function testWritableStream(string $mode): void + { + $r = fopen('php://temp', $mode); + $stream = new Stream($r); + + self::assertTrue($stream->isWritable()); + + $stream->close(); + } + + public function writableModeProvider(): iterable + { + return [ + ['w'], + ['w+'], + ['rw'], + ['r+'], + ['x+'], + ['c+'], + ['wb'], + ['w+b'], + ['r+b'], + ['rb+'], + ['x+b'], + ['c+b'], + ['w+t'], + ['r+t'], + ['x+t'], + ['c+t'], + ['a'], + ['a+'], + ]; + } + + public function testReadOnlyStreamIsNotWritable(): void + { + $r = fopen('php://input', 'r'); + $stream = new Stream($r); + + self::assertFalse($stream->isWritable()); + + $stream->close(); + } + + public function testCannotReadUnreadableStream(): void + { + $r = fopen(tempnam(sys_get_temp_dir(), 'guzzle-psr7-'), 'w'); + $stream = new Stream($r); + + $stream->write('Hello world!!'); + + $stream->seek(0); + + $this->expectException(\RuntimeException::class); + + try { + $stream->getContents(); + } finally { + $stream->close(); + } + } +} + +namespace GuzzleHttp\Psr7; + +use GuzzleHttp\Tests\Psr7\StreamTest; + +function fread($handle, $length) +{ + return StreamTest::$isFReadError ? false : \fread($handle, $length); +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamWrapperTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamWrapperTest.php new file mode 100644 index 0000000000..a7d77d2566 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/StreamWrapperTest.php @@ -0,0 +1,202 @@ + 0, + 'ino' => 0, + 'mode' => 33206, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 6, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => $stBlksize, + 'blocks' => $stBlksize, + 0 => 0, + 1 => 0, + 2 => 33206, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 6, + 8 => 0, + 9 => 0, + 10 => 0, + 11 => $stBlksize, + 12 => $stBlksize, + ], fstat($handle)); + + self::assertTrue(fclose($handle)); + self::assertSame('foobar', (string) $stream); + } + + public function testStreamContext(): void + { + $stream = Utils::streamFor('foo'); + + self::assertSame('foo', file_get_contents('guzzle://stream', false, StreamWrapper::createStreamContext($stream))); + } + + public function testStreamCast(): void + { + $streams = [ + StreamWrapper::getResource(Utils::streamFor('foo')), + StreamWrapper::getResource(Utils::streamFor('bar')), + ]; + $write = null; + $except = null; + self::assertIsInt(stream_select($streams, $write, $except, 0)); + } + + public function testValidatesStream(): void + { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('isReadable') + ->willReturn(false); + $stream->expects(self::once()) + ->method('isWritable') + ->willReturn(false); + + $this->expectException(\InvalidArgumentException::class); + StreamWrapper::getResource($stream); + } + + public function testReturnsFalseWhenStreamDoesNotExist(): void + { + $this->expectWarning(); + fopen('guzzle://foo', 'r'); + } + + public function testCanOpenReadonlyStream(): void + { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('isReadable') + ->willReturn(false); + $stream->expects(self::once()) + ->method('isWritable') + ->willReturn(true); + $r = StreamWrapper::getResource($stream); + self::assertIsResource($r); + fclose($r); + } + + public function testUrlStat(): void + { + StreamWrapper::register(); + + $stBlksize = defined('PHP_WINDOWS_VERSION_BUILD') ? -1 : 0; + + self::assertEquals( + [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => $stBlksize, + 'blocks' => $stBlksize, + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 0, + 9 => 0, + 10 => 0, + 11 => $stBlksize, + 12 => $stBlksize, + ], + stat('guzzle://stream') + ); + } + + /** + * @requires extension xmlreader + */ + public function testXmlReaderWithStream(): void + { + $stream = Utils::streamFor(''); + + StreamWrapper::register(); + libxml_set_streams_context(StreamWrapper::createStreamContext($stream)); + $reader = new \XMLReader(); + + self::assertTrue($reader->open('guzzle://stream')); + self::assertTrue($reader->read()); + self::assertSame('foo', $reader->name); + } + + /** + * @requires extension xmlreader + */ + public function testXmlWriterWithStream(): void + { + $stream = Utils::streamFor(fopen('php://memory', 'wb')); + + StreamWrapper::register(); + libxml_set_streams_context(StreamWrapper::createStreamContext($stream)); + $writer = new \XMLWriter(); + + self::assertTrue($writer->openURI('guzzle://stream')); + self::assertTrue($writer->startDocument()); + self::assertTrue($writer->writeElement('foo')); + self::assertTrue($writer->endDocument()); + + $stream->rewind(); + self::assertXmlStringEqualsXmlString('', (string) $stream); + } + + public function testWrappedNullSizedStreamStaysNullSized(): void + { + $nullSizedStream = new Psr7\PumpStream(function () { return ''; }); + $this->assertNull($nullSizedStream->getSize()); + + $resource = StreamWrapper::getResource($nullSizedStream); + $stream = Utils::streamFor($resource); + + $this->assertNull($stream->getSize()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UploadedFileTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UploadedFileTest.php new file mode 100644 index 0000000000..7807d7f783 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UploadedFileTest.php @@ -0,0 +1,210 @@ +cleanup = []; + } + + protected function tearDown(): void + { + foreach ($this->cleanup as $file) { + if (is_scalar($file) && file_exists($file)) { + unlink($file); + } + } + } + + public function invalidStreams() + { + return [ + 'null' => [null], + 'true' => [true], + 'false' => [false], + 'int' => [1], + 'float' => [1.1], + 'array' => [['filename']], + 'object' => [(object) ['filename']], + ]; + } + + /** + * @dataProvider invalidStreams + */ + public function testRaisesExceptionOnInvalidStreamOrFile($streamOrFile): void + { + $this->expectException(\InvalidArgumentException::class); + + new UploadedFile($streamOrFile, 0, UPLOAD_ERR_OK); + } + + public function testGetStreamReturnsOriginalStreamObject(): void + { + $stream = new Stream(fopen('php://temp', 'r')); + $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); + + self::assertSame($stream, $upload->getStream()); + } + + public function testGetStreamReturnsWrappedPhpStream(): void + { + $stream = fopen('php://temp', 'wb+'); + $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); + $uploadStream = $upload->getStream()->detach(); + + self::assertSame($stream, $uploadStream); + } + + public function testGetStreamReturnsStreamForFile(): void + { + $this->cleanup[] = $stream = tempnam(sys_get_temp_dir(), 'stream_file'); + $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); + $uploadStream = $upload->getStream(); + $r = new ReflectionProperty($uploadStream, 'filename'); + $r->setAccessible(true); + + self::assertSame($stream, $r->getValue($uploadStream)); + } + + public function testSuccessful(): void + { + $stream = \GuzzleHttp\Psr7\Utils::streamFor('Foo bar!'); + $upload = new UploadedFile($stream, $stream->getSize(), UPLOAD_ERR_OK, 'filename.txt', 'text/plain'); + + self::assertSame($stream->getSize(), $upload->getSize()); + self::assertSame('filename.txt', $upload->getClientFilename()); + self::assertSame('text/plain', $upload->getClientMediaType()); + + $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'successful'); + $upload->moveTo($to); + self::assertFileExists($to); + self::assertSame($stream->__toString(), file_get_contents($to)); + } + + public function invalidMovePaths(): iterable + { + return [ + 'null' => [null], + 'true' => [true], + 'false' => [false], + 'int' => [1], + 'float' => [1.1], + 'empty' => [''], + 'array' => [['filename']], + 'object' => [(object) ['filename']], + ]; + } + + /** + * @dataProvider invalidMovePaths + */ + public function testMoveRaisesExceptionForInvalidPath($path): void + { + $stream = \GuzzleHttp\Psr7\Utils::streamFor('Foo bar!'); + $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('path'); + $upload->moveTo($path); + } + + public function testMoveCannotBeCalledMoreThanOnce(): void + { + $stream = \GuzzleHttp\Psr7\Utils::streamFor('Foo bar!'); + $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); + + $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac'); + $upload->moveTo($to); + self::assertFileExists($to); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('moved'); + $upload->moveTo($to); + } + + public function testCannotRetrieveStreamAfterMove(): void + { + $stream = \GuzzleHttp\Psr7\Utils::streamFor('Foo bar!'); + $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); + + $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac'); + $upload->moveTo($to); + self::assertFileExists($to); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('moved'); + $upload->getStream(); + } + + public function nonOkErrorStatus(): iterable + { + return [ + 'UPLOAD_ERR_INI_SIZE' => [UPLOAD_ERR_INI_SIZE], + 'UPLOAD_ERR_FORM_SIZE' => [UPLOAD_ERR_FORM_SIZE], + 'UPLOAD_ERR_PARTIAL' => [UPLOAD_ERR_PARTIAL], + 'UPLOAD_ERR_NO_FILE' => [UPLOAD_ERR_NO_FILE], + 'UPLOAD_ERR_NO_TMP_DIR' => [UPLOAD_ERR_NO_TMP_DIR], + 'UPLOAD_ERR_CANT_WRITE' => [UPLOAD_ERR_CANT_WRITE], + 'UPLOAD_ERR_EXTENSION' => [UPLOAD_ERR_EXTENSION], + ]; + } + + /** + * @dataProvider nonOkErrorStatus + */ + public function testConstructorDoesNotRaiseExceptionForInvalidStreamWhenErrorStatusPresent($status): void + { + $uploadedFile = new UploadedFile('not ok', 0, $status); + self::assertSame($status, $uploadedFile->getError()); + } + + /** + * @dataProvider nonOkErrorStatus + */ + public function testMoveToRaisesExceptionWhenErrorStatusPresent($status): void + { + $uploadedFile = new UploadedFile('not ok', 0, $status); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('upload error'); + $uploadedFile->moveTo(__DIR__.'/'.bin2hex(random_bytes(20))); + } + + /** + * @dataProvider nonOkErrorStatus + */ + public function testGetStreamRaisesExceptionWhenErrorStatusPresent($status): void + { + $uploadedFile = new UploadedFile('not ok', 0, $status); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('upload error'); + $uploadedFile->getStream(); + } + + public function testMoveToCreatesStreamIfOnlyAFilenameWasProvided(): void + { + $this->cleanup[] = $from = tempnam(sys_get_temp_dir(), 'copy_from'); + $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'copy_to'); + + copy(__FILE__, $from); + + $uploadedFile = new UploadedFile($from, 100, UPLOAD_ERR_OK, basename($from), 'text/plain'); + $uploadedFile->moveTo($to); + + self::assertFileEquals(__FILE__, $to); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriComparatorTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriComparatorTest.php new file mode 100644 index 0000000000..69312a0039 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriComparatorTest.php @@ -0,0 +1,45 @@ +withPath("/$actualEncoding")->withQuery($actualEncoding); + + self::assertSame("/$actualEncoding?$actualEncoding", (string) $uri, 'Not normalized automatically beforehand'); + + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::CAPITALIZE_PERCENT_ENCODING); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame("/$expectEncoding?$expectEncoding", (string) $normalizedUri); + } + + /** + * @dataProvider getUnreservedCharacters + */ + public function testDecodeUnreservedCharacters(string $char): void + { + $percentEncoded = '%'.bin2hex($char); + // Add encoded reserved characters to test that those are not decoded and include the percent-encoded + // unreserved character both in lower and upper case to test the decoding is case-insensitive. + $encodedChars = $percentEncoded.'%2F%5B'.strtoupper($percentEncoded); + $uri = (new Uri())->withPath("/$encodedChars")->withQuery($encodedChars); + + self::assertSame("/$encodedChars?$encodedChars", (string) $uri, 'Not normalized automatically beforehand'); + + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::DECODE_UNRESERVED_CHARACTERS); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame("/$char%2F%5B$char?$char%2F%5B$char", (string) $normalizedUri); + } + + public function getUnreservedCharacters(): iterable + { + $unreservedChars = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9), ['-', '.', '_', '~']); + + return array_map(function ($char) { + return [(string) $char]; + }, $unreservedChars); + } + + /** + * @dataProvider getEmptyPathTestCases + */ + public function testConvertEmptyPath($uri, $expected): void + { + $normalizedUri = UriNormalizer::normalize(new Uri($uri), UriNormalizer::CONVERT_EMPTY_PATH); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame($expected, (string) $normalizedUri); + } + + public function getEmptyPathTestCases(): iterable + { + return [ + ['http://example.org', 'http://example.org/'], + ['https://example.org', 'https://example.org/'], + ['urn://example.org', 'urn://example.org'], + ]; + } + + public function testRemoveDefaultHost(): void + { + $uri = new Uri('file://localhost/myfile'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DEFAULT_HOST); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('file:///myfile', (string) $normalizedUri); + } + + public function testRemoveDefaultPort(): void + { + $uri = $this->createMock(UriInterface::class); + $uri->expects(self::any())->method('getScheme')->willReturn('http'); + $uri->expects(self::any())->method('getPort')->willReturn(80); + $uri->expects(self::once())->method('withPort')->with(null)->willReturn(new Uri('http://example.org')); + + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DEFAULT_PORT); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertNull($normalizedUri->getPort()); + } + + public function testRemoveDotSegments(): void + { + $uri = new Uri('http://example.org/../a/b/../c/./d.html'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DOT_SEGMENTS); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('http://example.org/a/c/d.html', (string) $normalizedUri); + } + + public function testRemoveDotSegmentsOfAbsolutePathReference(): void + { + $uri = new Uri('/../a/b/../c/./d.html'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DOT_SEGMENTS); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('/a/c/d.html', (string) $normalizedUri); + } + + public function testRemoveDotSegmentsOfRelativePathReference(): void + { + $uri = new Uri('../c/./d.html'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DOT_SEGMENTS); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('../c/./d.html', (string) $normalizedUri); + } + + public function testRemoveDuplicateSlashes(): void + { + $uri = new Uri('http://example.org//foo///bar/bam.html'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::REMOVE_DUPLICATE_SLASHES); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('http://example.org/foo/bar/bam.html', (string) $normalizedUri); + } + + public function testSortQueryParameters(): void + { + $uri = new Uri('?lang=en&article=fred'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::SORT_QUERY_PARAMETERS); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('?article=fred&lang=en', (string) $normalizedUri); + } + + public function testSortQueryParametersWithSameKeys(): void + { + $uri = new Uri('?a=b&b=c&a=a&a&b=a&b=b&a=d&a=c'); + $normalizedUri = UriNormalizer::normalize($uri, UriNormalizer::SORT_QUERY_PARAMETERS); + + self::assertInstanceOf(UriInterface::class, $normalizedUri); + self::assertSame('?a&a=a&a=b&a=c&a=d&b=a&b=b&b=c', (string) $normalizedUri); + } + + /** + * @dataProvider getEquivalentTestCases + */ + public function testIsEquivalent(string $uri1, string $uri2, bool $expected): void + { + $equivalent = UriNormalizer::isEquivalent(new Uri($uri1), new Uri($uri2)); + + self::assertSame($expected, $equivalent); + } + + public function getEquivalentTestCases(): iterable + { + return [ + ['http://example.org', 'http://example.org', true], + ['hTTp://eXaMpLe.org', 'http://example.org', true], + ['http://example.org/path?#', 'http://example.org/path', true], + ['http://example.org:80', 'http://example.org/', true], + ['http://example.org/../a/.././p%61th?%7a=%5e', 'http://example.org/path?z=%5E', true], + ['https://example.org/', 'http://example.org/', false], + ['https://example.org/', '//example.org/', false], + ['//example.org/', '//example.org/', true], + ['file:/myfile', 'file:///myfile', true], + ['file:///myfile', 'file://localhost/myfile', true], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriResolverTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriResolverTest.php new file mode 100644 index 0000000000..98d128a2d6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UriResolverTest.php @@ -0,0 +1,210 @@ +getScheme()); + self::assertSame('user:pass@example.com:8080', $uri->getAuthority()); + self::assertSame('user:pass', $uri->getUserInfo()); + self::assertSame('example.com', $uri->getHost()); + self::assertSame(8080, $uri->getPort()); + self::assertSame('/path/123', $uri->getPath()); + self::assertSame('q=abc', $uri->getQuery()); + self::assertSame('test', $uri->getFragment()); + self::assertSame('https://user:pass@example.com:8080/path/123?q=abc#test', (string) $uri); + } + + public function testCanTransformAndRetrievePartsIndividually(): void + { + $uri = (new Uri()) + ->withScheme('https') + ->withUserInfo('user', 'pass') + ->withHost('example.com') + ->withPort(8080) + ->withPath('/path/123') + ->withQuery('q=abc') + ->withFragment('test'); + + self::assertSame('https', $uri->getScheme()); + self::assertSame('user:pass@example.com:8080', $uri->getAuthority()); + self::assertSame('user:pass', $uri->getUserInfo()); + self::assertSame('example.com', $uri->getHost()); + self::assertSame(8080, $uri->getPort()); + self::assertSame('/path/123', $uri->getPath()); + self::assertSame('q=abc', $uri->getQuery()); + self::assertSame('test', $uri->getFragment()); + self::assertSame('https://user:pass@example.com:8080/path/123?q=abc#test', (string) $uri); + } + + /** + * @dataProvider getValidUris + */ + public function testValidUrisStayValid(string $input): void + { + $uri = new Uri($input); + + self::assertSame($input, (string) $uri); + } + + /** + * @dataProvider getValidUris + */ + public function testFromParts(string $input): void + { + $uri = Uri::fromParts(parse_url($input)); + + self::assertSame($input, (string) $uri); + } + + public function getValidUris(): iterable + { + return [ + ['urn:path-rootless'], + ['urn:path:with:colon'], + ['urn:/path-absolute'], + ['urn:/'], + // only scheme with empty path + ['urn:'], + // only path + ['/'], + ['relative/'], + ['0'], + // same document reference + [''], + // network path without scheme + ['//example.org'], + ['//example.org/'], + ['//example.org?q#h'], + // only query + ['?q'], + ['?q=abc&foo=bar'], + // only fragment + ['#fragment'], + // dot segments are not removed automatically + ['./foo/../bar'], + ]; + } + + /** + * @dataProvider getInvalidUris + */ + public function testInvalidUrisThrowException(string $invalidUri): void + { + $this->expectException(MalformedUriException::class); + new Uri($invalidUri); + } + + public function getInvalidUris(): iterable + { + return [ + // parse_url() requires the host component which makes sense for http(s) + // but not when the scheme is not known or different. So '//' or '///' is + // currently invalid as well but should not according to RFC 3986. + ['http://'], + ['urn://host:with:colon'], // host cannot contain ":" + ]; + } + + public function testPortMustBeValid(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid port: 100000. Must be between 0 and 65535'); + (new Uri())->withPort(100000); + } + + public function testWithPortCannotBeNegative(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid port: -1. Must be between 0 and 65535'); + (new Uri())->withPort(-1); + } + + public function testParseUriPortCannotBeNegative(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Unable to parse URI'); + new Uri('//example.com:-1'); + } + + public function testSchemeMustHaveCorrectType(): void + { + $this->expectException(\InvalidArgumentException::class); + (new Uri())->withScheme([]); + } + + public function testHostMustHaveCorrectType(): void + { + $this->expectException(\InvalidArgumentException::class); + (new Uri())->withHost([]); + } + + public function testPathMustHaveCorrectType(): void + { + $this->expectException(\InvalidArgumentException::class); + (new Uri())->withPath([]); + } + + public function testQueryMustHaveCorrectType(): void + { + $this->expectException(\InvalidArgumentException::class); + (new Uri())->withQuery([]); + } + + public function testFragmentMustHaveCorrectType(): void + { + $this->expectException(\InvalidArgumentException::class); + (new Uri())->withFragment([]); + } + + public function testCanParseFalseyUriParts(): void + { + $uri = new Uri('0://0:0@0/0?0#0'); + + self::assertSame('0', $uri->getScheme()); + self::assertSame('0:0@0', $uri->getAuthority()); + self::assertSame('0:0', $uri->getUserInfo()); + self::assertSame('0', $uri->getHost()); + self::assertSame('/0', $uri->getPath()); + self::assertSame('0', $uri->getQuery()); + self::assertSame('0', $uri->getFragment()); + self::assertSame('0://0:0@0/0?0#0', (string) $uri); + } + + public function testCanConstructFalseyUriParts(): void + { + $uri = (new Uri()) + ->withScheme('0') + ->withUserInfo('0', '0') + ->withHost('0') + ->withPath('/0') + ->withQuery('0') + ->withFragment('0'); + + self::assertSame('0', $uri->getScheme()); + self::assertSame('0:0@0', $uri->getAuthority()); + self::assertSame('0:0', $uri->getUserInfo()); + self::assertSame('0', $uri->getHost()); + self::assertSame('/0', $uri->getPath()); + self::assertSame('0', $uri->getQuery()); + self::assertSame('0', $uri->getFragment()); + self::assertSame('0://0:0@0/0?0#0', (string) $uri); + } + + /** + * @dataProvider getPortTestCases + */ + public function testIsDefaultPort(string $scheme, ?int $port, bool $isDefaultPort): void + { + $uri = $this->createMock(UriInterface::class); + $uri->expects(self::any())->method('getScheme')->willReturn($scheme); + $uri->expects(self::any())->method('getPort')->willReturn($port); + + self::assertSame($isDefaultPort, Uri::isDefaultPort($uri)); + } + + public function getPortTestCases(): iterable + { + return [ + ['http', null, true], + ['http', 80, true], + ['http', 8080, false], + ['https', null, true], + ['https', 443, true], + ['https', 444, false], + ['ftp', 21, true], + ['gopher', 70, true], + ['nntp', 119, true], + ['news', 119, true], + ['telnet', 23, true], + ['tn3270', 23, true], + ['imap', 143, true], + ['pop', 110, true], + ['ldap', 389, true], + ]; + } + + public function testIsAbsolute(): void + { + self::assertTrue(Uri::isAbsolute(new Uri('http://example.org'))); + self::assertFalse(Uri::isAbsolute(new Uri('//example.org'))); + self::assertFalse(Uri::isAbsolute(new Uri('/abs-path'))); + self::assertFalse(Uri::isAbsolute(new Uri('rel-path'))); + } + + public function testIsNetworkPathReference(): void + { + self::assertFalse(Uri::isNetworkPathReference(new Uri('http://example.org'))); + self::assertTrue(Uri::isNetworkPathReference(new Uri('//example.org'))); + self::assertFalse(Uri::isNetworkPathReference(new Uri('/abs-path'))); + self::assertFalse(Uri::isNetworkPathReference(new Uri('rel-path'))); + } + + public function testIsAbsolutePathReference(): void + { + self::assertFalse(Uri::isAbsolutePathReference(new Uri('http://example.org'))); + self::assertFalse(Uri::isAbsolutePathReference(new Uri('//example.org'))); + self::assertTrue(Uri::isAbsolutePathReference(new Uri('/abs-path'))); + self::assertTrue(Uri::isAbsolutePathReference(new Uri('/'))); + self::assertFalse(Uri::isAbsolutePathReference(new Uri('rel-path'))); + } + + public function testIsRelativePathReference(): void + { + self::assertFalse(Uri::isRelativePathReference(new Uri('http://example.org'))); + self::assertFalse(Uri::isRelativePathReference(new Uri('//example.org'))); + self::assertFalse(Uri::isRelativePathReference(new Uri('/abs-path'))); + self::assertTrue(Uri::isRelativePathReference(new Uri('rel-path'))); + self::assertTrue(Uri::isRelativePathReference(new Uri(''))); + } + + public function testIsSameDocumentReference(): void + { + self::assertFalse(Uri::isSameDocumentReference(new Uri('http://example.org'))); + self::assertFalse(Uri::isSameDocumentReference(new Uri('//example.org'))); + self::assertFalse(Uri::isSameDocumentReference(new Uri('/abs-path'))); + self::assertFalse(Uri::isSameDocumentReference(new Uri('rel-path'))); + self::assertFalse(Uri::isSameDocumentReference(new Uri('?query'))); + self::assertTrue(Uri::isSameDocumentReference(new Uri(''))); + self::assertTrue(Uri::isSameDocumentReference(new Uri('#fragment'))); + + $baseUri = new Uri('http://example.org/path?foo=bar'); + + self::assertTrue(Uri::isSameDocumentReference(new Uri('#fragment'), $baseUri)); + self::assertTrue(Uri::isSameDocumentReference(new Uri('?foo=bar#fragment'), $baseUri)); + self::assertTrue(Uri::isSameDocumentReference(new Uri('/path?foo=bar#fragment'), $baseUri)); + self::assertTrue(Uri::isSameDocumentReference(new Uri('path?foo=bar#fragment'), $baseUri)); + self::assertTrue(Uri::isSameDocumentReference(new Uri('//example.org/path?foo=bar#fragment'), $baseUri)); + self::assertTrue(Uri::isSameDocumentReference(new Uri('http://example.org/path?foo=bar#fragment'), $baseUri)); + + self::assertFalse(Uri::isSameDocumentReference(new Uri('https://example.org/path?foo=bar'), $baseUri)); + self::assertFalse(Uri::isSameDocumentReference(new Uri('http://example.com/path?foo=bar'), $baseUri)); + self::assertFalse(Uri::isSameDocumentReference(new Uri('http://example.org/'), $baseUri)); + self::assertFalse(Uri::isSameDocumentReference(new Uri('http://example.org'), $baseUri)); + + self::assertFalse(Uri::isSameDocumentReference(new Uri('urn:/path'), new Uri('urn://example.com/path'))); + } + + public function testAddAndRemoveQueryValues(): void + { + $uri = new Uri(); + $uri = Uri::withQueryValue($uri, 'a', 'b'); + $uri = Uri::withQueryValue($uri, 'c', 'd'); + $uri = Uri::withQueryValue($uri, 'e', null); + self::assertSame('a=b&c=d&e', $uri->getQuery()); + + $uri = Uri::withoutQueryValue($uri, 'c'); + self::assertSame('a=b&e', $uri->getQuery()); + $uri = Uri::withoutQueryValue($uri, 'e'); + self::assertSame('a=b', $uri->getQuery()); + $uri = Uri::withoutQueryValue($uri, 'a'); + self::assertSame('', $uri->getQuery()); + } + + public function testScalarQueryValues(): void + { + $uri = new Uri(); + $uri = Uri::withQueryValues($uri, [ + 2 => 2, + 1 => true, + 'false' => false, + 'float' => 3.1, + ]); + + self::assertSame('2=2&1=1&false=&float=3.1', $uri->getQuery()); + } + + public function testWithQueryValues(): void + { + $uri = new Uri(); + $uri = Uri::withQueryValues($uri, [ + 'key1' => 'value1', + 'key2' => 'value2', + ]); + + self::assertSame('key1=value1&key2=value2', $uri->getQuery()); + } + + public function testWithQueryValuesReplacesSameKeys(): void + { + $uri = new Uri(); + + $uri = Uri::withQueryValues($uri, [ + 'key1' => 'value1', + 'key2' => 'value2', + ]); + + $uri = Uri::withQueryValues($uri, [ + 'key2' => 'newvalue', + ]); + + self::assertSame('key1=value1&key2=newvalue', $uri->getQuery()); + } + + public function testWithQueryValueReplacesSameKeys(): void + { + $uri = new Uri(); + $uri = Uri::withQueryValue($uri, 'a', 'b'); + $uri = Uri::withQueryValue($uri, 'c', 'd'); + $uri = Uri::withQueryValue($uri, 'a', 'e'); + self::assertSame('c=d&a=e', $uri->getQuery()); + } + + public function testWithoutQueryValueRemovesAllSameKeys(): void + { + $uri = (new Uri())->withQuery('a=b&c=d&a=e'); + $uri = Uri::withoutQueryValue($uri, 'a'); + self::assertSame('c=d', $uri->getQuery()); + } + + public function testRemoveNonExistingQueryValue(): void + { + $uri = new Uri(); + $uri = Uri::withQueryValue($uri, 'a', 'b'); + $uri = Uri::withoutQueryValue($uri, 'c'); + self::assertSame('a=b', $uri->getQuery()); + } + + public function testWithQueryValueHandlesEncoding(): void + { + $uri = new Uri(); + $uri = Uri::withQueryValue($uri, 'E=mc^2', 'ein&stein'); + self::assertSame('E%3Dmc%5E2=ein%26stein', $uri->getQuery(), 'Decoded key/value get encoded'); + + $uri = new Uri(); + $uri = Uri::withQueryValue($uri, 'E%3Dmc%5e2', 'ein%26stein'); + self::assertSame('E%3Dmc%5e2=ein%26stein', $uri->getQuery(), 'Encoded key/value do not get double-encoded'); + } + + public function testWithoutQueryValueHandlesEncoding(): void + { + // It also tests that the case of the percent-encoding does not matter, + // i.e. both lowercase "%3d" and uppercase "%5E" can be removed. + $uri = (new Uri())->withQuery('E%3dmc%5E2=einstein&foo=bar'); + $uri = Uri::withoutQueryValue($uri, 'E=mc^2'); + self::assertSame('foo=bar', $uri->getQuery(), 'Handles key in decoded form'); + + $uri = (new Uri())->withQuery('E%3dmc%5E2=einstein&foo=bar'); + $uri = Uri::withoutQueryValue($uri, 'E%3Dmc%5e2'); + self::assertSame('foo=bar', $uri->getQuery(), 'Handles key in encoded form'); + } + + public function testSchemeIsNormalizedToLowercase(): void + { + $uri = new Uri('HTTP://example.com'); + + self::assertSame('http', $uri->getScheme()); + self::assertSame('http://example.com', (string) $uri); + + $uri = (new Uri('//example.com'))->withScheme('HTTP'); + + self::assertSame('http', $uri->getScheme()); + self::assertSame('http://example.com', (string) $uri); + } + + public function testHostIsNormalizedToLowercase(): void + { + $uri = new Uri('//eXaMpLe.CoM'); + + self::assertSame('example.com', $uri->getHost()); + self::assertSame('//example.com', (string) $uri); + + $uri = (new Uri())->withHost('eXaMpLe.CoM'); + + self::assertSame('example.com', $uri->getHost()); + self::assertSame('//example.com', (string) $uri); + } + + public function testPortIsNullIfStandardPortForScheme(): void + { + // HTTPS standard port + $uri = new Uri('https://example.com:443'); + self::assertNull($uri->getPort()); + self::assertSame('example.com', $uri->getAuthority()); + + $uri = (new Uri('https://example.com'))->withPort(443); + self::assertNull($uri->getPort()); + self::assertSame('example.com', $uri->getAuthority()); + + // HTTP standard port + $uri = new Uri('http://example.com:80'); + self::assertNull($uri->getPort()); + self::assertSame('example.com', $uri->getAuthority()); + + $uri = (new Uri('http://example.com'))->withPort(80); + self::assertNull($uri->getPort()); + self::assertSame('example.com', $uri->getAuthority()); + } + + public function testPortIsReturnedIfSchemeUnknown(): void + { + $uri = (new Uri('//example.com'))->withPort(80); + + self::assertSame(80, $uri->getPort()); + self::assertSame('example.com:80', $uri->getAuthority()); + } + + public function testStandardPortIsNullIfSchemeChanges(): void + { + $uri = new Uri('http://example.com:443'); + self::assertSame('http', $uri->getScheme()); + self::assertSame(443, $uri->getPort()); + + $uri = $uri->withScheme('https'); + self::assertNull($uri->getPort()); + } + + public function testPortPassedAsStringIsCastedToInt(): void + { + $uri = (new Uri('//example.com'))->withPort('8080'); + + self::assertSame(8080, $uri->getPort(), 'Port is returned as integer'); + self::assertSame('example.com:8080', $uri->getAuthority()); + } + + public function testPortCanBeRemoved(): void + { + $uri = (new Uri('http://example.com:8080'))->withPort(null); + + self::assertNull($uri->getPort()); + self::assertSame('http://example.com', (string) $uri); + } + + /** + * In RFC 8986 the host is optional and the authority can only + * consist of the user info and port. + */ + public function testAuthorityWithUserInfoOrPortButWithoutHost(): void + { + $uri = (new Uri())->withUserInfo('user', 'pass'); + + self::assertSame('user:pass', $uri->getUserInfo()); + self::assertSame('user:pass@', $uri->getAuthority()); + + $uri = $uri->withPort(8080); + self::assertSame(8080, $uri->getPort()); + self::assertSame('user:pass@:8080', $uri->getAuthority()); + self::assertSame('//user:pass@:8080', (string) $uri); + + $uri = $uri->withUserInfo(''); + self::assertSame(':8080', $uri->getAuthority()); + } + + public function testHostInHttpUriDefaultsToLocalhost(): void + { + $uri = (new Uri())->withScheme('http'); + + self::assertSame('localhost', $uri->getHost()); + self::assertSame('localhost', $uri->getAuthority()); + self::assertSame('http://localhost', (string) $uri); + } + + public function testHostInHttpsUriDefaultsToLocalhost(): void + { + $uri = (new Uri())->withScheme('https'); + + self::assertSame('localhost', $uri->getHost()); + self::assertSame('localhost', $uri->getAuthority()); + self::assertSame('https://localhost', (string) $uri); + } + + public function testFileSchemeWithEmptyHostReconstruction(): void + { + $uri = new Uri('file:///tmp/filename.ext'); + + self::assertSame('', $uri->getHost()); + self::assertSame('', $uri->getAuthority()); + self::assertSame('file:///tmp/filename.ext', (string) $uri); + } + + public function uriComponentsEncodingProvider(): iterable + { + $unreserved = 'a-zA-Z0-9.-_~!$&\'()*+,;=:@'; + + return [ + // Percent encode spaces + ['/pa th?q=va lue#frag ment', '/pa%20th', 'q=va%20lue', 'frag%20ment', '/pa%20th?q=va%20lue#frag%20ment'], + // Percent encode multibyte + ['/€?€#€', '/%E2%82%AC', '%E2%82%AC', '%E2%82%AC', '/%E2%82%AC?%E2%82%AC#%E2%82%AC'], + // Don't encode something that's already encoded + ['/pa%20th?q=va%20lue#frag%20ment', '/pa%20th', 'q=va%20lue', 'frag%20ment', '/pa%20th?q=va%20lue#frag%20ment'], + // Percent encode invalid percent encodings + ['/pa%2-th?q=va%2-lue#frag%2-ment', '/pa%252-th', 'q=va%252-lue', 'frag%252-ment', '/pa%252-th?q=va%252-lue#frag%252-ment'], + // Don't encode path segments + ['/pa/th//two?q=va/lue#frag/ment', '/pa/th//two', 'q=va/lue', 'frag/ment', '/pa/th//two?q=va/lue#frag/ment'], + // Don't encode unreserved chars or sub-delimiters + ["/$unreserved?$unreserved#$unreserved", "/$unreserved", $unreserved, $unreserved, "/$unreserved?$unreserved#$unreserved"], + // Encoded unreserved chars are not decoded + ['/p%61th?q=v%61lue#fr%61gment', '/p%61th', 'q=v%61lue', 'fr%61gment', '/p%61th?q=v%61lue#fr%61gment'], + ]; + } + + /** + * @dataProvider uriComponentsEncodingProvider + */ + public function testUriComponentsGetEncodedProperly(string $input, string $path, string $query, string $fragment, string $output): void + { + $uri = new Uri($input); + self::assertSame($path, $uri->getPath()); + self::assertSame($query, $uri->getQuery()); + self::assertSame($fragment, $uri->getFragment()); + self::assertSame($output, (string) $uri); + } + + public function testWithPathEncodesProperly(): void + { + $uri = (new Uri())->withPath('/baz?#€/b%61r'); + // Query and fragment delimiters and multibyte chars are encoded. + self::assertSame('/baz%3F%23%E2%82%AC/b%61r', $uri->getPath()); + self::assertSame('/baz%3F%23%E2%82%AC/b%61r', (string) $uri); + } + + public function testWithQueryEncodesProperly(): void + { + $uri = (new Uri())->withQuery('?=#&€=/&b%61r'); + // A query starting with a "?" is valid and must not be magically removed. Otherwise it would be impossible to + // construct such an URI. Also the "?" and "/" does not need to be encoded in the query. + self::assertSame('?=%23&%E2%82%AC=/&b%61r', $uri->getQuery()); + self::assertSame('??=%23&%E2%82%AC=/&b%61r', (string) $uri); + } + + public function testWithFragmentEncodesProperly(): void + { + $uri = (new Uri())->withFragment('#€?/b%61r'); + // A fragment starting with a "#" is valid and must not be magically removed. Otherwise it would be impossible to + // construct such an URI. Also the "?" and "/" does not need to be encoded in the fragment. + self::assertSame('%23%E2%82%AC?/b%61r', $uri->getFragment()); + self::assertSame('#%23%E2%82%AC?/b%61r', (string) $uri); + } + + public function testAllowsForRelativeUri(): void + { + $uri = (new Uri())->withPath('foo'); + self::assertSame('foo', $uri->getPath()); + self::assertSame('foo', (string) $uri); + } + + public function testRelativePathAndAuthority(): void + { + $uri = (new Uri())->withHost('example.com')->withPath('foo'); + self::assertSame('foo', $uri->getPath()); + self::assertSame('//example.com/foo', $uri->__toString()); + } + + public function testPathStartingWithTwoSlashesAndNoAuthorityIsInvalid(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('The path of a URI without an authority must not start with two slashes "//"'); + // URI "//foo" would be interpreted as network reference and thus change the original path to the host + (new Uri())->withPath('//foo'); + } + + public function testPathStartingWithTwoSlashes(): void + { + $uri = new Uri('http://example.org//path-not-host.com'); + self::assertSame('//path-not-host.com', $uri->getPath()); + + $uri = $uri->withScheme(''); + self::assertSame('//example.org//path-not-host.com', (string) $uri); // This is still valid + $this->expectException(\InvalidArgumentException::class); + $uri->withHost(''); // Now it becomes invalid + } + + public function testRelativeUriWithPathBeginngWithColonSegmentIsInvalid(): void + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('A relative URI must not have a path beginning with a segment containing a colon'); + (new Uri())->withPath('mailto:foo'); + } + + public function testRelativeUriWithPathHavingColonSegment(): void + { + $uri = (new Uri('urn:/mailto:foo'))->withScheme(''); + self::assertSame('/mailto:foo', $uri->getPath()); + + $this->expectException(\InvalidArgumentException::class); + (new Uri('urn:mailto:foo'))->withScheme(''); + } + + public function testDefaultReturnValuesOfGetters(): void + { + $uri = new Uri(); + + self::assertSame('', $uri->getScheme()); + self::assertSame('', $uri->getAuthority()); + self::assertSame('', $uri->getUserInfo()); + self::assertSame('', $uri->getHost()); + self::assertNull($uri->getPort()); + self::assertSame('', $uri->getPath()); + self::assertSame('', $uri->getQuery()); + self::assertSame('', $uri->getFragment()); + } + + public function testImmutability(): void + { + $uri = new Uri(); + + self::assertNotSame($uri, $uri->withScheme('https')); + self::assertNotSame($uri, $uri->withUserInfo('user', 'pass')); + self::assertNotSame($uri, $uri->withHost('example.com')); + self::assertNotSame($uri, $uri->withPort(8080)); + self::assertNotSame($uri, $uri->withPath('/path/123')); + self::assertNotSame($uri, $uri->withQuery('q=abc')); + self::assertNotSame($uri, $uri->withFragment('test')); + } + + public function testExtendingClassesInstantiates(): void + { + // The non-standard port triggers a cascade of private methods which + // should not use late static binding to access private static members. + // If they do, this will fatal. + self::assertInstanceOf( + ExtendedUriTest::class, + new ExtendedUriTest('http://h:9/') + ); + } + + public function testSpecialCharsOfUserInfo(): void + { + // The `userInfo` must always be URL-encoded. + $uri = (new Uri())->withUserInfo('foo@bar.com', 'pass#word'); + self::assertSame('foo%40bar.com:pass%23word', $uri->getUserInfo()); + + // The `userInfo` can already be URL-encoded: it should not be encoded twice. + $uri = (new Uri())->withUserInfo('foo%40bar.com', 'pass%23word'); + self::assertSame('foo%40bar.com:pass%23word', $uri->getUserInfo()); + } + + public function testInternationalizedDomainName(): void + { + $uri = new Uri('https://яндекс.рф'); + self::assertSame('яндекс.рф', $uri->getHost()); + + $uri = new Uri('https://яндекAс.рф'); + self::assertSame('яндекaс.рф', $uri->getHost()); + } + + public function testIPv6Host(): void + { + $uri = new Uri('https://[2a00:f48:1008::212:183:10]'); + self::assertSame('[2a00:f48:1008::212:183:10]', $uri->getHost()); + + $uri = new Uri('http://[2a00:f48:1008::212:183:10]:56?foo=bar'); + self::assertSame('[2a00:f48:1008::212:183:10]', $uri->getHost()); + self::assertSame(56, $uri->getPort()); + self::assertSame('foo=bar', $uri->getQuery()); + } + + public function testJsonSerializable(): void + { + $uri = new Uri('https://example.com'); + + self::assertSame('{"uri":"https:\/\/example.com"}', \json_encode(['uri' => $uri])); + } +} + +class ExtendedUriTest extends Uri +{ +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UtilsTest.php b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UtilsTest.php new file mode 100644 index 0000000000..3f3fd7709b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/tests/UtilsTest.php @@ -0,0 +1,551 @@ +seek(0); + self::assertSame('foo', Psr7\Utils::copyToString($s, 3)); + self::assertSame('baz', Psr7\Utils::copyToString($s, 3)); + self::assertSame('', Psr7\Utils::copyToString($s)); + } + + public function testCopiesToStringStopsWhenReadFails(): void + { + $s1 = Psr7\Utils::streamFor('foobaz'); + $s1 = FnStream::decorate($s1, [ + 'read' => function () { + return ''; + }, + ]); + $result = Psr7\Utils::copyToString($s1); + self::assertSame('', $result); + } + + public function testCopiesToStream(): void + { + $s1 = Psr7\Utils::streamFor('foobaz'); + $s2 = Psr7\Utils::streamFor(''); + Psr7\Utils::copyToStream($s1, $s2); + self::assertSame('foobaz', (string) $s2); + $s2 = Psr7\Utils::streamFor(''); + $s1->seek(0); + Psr7\Utils::copyToStream($s1, $s2, 3); + self::assertSame('foo', (string) $s2); + Psr7\Utils::copyToStream($s1, $s2, 3); + self::assertSame('foobaz', (string) $s2); + } + + public function testStopsCopyToStreamWhenWriteFails(): void + { + $s1 = Psr7\Utils::streamFor('foobaz'); + $s2 = Psr7\Utils::streamFor(''); + $s2 = FnStream::decorate($s2, [ + 'write' => function () { + return 0; + }, + ]); + Psr7\Utils::copyToStream($s1, $s2); + self::assertSame('', (string) $s2); + } + + public function testStopsCopyToSteamWhenWriteFailsWithMaxLen(): void + { + $s1 = Psr7\Utils::streamFor('foobaz'); + $s2 = Psr7\Utils::streamFor(''); + $s2 = FnStream::decorate($s2, [ + 'write' => function () { + return 0; + }, + ]); + Psr7\Utils::copyToStream($s1, $s2, 10); + self::assertSame('', (string) $s2); + } + + public function testCopyToStreamReadsInChunksInsteadOfAllInMemory(): void + { + $sizes = []; + $s1 = new FnStream([ + 'eof' => function () { + return false; + }, + 'read' => function ($size) use (&$sizes) { + $sizes[] = $size; + + return str_repeat('.', $size); + }, + ]); + $s2 = Psr7\Utils::streamFor(''); + Psr7\Utils::copyToStream($s1, $s2, 16394); + $s2->seek(0); + self::assertSame(16394, strlen($s2->getContents())); + self::assertSame(8192, $sizes[0]); + self::assertSame(8192, $sizes[1]); + self::assertSame(10, $sizes[2]); + } + + public function testStopsCopyToSteamWhenReadFailsWithMaxLen(): void + { + $s1 = Psr7\Utils::streamFor('foobaz'); + $s1 = FnStream::decorate($s1, [ + 'read' => function () { + return ''; + }, + ]); + $s2 = Psr7\Utils::streamFor(''); + Psr7\Utils::copyToStream($s1, $s2, 10); + self::assertSame('', (string) $s2); + } + + public function testReadsLines(): void + { + $s = Psr7\Utils::streamFor("foo\nbaz\nbar"); + self::assertSame("foo\n", Psr7\Utils::readLine($s)); + self::assertSame("baz\n", Psr7\Utils::readLine($s)); + self::assertSame('bar', Psr7\Utils::readLine($s)); + } + + public function testReadsLinesUpToMaxLength(): void + { + $s = Psr7\Utils::streamFor("12345\n"); + self::assertSame('123', Psr7\Utils::readLine($s, 4)); + self::assertSame("45\n", Psr7\Utils::readLine($s)); + } + + public function testReadLinesEof(): void + { + // Should return empty string on EOF + $s = Psr7\Utils::streamFor("foo\nbar"); + while (!$s->eof()) { + Psr7\Utils::readLine($s); + } + self::assertSame('', Psr7\Utils::readLine($s)); + } + + public function testReadsLineUntilEmptyStringReturnedFromRead(): void + { + $s = $this->createMock(StreamInterface::class); + $s->expects(self::exactly(2)) + ->method('read') + ->willReturnCallback(function () { + static $called = false; + if ($called) { + return ''; + } + $called = true; + + return 'h'; + }); + $s->expects(self::exactly(2)) + ->method('eof') + ->willReturn(false); + self::assertSame('h', Psr7\Utils::readLine($s)); + } + + public function testRedactUserInfo(): void + { + $uri = new Psr7\Uri('http://my_user:secretPass@localhost/'); + + $redactedUri = Psr7\Utils::redactUserInfo($uri); + + self::assertSame('http://my_user:***@localhost/', (string) $redactedUri); + } + + public function testCalculatesHash(): void + { + $s = Psr7\Utils::streamFor('foobazbar'); + self::assertSame(md5('foobazbar'), Psr7\Utils::hash($s, 'md5')); + } + + public function testCalculatesHashThrowsWhenSeekFails(): void + { + $s = new NoSeekStream(Psr7\Utils::streamFor('foobazbar')); + $s->read(2); + + $this->expectException(\RuntimeException::class); + + Psr7\Utils::hash($s, 'md5'); + } + + public function testCalculatesHashSeeksToOriginalPosition(): void + { + $s = Psr7\Utils::streamFor('foobazbar'); + $s->seek(4); + self::assertSame(md5('foobazbar'), Psr7\Utils::hash($s, 'md5')); + self::assertSame(4, $s->tell()); + } + + public function testOpensFilesSuccessfully(): void + { + $r = Psr7\Utils::tryFopen(__FILE__, 'r'); + self::assertIsResource($r); + fclose($r); + } + + public function testThrowsExceptionNotWarning(): void + { + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to open "/path/to/does/not/exist" using mode "r"'); + + Psr7\Utils::tryFopen('/path/to/does/not/exist', 'r'); + } + + public function testThrowsExceptionNotValueError(): void + { + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to open "" using mode "r"'); + + Psr7\Utils::tryFopen('', 'r'); + } + + /** + * @requires PHP 7.4 + */ + public function testGetsContentsThrowExceptionWhenNotReadable(): void + { + $r = fopen(tempnam(sys_get_temp_dir(), 'guzzle-psr7-'), 'w'); + fwrite($r, 'hello world!'); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to read stream contents'); + + try { + Psr7\Utils::tryGetContents($r); + } finally { + fclose($r); + } + } + + public function testGetsContentsThrowExceptionWhenCLosed(): void + { + $r = fopen(tempnam(sys_get_temp_dir(), 'guzzle-psr7-'), 'r+'); + fclose($r); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Unable to read stream contents'); + + Psr7\Utils::tryGetContents($r); + } + + public function testCreatesUriForValue(): void + { + self::assertInstanceOf('GuzzleHttp\Psr7\Uri', Psr7\Utils::uriFor('/foo')); + self::assertInstanceOf( + 'GuzzleHttp\Psr7\Uri', + Psr7\Utils::uriFor(new Psr7\Uri('/foo')) + ); + } + + public function testValidatesUri(): void + { + $this->expectException(\InvalidArgumentException::class); + + Psr7\Utils::uriFor([]); + } + + public function testKeepsPositionOfResource(): void + { + $h = fopen(__FILE__, 'r'); + fseek($h, 10); + $stream = Psr7\Utils::streamFor($h); + self::assertSame(10, $stream->tell()); + $stream->close(); + } + + public function testCreatesWithFactory(): void + { + $stream = Psr7\Utils::streamFor('foo'); + self::assertInstanceOf('GuzzleHttp\Psr7\Stream', $stream); + self::assertSame('foo', $stream->getContents()); + $stream->close(); + } + + public function testFactoryCreatesFromEmptyString(): void + { + $s = Psr7\Utils::streamFor(); + self::assertInstanceOf('GuzzleHttp\Psr7\Stream', $s); + } + + public function testFactoryCreatesFromNull(): void + { + $s = Psr7\Utils::streamFor(null); + self::assertInstanceOf('GuzzleHttp\Psr7\Stream', $s); + } + + public function testFactoryCreatesFromResource(): void + { + $r = fopen(__FILE__, 'r'); + $s = Psr7\Utils::streamFor($r); + self::assertInstanceOf('GuzzleHttp\Psr7\Stream', $s); + self::assertSame(file_get_contents(__FILE__), (string) $s); + } + + public function testFactoryCreatesFromObjectWithToString(): void + { + $r = new HasToString(); + $s = Psr7\Utils::streamFor($r); + self::assertInstanceOf('GuzzleHttp\Psr7\Stream', $s); + self::assertSame('foo', (string) $s); + } + + public function testCreatePassesThrough(): void + { + $s = Psr7\Utils::streamFor('foo'); + self::assertSame($s, Psr7\Utils::streamFor($s)); + } + + public function testThrowsExceptionForUnknown(): void + { + $this->expectException(\InvalidArgumentException::class); + + Psr7\Utils::streamFor(new \stdClass()); + } + + public function testReturnsCustomMetadata(): void + { + $s = Psr7\Utils::streamFor('foo', ['metadata' => ['hwm' => 3]]); + self::assertSame(3, $s->getMetadata('hwm')); + self::assertArrayHasKey('hwm', $s->getMetadata()); + } + + public function testCanSetSize(): void + { + $s = Psr7\Utils::streamFor('', ['size' => 10]); + self::assertSame(10, $s->getSize()); + } + + public function testCanCreateIteratorBasedStream(): void + { + $a = new \ArrayIterator(['foo', 'bar', '123']); + $p = Psr7\Utils::streamFor($a); + self::assertInstanceOf('GuzzleHttp\Psr7\PumpStream', $p); + self::assertSame('foo', $p->read(3)); + self::assertFalse($p->eof()); + self::assertSame('b', $p->read(1)); + self::assertSame('a', $p->read(1)); + self::assertSame('r12', $p->read(3)); + self::assertFalse($p->eof()); + self::assertSame('3', $p->getContents()); + self::assertTrue($p->eof()); + self::assertSame(9, $p->tell()); + } + + public function testConvertsRequestsToStrings(): void + { + $request = new Psr7\Request('PUT', 'http://foo.com/hi?123', [ + 'Baz' => 'bar', + 'Qux' => 'ipsum', + ], 'hello', '1.0'); + self::assertSame( + "PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello", + Psr7\Message::toString($request) + ); + } + + public function testConvertsResponsesToStrings(): void + { + $response = new Psr7\Response(200, [ + 'Baz' => 'bar', + 'Qux' => 'ipsum', + ], 'hello', '1.0', 'FOO'); + self::assertSame( + "HTTP/1.0 200 FOO\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello", + Psr7\Message::toString($response) + ); + } + + public function testCorrectlyRendersSetCookieHeadersToString(): void + { + $response = new Psr7\Response(200, [ + 'Set-Cookie' => ['bar', 'baz', 'qux'], + ], 'hello', '1.0', 'FOO'); + self::assertSame( + "HTTP/1.0 200 FOO\r\nSet-Cookie: bar\r\nSet-Cookie: baz\r\nSet-Cookie: qux\r\n\r\nhello", + Psr7\Message::toString($response) + ); + } + + public function testCanModifyRequestWithUri(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, [ + 'uri' => new Psr7\Uri('http://www.foo.com'), + ]); + self::assertSame('http://www.foo.com', (string) $r2->getUri()); + self::assertSame('www.foo.com', (string) $r2->getHeaderLine('host')); + } + + public function testCanModifyRequestWithUriAndPort(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com:8000'); + $r2 = Psr7\Utils::modifyRequest($r1, [ + 'uri' => new Psr7\Uri('http://www.foo.com:8000'), + ]); + self::assertSame('http://www.foo.com:8000', (string) $r2->getUri()); + self::assertSame('www.foo.com:8000', (string) $r2->getHeaderLine('host')); + } + + public function testCanModifyRequestWithCaseInsensitiveHeader(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com', ['User-Agent' => 'foo']); + $r2 = Psr7\Utils::modifyRequest($r1, ['set_headers' => ['User-agent' => 'bar']]); + self::assertSame('bar', $r2->getHeaderLine('User-Agent')); + self::assertSame('bar', $r2->getHeaderLine('User-agent')); + } + + public function testReturnsAsIsWhenNoChanges(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, []); + self::assertInstanceOf('GuzzleHttp\Psr7\Request', $r2); + + $r1 = new Psr7\ServerRequest('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, []); + self::assertInstanceOf('Psr\Http\Message\ServerRequestInterface', $r2); + } + + public function testReturnsUriAsIsWhenNoChanges(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, ['set_headers' => ['foo' => 'bar']]); + self::assertNotSame($r1, $r2); + self::assertSame('bar', $r2->getHeaderLine('foo')); + } + + public function testRemovesHeadersFromMessage(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com', ['foo' => 'bar']); + $r2 = Psr7\Utils::modifyRequest($r1, ['remove_headers' => ['foo']]); + self::assertNotSame($r1, $r2); + self::assertFalse($r2->hasHeader('foo')); + } + + public function testAddsQueryToUri(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, ['query' => 'foo=bar']); + self::assertNotSame($r1, $r2); + self::assertSame('foo=bar', $r2->getUri()->getQuery()); + } + + public function testModifyRequestKeepInstanceOfRequest(): void + { + $r1 = new Psr7\Request('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, ['remove_headers' => ['non-existent']]); + self::assertInstanceOf('GuzzleHttp\Psr7\Request', $r2); + + $r1 = new Psr7\ServerRequest('GET', 'http://foo.com'); + $r2 = Psr7\Utils::modifyRequest($r1, ['remove_headers' => ['non-existent']]); + self::assertInstanceOf('Psr\Http\Message\ServerRequestInterface', $r2); + } + + public function testModifyServerRequestWithUploadedFiles(): void + { + $request = new Psr7\ServerRequest('GET', 'http://example.com/bla'); + $file = new Psr7\UploadedFile('Test', 100, \UPLOAD_ERR_OK); + $request = $request->withUploadedFiles([$file]); + + /** @var Psr7\ServerRequest $modifiedRequest */ + $modifiedRequest = Psr7\Utils::modifyRequest($request, ['set_headers' => ['foo' => 'bar']]); + + self::assertCount(1, $modifiedRequest->getUploadedFiles()); + + $files = $modifiedRequest->getUploadedFiles(); + self::assertInstanceOf('GuzzleHttp\Psr7\UploadedFile', $files[0]); + } + + public function testModifyServerRequestWithCookies(): void + { + $request = (new Psr7\ServerRequest('GET', 'http://example.com/bla')) + ->withCookieParams(['name' => 'value']); + + /** @var Psr7\ServerRequest $modifiedRequest */ + $modifiedRequest = Psr7\Utils::modifyRequest($request, ['set_headers' => ['foo' => 'bar']]); + + self::assertSame(['name' => 'value'], $modifiedRequest->getCookieParams()); + } + + public function testModifyServerRequestParsedBody(): void + { + $request = (new Psr7\ServerRequest('GET', 'http://example.com/bla')) + ->withParsedBody(['name' => 'value']); + + /** @var Psr7\ServerRequest $modifiedRequest */ + $modifiedRequest = Psr7\Utils::modifyRequest($request, ['set_headers' => ['foo' => 'bar']]); + + self::assertSame(['name' => 'value'], $modifiedRequest->getParsedBody()); + } + + public function testModifyServerRequestQueryParams(): void + { + $request = (new Psr7\ServerRequest('GET', 'http://example.com/bla')) + ->withQueryParams(['name' => 'value']); + + /** @var Psr7\ServerRequest $modifiedRequest */ + $modifiedRequest = Psr7\Utils::modifyRequest($request, ['set_headers' => ['foo' => 'bar']]); + + self::assertSame(['name' => 'value'], $modifiedRequest->getQueryParams()); + } + + public function testModifyServerRequestRetainsAttributes(): void + { + $request = (new Psr7\ServerRequest('GET', 'http://example.com/bla')) + ->withAttribute('foo', 'bar'); + + /** @var Psr7\ServerRequest $modifiedRequest */ + $modifiedRequest = Psr7\Utils::modifyRequest($request, []); + + self::assertSame(['foo' => 'bar'], $modifiedRequest->getAttributes()); + } + + /** + * @return list + */ + public function providesCaselessRemoveCases(): array + { + return [ + [ + ['foo-bar'], + ['Foo-Bar' => 'hello'], + [], + ], + [ + ['foo-bar'], + ['hello'], + ['hello'], + ], + [ + ['foo-Bar'], + ['Foo-Bar' => 'hello', 123 => '', 'Foo-BAR' => 'hello123', 'foobar' => 'baz'], + [123 => '', 'foobar' => 'baz'], + ], + [ + ['foo-Bar', 123], + ['Foo-Bar' => 'hello', 123 => '', 'Foo-BAR' => 'hello123', 'foobar' => 'baz'], + ['foobar' => 'baz'], + ], + ]; + } + + /** + * @dataProvider providesCaselessRemoveCases + * + * @param string[] $keys + */ + public function testCaselessRemove(array $keys, array $data, array $expected): void + { + self::assertSame($expected, Psr7\Utils::caselessRemove($keys, $data)); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json new file mode 100644 index 0000000000..72998c7515 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/php-cs-fixer/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "friendsofphp/php-cs-fixer": "3.59.3" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/phpstan/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/phpstan/composer.json new file mode 100644 index 0000000000..77598be97b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/phpstan/composer.json @@ -0,0 +1,10 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "1.11.7", + "phpstan/phpstan-deprecation-rules": "1.2.0" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/psalm/composer.json b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/psalm/composer.json new file mode 100644 index 0000000000..020abe5626 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/guzzlehttp/psr7/vendor-bin/psalm/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "php": "^7.4 || ^8.0", + "psalm/phar": "5.25.0" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitattributes b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitattributes new file mode 100644 index 0000000000..fa7bcf7d05 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitattributes @@ -0,0 +1,12 @@ +/.gitattributes export-ignore +/.github/ export-ignore +/.gitignore export-ignore +/CHANGELOG.md export-ignore +/codecov.yml export-ignore +/CODE_OF_CONDUCT.md export-ignore +/CONTRIBUTING.md export-ignore +/CREDITS.md export-ignore +/docs/ export-ignore +/phpunit.xml export-ignore +/README.PROVIDER-GUIDE.md export-ignore +/test/ export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/ISSUE_TEMPLATE.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..ba60581613 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/ISSUE_TEMPLATE.md @@ -0,0 +1 @@ +The `docs/` directory is what powers the website [oauth2-client.thephpleague.com](https://oauth2-client.thephpleague.com/). Modifying links to work in the Github file browser will break the website. Please do not open a new Issue to report "the broken documentation links"; they will be promptly closed. diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/PULL_REQUEST_TEMPLATE.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..6284e271ba --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +The `docs/` directory is what powers the website [oauth2-client.thephpleague.com](https://oauth2-client.thephpleague.com/). Modifying links to work in the Github file browser will break the website. Please do not open a new Pull Request to "fix the broken documentation links"; they will be promptly closed. diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/dependabot.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/dependabot.yml new file mode 100644 index 0000000000..a6278312ce --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "bundler" + directory: "/docs" + schedule: + interval: "daily" diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/workflows/continuous-integration.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000000..baf35ea44a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.github/workflows/continuous-integration.yml @@ -0,0 +1,88 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "CI" + +on: + pull_request: + push: + branches: + - "master" + +env: + COMPOSER_ROOT_VERSION: "1.99.99" + +jobs: + + lint: + name: "Lint" + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "none" + ini-values: "memory_limit=-1, zend.assertions=1, error_reporting=-1, display_errors=On" + tools: "composer:v2" + - uses: "ramsey/composer-install@v2" + - name: "Lint the PHP source code" + run: "./vendor/bin/parallel-lint src test" + + coding-standards: + name: "Coding Standards" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "latest" + coverage: "none" + ini-values: "memory_limit=-1" + tools: "composer:v2" + - uses: "ramsey/composer-install@v2" + - name: "Check coding standards" + run: "./vendor/bin/phpcs src --standard=psr2 -sp --colors" + + coverage: + name: "Coverage" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "latest" + coverage: "pcov" + ini-values: "memory_limit=-1, zend.assertions=1, error_reporting=-1, display_errors=On" + tools: "composer" + - name: "Prepare for tests" + run: "mkdir -p build/logs" + - uses: "ramsey/composer-install@v2" + - name: "Run unit tests" + run: "./vendor/bin/phpunit --colors=always --coverage-clover build/logs/clover.xml --coverage-text" + - name: "Publish coverage report to Codecov" + uses: "codecov/codecov-action@v2" + + unit-tests: + name: "Unit Tests" + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "none" + ini-values: "memory_limit=-1, zend.assertions=1, error_reporting=-1, display_errors=On" + tools: "composer" + - name: "Prepare for tests" + run: "mkdir -p build/logs" + - uses: "ramsey/composer-install@v2" + - name: "Run unit tests" + run: "./vendor/bin/phpunit --colors=always" diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitignore b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitignore new file mode 100644 index 0000000000..9d85098ef2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/.gitignore @@ -0,0 +1,9 @@ +vendor/ +composer.lock +composer.phar +.DS_Store +testing/ +nbproject/private/ +test/log +build +/.phpunit.result.cache diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CHANGELOG.md new file mode 100644 index 0000000000..73246e85df --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CHANGELOG.md @@ -0,0 +1,364 @@ +# OAuth 2.0 Client Changelog + +## 2.7.0 + +_Released: 2023-04-16_ + +* Add support for PKCE (Proof Key for Code Exchange, + [RFC 7636](https://www.rfc-editor.org/rfc/rfc7636)) + [#901](https://github.com/thephpleague/oauth2-client/pull/901) +* Various type improvements for static analysis + [#939](https://github.com/thephpleague/oauth2-client/pull/939) + [#959](https://github.com/thephpleague/oauth2-client/pull/959) + [#972](https://github.com/thephpleague/oauth2-client/pull/972) + [#997](https://github.com/thephpleague/oauth2-client/pull/997) + +## 2.6.1 + +_Released: 2021-12-22_ + +* Fix deprecation notices, providing full support for PHP 8.1 + [#919](https://github.com/thephpleague/oauth2-client/pull/919) + [#920](https://github.com/thephpleague/oauth2-client/pull/920) + +## 2.6.0 + +_Released: 2020-10-27_ + +* Indicate support for PHP 8 +* Allow time to be set for testing purposes + [#852](https://github.com/thephpleague/oauth2-client/pull/852) + +## 2.5.0 + +_Released: 2020-07-18_ + +* Allow Guzzle 7.x to be used [#847](https://github.com/thephpleague/oauth2-client/pull/847) + +## 2.4.1 + +_Released: 2018-11-22_ + +* Revert to use of `AccessToken` in type hints to preserve backwards + compatibility; this fixes the issue reported in [#752](https://github.com/thephpleague/oauth2-client/issues/752) + and [#753](https://github.com/thephpleague/oauth2-client/issues/753) + +## 2.4.0 + +_Released: 2018-11-21_ + +* Add `HttpBasicAuthOptionProvider` to ease implementation for providers + requiring HTTP basic auth +* Add `GuardedPropertyTrait` to allow providers the ability to specify + properties that may not be overridden by user-defined values passed to the + provider constructor +* Add `AccessTokenInterface` and `ResourceOwnerAccessTokenInterface` to allow + providers the ability to override the default `AccessToken` + +## 2.3.1 + +_Released: 2018-11-19_ + +* Allow paragonie/random_compat's empty 9.99.99 placeholder +* Throw an `UnexpectedValueException` on non-JSON responses from access token + request (when calling `AbstractProvider::getAccessToken()`) + +## 2.3.0 + +_Released: 2018-01-13_ + +* Add `ProviderRedirectTrait` tool for 3rd-party provider libraries to use when + handling provider redirections +* Fix TypeError thrown because `getResourceOwner()` receives a non-JSON Response +* Gracefully handle non-standard errors received from providers +* Update README to reflect official support of PHP 7.2 + +## 2.2.1 + +_Released: 2017-04-25_ + +* Fix potential type error when HTTP 500 errors are encountered +* Allow broader range of `random_compat` versions + +## 2.2.0 + +_Released: 2017-02-01_ + +* Allow base URLs to contain query parameters +* Protect against `+` being improperly encoded in URL parameters +* Remove misleading `state` option from authorization parameters +* Stop generating more random bytes than necessary + +## 2.1.0 + +_Released: 2017-01-24_ + +* Allow `expires_in` with a value of `0` + +## 2.0.0 + +_Released: 2017-01-12_ + +* Rename `getResponse()` to `getParsedResponse()` +* Add `getResponse()` method that returns the unparsed PSR-7 `Response` instance +* Removed `RandomFactory`, switched to native random functions + +## 1.4.1 + +_Released: 2016-04-29_ + +* Add `QueryBuilderTrait` to standardize query string generation. + +## 1.4.0 + +_Released: 2016-04-19_ + +* Add `AccessToken::getValues()` to access additional vendor data provided with tokens. + +## 1.3.0 + +_Released: 2016-02-13_ + +* Enable dynamic parameters being passed into the authorization URL. +* Minor documentation updates. + +## 1.2.0 + +_Released: 2016-01-23_ + +* Add `resource_owner_id` to the JSON-serialized representation of the access token. +* Minor documentation updates and improved test coverage. + +## 1.1.0 + +_Released: 2015-11-13_ + +* Add `ArrayAccessorTrait`, update `AbstractProvider` to utilize. +* Use `expires` to serialize access tokens. +* Documentation updates. + +## 1.0.2 + +_Released: 2015-09-22_ + +* Allow access tokens to be created from storage (see #431). +* Minor fixes and documentation updates. + +## 1.0.1 + +_Released: 2015-08-26_ + +* Allow required parameters checked using the `RequiredParameterTrait` to be set as `false`, `null`, `"0"`, etc. + +## 1.0.0 + +_Released: 2015-08-19_ + +* We are running code-quality builds through Scrutinizer, and we are running unit test builds on the new Travis CI container-based infrastructure. +* Cleaned up code, as recommended by Scrutinizer. +* Documentation updates. + +## 1.0.0-beta2 + +_Released: 2015-08-12_ + +* BREAK: Add toArray() to ResourceOwnerInterface. +* Always attempt to parse responses as JSON and fallback on failure. +* Add dot notation support to access token resource owner ID. +* Use the Bearer authorization header for the generic provider. +* Documentation updates. + +## 1.0.0-beta1 + +_Released: 2015-07-16_ + +* API for 1.0 is now frozen! +* BREAK: Convert all uses of "User" to "ResourceOwner" to more closely match the OAuth 2.0 specification. +* BREAK: Rename `StandardProvider` to `GenericProvider`. +* BREAK: Move access token creation to the `AbstractProvider`. It was previously handled in the `AbstractGrant`. +* FIX: Add `Content-Type` header with value of `application/x-www-form-urlencoded` to the request header when retrieving access tokens. This adheres to the OAuth 2.0 specification and fixes issues where certain OAuth servers expect this header. +* Enhanced `json_encode()` serialization of AccessToken; when using `json_encode()` on an AccessToken, it will return a JSON object with these properties: `access_token`, `refresh_token`, and `expires_in`. + +## 1.0.0-alpha2 + +_Released: 2015-07-04_ + +* BREAK: Renamed `AbstractProvider::ACCESS_TOKEN_METHOD_GET` to `AbstractProvider::METHOD_GET`. +* BREAK: Renamed `AbstractProvider::ACCESS_TOKEN_METHOD_POST` to `AbstractProvider::METHOD_POST`. +* BREAK: Renamed `AbstractProvider::prepareUserDetails()` to `AbstractProvider::createUser()`. +* BREAK: Renamed `AbstractProvider::getUserDetails()` to `AbstractProvider::getUser()`. +* BREAK: Removed `$token` parameter from `AbstractProvider::getDefaultHeaders()`. +* BREAK: Modify `AbstractProvider::getBaseAccessTokenUrl()` to accept a required array of parameters, allowing providers the ability to vary the access token URL, based on the parameters. +* Removed newline characters from MAC Authorization header. +* Documentation updates, notably: + - Moved list of providers to `README.PROVIDERS.md`. + - Moved provider creation notes to `README.PROVIDER-GUIDE.md`. + +## 1.0.0-alpha1 + +_Released: 2015-06-25_ + +This release contains numerous BC breaks from the 0.x series. Please note these breaks and refer to the [upgrade guide](GUIDE-UPGRADING.md). + +* BREAK: Requires PHP 5.5.0 and greater. +* BREAK: All providers have been moved to separate repositories, one for each provider. +* BREAK: All `public` properties have been set as `protected` or `private` and getters/setters have been introduced for access to these properties. +* BREAK: The `Provider\ProviderInterface` has been removed. Please extend from and override `Provider\AbstractProvider`. +* BREAK: The `Entity\User` has been removed. Providers should implement the `Provider\UserInterface` and provide user functionality instead of expecting it in this base library. +* BREAK: The `Grant\GrantInterface` has been removed. Providers needing to provide a new grant type should extend from and override `Grant\AbstractGrant`. +* A generic `Provider\StandardProvider` has been introduced, which may be used as a client to integrate with most OAuth 2.0 compatible servers. +* A `Grant\GrantFactory` has been introduced as a means to register and retrieve singleton grants from a registry. +* Introduced traits for bearer and MAC authorization (`Tool\BearerAuthorizationTrait` and `Tool\MacAuthorizationTrait`), which providers may use to enable these header authorization types. + +## 0.12.1 + +_Released: 2015-06-20_ + +* FIX: Scope separators for LinkedIn and Instagram are now correctly a single space + +## 0.12.0 + +_Released: 2015-06-15_ + +* BREAK: LinkedIn Provider: Default scopes removed from LinkedIn Provider. See "[Managing LinkedIn Scopes](https://github.com/thephpleague/oauth2-client/blob/9cea9864c2e89bce1b922d1e37ba5378b3b0b264/README.md#managing-linkedin-scopes)" in the README for information on how to set scopes. See [#327](https://github.com/thephpleague/oauth2-client/pull/327) and [#307](https://github.com/thephpleague/oauth2-client/pull/307) for details on this change. +* FIX: LinkedIn Provider: A scenario existed in which `publicProfileUrl` was not set, generating a PHP notice; this has been fixed. +* FIX: Instagram Provider: Fixed scope separator. +* Documentation updates and corrections. + + +## 0.11.0 + +_Released: 2015-04-25_ + +* Identity Provider: Better handling of error responses +* Documentation updates + + +## 0.10.1 + +_Released: 2015-04-02_ + +* FIX: Invalid JSON triggering fatal error +* FIX: Sending headers along with auth `getAccessToken()` requests +* Now running Travis CI tests on PHP 7 +* Documentation updates + + +## 0.10.0 + +_Released: 2015-03-10_ + +* Providers: Added `getHeaders()` to ProviderInterface and updated AbstractProvider to provide the method +* Providers: Updated all bundled providers to support new `$authorizationHeader` property +* Identity Provider: Update IDPException to account for empty strings +* Identity Provider: Added `getResponseBody()` method to IDPException +* Documentation updates, minor bug fixes, and coding standards fixes + + +## 0.9.0 + +_Released: 2015-02-24_ + +* Add `AbstractProvider::prepareAccessTokenResult()` to provide additional token response preparation to providers +* Remove custom provider code from AccessToken +* Add links to README for Dropbox and Square providers + + +## 0.8.1 + +_Released: 2015-02-12_ + +* Allow `approval_prompt` to be set by providers. This fixes an issue where some providers have problems if the `approval_prompt` is present in the query string. + + +## 0.8.0 + +_Released: 2015-02-10_ + +* Facebook Provider: Upgrade to Graph API v2.2 +* Google Provider: Add `access_type` parameter for Google authorization URL +* Get a more reliable response body on errors + + +## 0.7.2 + +_Released: 2015-02-03_ + +* GitHub Provider: Fix regression +* Documentation updates + + +## 0.7.1 + +_Released: 2015-01-06_ + +* Google Provider: fixed issue where Google API was not returning the user ID + + +## 0.7.0 + +_Released: 2014-12-29_ + +* Improvements to Provider\AbstractProvider (addition of `userUid()`, `userEmail()`, and `userScreenName()`) +* GitHub Provider: Support for GitHub Enterprise +* GitHub Provider: Methods to allow fetching user email addresses +* Google Provider: Updated scopes and endpoints to remove deprecated values +* Documentation updates, minor bug fixes, and coding standards fixes + + +## 0.6.0 + +_Released: 2014-12-03_ + +* Added ability to specify a redirect handler for providers through use of a callback (see [Provider\AbstractProvider::setRedirectHandler()](https://github.com/thephpleague/oauth2-client/blob/55de45401eaa21f53c0b2414091da6f3b0f3fcb7/src/Provider/AbstractProvider.php#L314-L317)) +* Updated authorize and token URLs for the Microsoft provider; the old URLs had been phased out and were no longer working (see #146) +* Increased test coverage +* Documentation updates, minor bug fixes, and coding standards fixes + + +## 0.5.0 + +_Released: 2014-11-28_ + +* Added `ClientCredentials` and `Password` grants +* Added support for providers to set their own `uid` parameter key name +* Added support for Google's `hd` (hosted domain) parameter +* Added support for providing a custom `state` parameter to the authorization URL +* LinkedIn `pictureUrl` is now an optional response element +* Added Battle.net provider package link to README +* Added Meetup provider package link to README +* Added `.gitattributes` file +* Increased test coverage +* A number of documentation fixes, minor bug fixes, and coding standards fixes + + +## 0.4.0 + +_Released: 2014-10-28_ + +* Added `ProviderInterface` and removed `IdentityProvider`. +* Expose generated state to allow for CSRF validation. +* Renamed `League\OAuth2\Client\Provider\User` to `League\OAuth2\Client\Entity\User`. +* Entity: User: added `gender` and `locale` properties +* Updating logic for populating the token expiration time. + + +## 0.3.0 + +_Released: 2014-04-26_ + +* This release made some huge leaps forward, including 100% unit-coverage and a bunch of new features. + + +## 0.2.0 + +_Released: 2013-05-28_ + +* No release notes available. + + +## 0.1.0 + +_Released: 2013-05-25_ + +* Initial release. diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CODE_OF_CONDUCT.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..45bed907d2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at https://twitter.com/thephpleague. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CONTRIBUTING.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CONTRIBUTING.md new file mode 100644 index 0000000000..056e870057 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +Contributions are **welcome** and will be fully **credited**. + +We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/oauth2-client). + + +## Pull Requests + +- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). + +- **Add tests!** - Your patch won't be accepted if it doesn't have tests. + +- **Document any change in behaviour** - Make sure the README and any other relevant documentation are kept up-to-date. + +- **Consider our release cycle** - We try to follow SemVer. Randomly breaking public APIs is not an option. + +- **Create topic branches** - Don't ask us to pull from your master branch. + +- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. + +- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. + +- **Ensure tests pass!** - Please run the tests (see below) before submitting your pull request, and make sure they pass. We won't accept a patch until all tests pass. + +- **Ensure no coding standards violations** - Please run PHP Code Sniffer using the PSR-2 standard (see below) before submitting your pull request. A violation will cause the build to fail, so please make sure there are no violations. We can't accept a patch if the build fails. + + +## Testing + +The following tests must pass for a build to be considered successful. If contributing, please ensure these pass before submitting a pull request. + +``` bash +$ ./vendor/bin/parallel-lint src test +$ ./vendor/bin/phpunit --coverage-text +$ ./vendor/bin/phpcs src --standard=psr2 -sp +``` + +**Happy coding**! diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CREDITS.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CREDITS.md new file mode 100644 index 0000000000..a1461887f0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/CREDITS.md @@ -0,0 +1,20 @@ +# OAuth 2.0 Client + +## Authors + +Also see . + +### Current Maintainers + +- [Ben Ramsey](https://github.com/ramsey) +- [Woody Gilk](https://github.com/shadowhand) + +### Contributors + +- [Alex Bilbie](https://github.com/alexbilbie) +- [Ben Corlett](https://github.com/bencorlett) +- [Ben Ramsey](https://github.com/ramsey) +- [James Mills](https://github.com/jamesmills) +- [Phil Sturgeon](https://github.com/philsturgeon) +- [Rudi Theunissen](https://github.com/rtheunissen) +- [Tom Anderson](https://github.com/TomHAnderson) diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/LICENSE b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/LICENSE new file mode 100644 index 0000000000..7dfa39b7ce --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2020 Alex Bilbie + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/README.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/README.md new file mode 100644 index 0000000000..cbb449d484 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/README.md @@ -0,0 +1,58 @@ +# OAuth 2.0 Client + +This package provides a base for integrating with [OAuth 2.0](http://oauth.net/2/) service providers. + +[![Gitter Chat](https://img.shields.io/badge/gitter-join_chat-brightgreen.svg?style=flat-square)](https://gitter.im/thephpleague/oauth2-client) +[![Source Code](https://img.shields.io/badge/source-thephpleague/oauth2--client-blue.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client) +[![Latest Version](https://img.shields.io/github/release/thephpleague/oauth2-client.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client/blob/master/LICENSE) +[![Build Status](https://img.shields.io/github/actions/workflow/status/thephpleague/oauth2-client/continuous-integration.yml?label=CI&logo=github&style=flat-square)](https://github.com/thephpleague/oauth2-client/actions?query=workflow%3ACI) +[![Codecov Code Coverage](https://img.shields.io/codecov/c/gh/thephpleague/oauth2-client?label=codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/thephpleague/oauth2-client) +[![Total Downloads](https://img.shields.io/packagist/dt/league/oauth2-client.svg?style=flat-square)](https://packagist.org/packages/league/oauth2-client) + +--- + +The OAuth 2.0 login flow, seen commonly around the web in the form of "Connect with Facebook/Google/etc." buttons, is a common integration added to web applications, but it can be tricky and tedious to do right. To help, we've created the `league/oauth2-client` package, which provides a base for integrating with various OAuth 2.0 providers, without overburdening your application with the concerns of [RFC 6749](http://tools.ietf.org/html/rfc6749). + +This OAuth 2.0 client library will work with any OAuth 2.0 provider that conforms to the OAuth 2.0 Authorization Framework. Out-of-the-box, we provide a `GenericProvider` class to connect to any service provider that uses [Bearer tokens](http://tools.ietf.org/html/rfc6750). See our [basic usage guide](https://oauth2-client.thephpleague.com/usage/) for examples using `GenericProvider`. + +Many service providers provide additional functionality above and beyond the OAuth 2.0 specification. For this reason, you may extend and wrap this library to support additional behavior. There are already many [official](https://oauth2-client.thephpleague.com/providers/league/) and [third-party](https://oauth2-client.thephpleague.com/providers/thirdparty/) provider clients available (e.g., Facebook, GitHub, Google, Instagram, LinkedIn, etc.). If your provider isn't in the list, feel free to add it. + +This package is compliant with [PSR-1][], [PSR-2][], [PSR-4][], and [PSR-7][]. If you notice compliance oversights, please send a patch via pull request. If you're interested in contributing to this library, please take a look at our [contributing guidelines](https://github.com/thephpleague/oauth2-client/blob/master/CONTRIBUTING.md). + +## Requirements + +We support the following versions of PHP: + +* PHP 8.1 +* PHP 8.0 +* PHP 7.4 +* PHP 7.3 +* PHP 7.2 +* PHP 7.1 +* PHP 7.0 +* PHP 5.6 + +## Provider Clients + +We provide a list of [official PHP League provider clients](https://oauth2-client.thephpleague.com/providers/league/), as well as [third-party provider clients](https://oauth2-client.thephpleague.com/providers/thirdparty/). + +To build your own provider client, please refer to "[Implementing a Provider Client](https://oauth2-client.thephpleague.com/providers/implementing/)." + +## Usage + +For usage and code examples, check out our [basic usage guide](https://oauth2-client.thephpleague.com/usage/). + +## Contributing + +Please see [our contributing guidelines](https://github.com/thephpleague/oauth2-client/blob/master/CONTRIBUTING.md) for details. + +## License + +The MIT License (MIT). Please see [LICENSE](https://github.com/thephpleague/oauth2-client/blob/master/LICENSE) for more information. + + +[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md +[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md +[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md +[PSR-7]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/codecov.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/codecov.yml new file mode 100644 index 0000000000..047a8a9719 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/codecov.yml @@ -0,0 +1,29 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + status: + project: + default: + target: auto + threshold: 0% + patch: + default: + target: auto + threshold: 0% + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,tree" + behavior: default + require_changes: false diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/composer.json b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/composer.json new file mode 100644 index 0000000000..59201f48fb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/composer.json @@ -0,0 +1,58 @@ +{ + "name": "league/oauth2-client", + "description": "OAuth 2.0 Client Library", + "license": "MIT", + "config": { + "sort-packages": true + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0", + "guzzlehttp/guzzle": "^6.0 || ^7.0", + "paragonie/random_compat": "^1 || ^2 || ^9.99" + }, + "require-dev": { + "mockery/mockery": "^1.3.5", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpunit/phpunit": "^5.7 || ^6.0 || ^9.5", + "squizlabs/php_codesniffer": "^2.3 || ^3.0" + }, + "keywords": [ + "oauth", + "oauth2", + "authorization", + "authentication", + "idp", + "identity", + "sso", + "single sign on" + ], + "authors": [ + { + "name": "Alex Bilbie", + "email": "hello@alexbilbie.com", + "homepage": "http://www.alexbilbie.com", + "role": "Developer" + }, + { + "name": "Woody Gilk", + "homepage": "https://github.com/shadowhand", + "role": "Contributor" + } + + ], + "autoload": { + "psr-4": { + "League\\OAuth2\\Client\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "League\\OAuth2\\Client\\Test\\": "test/src/" + } + }, + "extra": { + "branch-alias": { + "dev-2.x": "2.0.x-dev" + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.gitignore b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.gitignore new file mode 100755 index 0000000000..6ffa305660 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +_site +build +composer.lock +composer.phar +nbproject/private/ +test/log +testing/ +vendor/ diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.ruby-version b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.ruby-version new file mode 100755 index 0000000000..097a15a2af --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/.ruby-version @@ -0,0 +1 @@ +2.6.2 diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/CNAME b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/CNAME new file mode 100755 index 0000000000..0c1706123c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/CNAME @@ -0,0 +1 @@ +oauth2-client.thephpleague.com diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile new file mode 100755 index 0000000000..691fc42596 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' +gem 'therubyracer' +gem 'github-pages', group: :jekyll_plugins diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile.lock b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile.lock new file mode 100644 index 0000000000..5cc1c3c51a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/Gemfile.lock @@ -0,0 +1,269 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (6.0.6.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + colorator (1.1.0) + commonmarker (0.23.9) + concurrent-ruby (1.2.2) + dnsruby (1.61.9) + simpleidn (~> 0.1) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + ethon (0.15.0) + ffi (>= 1.15.0) + eventmachine (1.2.7) + execjs (2.8.1) + faraday (2.6.0) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-net_http (3.0.1) + ffi (1.15.5) + forwardable-extended (2.6.0) + gemoji (3.0.1) + github-pages (227) + github-pages-health-check (= 1.17.9) + jekyll (= 3.9.2) + jekyll-avatar (= 0.7.0) + jekyll-coffeescript (= 1.1.1) + jekyll-commonmark-ghpages (= 0.2.0) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.15.1) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.13.0) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.12.0) + kramdown (= 2.3.2) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.3) + mercenary (~> 0.3) + minima (= 2.5.1) + nokogiri (>= 1.13.6, < 2.0) + rouge (= 3.26.0) + terminal-table (~> 1.4) + github-pages-health-check (1.17.9) + addressable (~> 2.3) + dnsruby (~> 1.60) + octokit (~> 4.0) + public_suffix (>= 3.0, < 5.0) + typhoeus (~> 1.3) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) + http_parser.rb (0.8.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jekyll (3.9.2) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (~> 0.7) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (>= 1.17, < 3) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + jekyll-avatar (0.7.0) + jekyll (>= 3.0, < 5.0) + jekyll-coffeescript (1.1.1) + coffee-script (~> 2.2) + coffee-script-source (~> 1.11.1) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.2.0) + commonmarker (~> 0.23.4) + jekyll (~> 3.9.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 4.0) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.15.1) + jekyll (>= 3.7, < 5.0) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.13.0) + jekyll (>= 3.4, < 5.0) + octokit (~> 4.0, != 4.4.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-mentions (1.6.0) + html-pipeline (~> 2.3) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + jemoji (0.12.0) + gemoji (~> 3.0) + html-pipeline (~> 2.2) + jekyll (>= 3.0, < 5.0) + kramdown (2.3.2) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + libv8 (3.16.14.19) + liquid (4.0.3) + listen (3.7.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + mercenary (0.3.6) + mini_portile2 (2.8.1) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (5.18.0) + nokogiri (1.14.3) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (4.0.7) + racc (1.6.2) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + ref (2.0.0) + rexml (3.2.5) + rouge (3.26.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + simpleidn (0.2.1) + unf (~> 0.1.4) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) + ref + thread_safe (0.3.6) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.11) + thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) + zeitwerk (2.6.7) + +PLATFORMS + ruby + +DEPENDENCIES + github-pages + therubyracer + +BUNDLED WITH + 1.17.3 diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_config.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_config.yml new file mode 100644 index 0000000000..899403cc77 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_config.yml @@ -0,0 +1,2 @@ +baseurl: / +repository: thephpleague/oauth2-client diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/images.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/images.yml new file mode 100755 index 0000000000..5583e4b678 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/images.yml @@ -0,0 +1,8 @@ +# Path to project specific favicon.ico, leave blank to use default +favicon: + +# Path to project specific apple-touch-icon-precomposed.png, leave blank to use default +apple_touch: + +# Path to project logo +logo: diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/menu.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/menu.yml new file mode 100755 index 0000000000..6abb421360 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/menu.yml @@ -0,0 +1,8 @@ +Getting Started: + Introduction: '/' + "Basic Usage": '/usage/' + +Providers: + "Official Providers": '/providers/league/' + "Third-Party Providers": '/providers/thirdparty/' + "Implementing a Provider": '/providers/implementing/' diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/project.yml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/project.yml new file mode 100755 index 0000000000..ce4377223d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_data/project.yml @@ -0,0 +1,5 @@ +title: OAuth 2.0 Client +tagline: Integrate with OAuth 2.0 service providers +description: +google_analytics_tracking_id: +base_href: / diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_layouts/default.html b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_layouts/default.html new file mode 100755 index 0000000000..9e9f6c8e43 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/_layouts/default.html @@ -0,0 +1,99 @@ + + + + + + + {% if page.url == '/' %} + {{ site.data.project.title }} - {{ site.data.project.tagline }} + {% else %} + {{ page.title }} - {{ site.data.project.title }} + {% endif %} + {% if site.data.project.description %} + + {% endif %} + {% if site.data.images.favicon %} + + {% else %} + + {% endif %} + {% if site.data.images.apple_touch %} + + {% else %} + + {% endif %} + + + + +
+ + The League of Extraordinary Packages + +

Our Packages:

+
    + +
+
+ +
+ + + Presented by The League of Extraordinary Packages + +
+ + + + +
+ + {% for section in site.data.menu %} +

{{ section[0] }}

+
    + {% for link in section[1] %} +
  • + {{ link[0] }} +
  • + {% endfor %} +
+ {% endfor %} +
+
+ {{ content }} +
+
+ + + + + + +{% if site.data.project.google_analytics_tracking_id %} + +{% endif %} + + + diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/index.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/index.md new file mode 100755 index 0000000000..5bec429df3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/index.md @@ -0,0 +1,33 @@ +--- +layout: default +permalink: / +title: oauth2-client +--- + +League/oauth2-client +====================== + +[![Gitter Chat](https://img.shields.io/badge/gitter-join_chat-brightgreen.svg?style=flat-square)](https://gitter.im/thephpleague/oauth2-client) +[![Source Code](https://img.shields.io/badge/source-thephpleague/oauth2--client-blue.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client) +[![Latest Version](https://img.shields.io/github/release/thephpleague/oauth2-client.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client/blob/master/LICENSE) +[![Build Status](https://img.shields.io/github/workflow/status/thephpleague/oauth2-client/CI?label=CI&logo=github&style=flat-square)](https://github.com/thephpleague/oauth2-client/actions?query=workflow%3ACI) +[![Codecov Code Coverage](https://img.shields.io/codecov/c/gh/thephpleague/oauth2-client?label=codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/thephpleague/oauth2-client) +[![Total Downloads](https://img.shields.io/packagist/dt/league/oauth2-client.svg?style=flat-square)](https://packagist.org/packages/league/oauth2-client) + +The OAuth 2.0 login flow, seen commonly around the web in the form of "Connect with Facebook/Google/etc." buttons, is a common integration added to web applications, but it can be tricky and tedious to do right. To help, we've created the `league/oauth2-client` package, which provides a base for integrating with various OAuth 2.0 providers, without overburdening your application with the concerns of [RFC 6749](http://tools.ietf.org/html/rfc6749). + +Installation +------------- + +This package establishes a convenient base of interfaces and abstract classes, allowing developers to create OAuth 2.0 clients that interface with a wide-variety of OAuth 2.0 providers. + +> ⚠️ **Attention!** There are already many [official](/providers/league/) or [third-party](/providers/thirdparty/) provider clients available. Check these before using this base package. A client might already exist for your provider. + +This base package also includes a `GenericProvider` class, which works out-of-the-box with many OAuth 2.0 providers who use [Bearer tokens](http://tools.ietf.org/html/rfc6750). If you would like to use the `GenericProvider` instead of one of the specific provider clients, you may require this package directly with [Composer](https://getcomposer.org): + +~~~ bash +$ composer require league/oauth2-client +~~~ + +You do not need to require this package directly if using one of the [official](/providers/league/) or [third-party](/providers/thirdparty/) provider clients. diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/implementing.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/implementing.md new file mode 100755 index 0000000000..3fa4fce5ca --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/implementing.md @@ -0,0 +1,78 @@ +--- +layout: default +title: Implementing a Provider Client +permalink: /providers/implementing/ +--- + +Implementing a Provider Client +============================== + +> 💡 **TIP** You may create new provider clients by copying the layout of an existing package. See the [first party](/providers/league/) and [third party](/providers/thirdparty/) provider clients for good examples. + +> ⚠️ **Attention!** When choosing a name for your package, please don’t use the `league` vendor prefix or the `League` vendor namespace, as this implies it is officially supported. You should use your own username as the vendor prefix, and prepend `oauth2-` to the package name to make it clear your package works with `league/oauth2-client`. +> +> For example, if your GitHub username is *santa*, and you are implementing the *giftpay* OAuth 2.0 client library, a good name for your Composer package would be `santa/oauth2-giftpay`. + +If you are working with an OAuth 2.0 service provider not supported out-of-the-box or by an existing package, you may implement your own. To do so, extend [`League\OAuth2\Client\Provider\AbstractProvider`](https://github.com/thephpleague/oauth2-client/blob/master/src/Provider/AbstractProvider.php) and implement the required abstract methods: + +```php +public function getBaseAuthorizationUrl(); +public function getBaseAccessTokenUrl(array $params); +public function getResourceOwnerDetailsUrl(AccessToken $token); +protected function getDefaultScopes(); +protected function checkResponse(ResponseInterface $response, $data); +protected function createResourceOwner(array $response, AccessToken $token); +``` + +Each of these abstract methods has a comment block defining their expectations and typical behavior. Once you have extended this class, you may follow the [basic usage example](/usage/) using your new provider client class. + +If you wish to use your provider client class to make authenticated requests to the provider, you will also need to define how you provide the token to the service. If this is done via headers, you should override this method: + +```php +protected function getAuthorizationHeaders($token = null); +``` + +This package includes a trait for implementing [Bearer authorization](https://tools.ietf.org/html/rfc6750). To use the trait, include it in your provider client class with a `use` statement: + +```php +use League\OAuth2\Client\Provider\AbstractProvider; +use League\OAuth2\Client\Tool\BearerAuthorizationTrait; + +class SomeProvider extends AbstractProvider +{ + use BearerAuthorizationTrait; + + /** ... **/ +} +``` + +Resource Owner Identifiers in Access Token Responses +----------------------------------------------------- + +In services where the resource owner is a person, the resource owner is sometimes referred to as an *end-user*. + +We have abstracted away as much of the resource owner details as possible, since these are not part of the OAuth 2.0 specification and are very specific to each service provider. This provides greater flexibility to each provider, allowing them to handle the implementation details for resource owners. + +As such, the `AbstractProvider` does not specify an access token resource owner identifier. Since OAuth 2.0 does not define the resource owner identifier, the `AbstractProvider` cannot understand what to do with a resource owner identifier if it receives one. The provider client class is responsible for setting the name of this identifier, using the `ACCESS_TOKEN_RESOURCE_OWNER_ID` constant. The name is different for each provider, so check your provider's documentation. + +```php +/** + * Name of the resource owner identifier field that is + * present in the access token response (if applicable) + */ +const ACCESS_TOKEN_RESOURCE_OWNER_ID = null; +``` + +After setting `ACCESS_TOKEN_RESOURCE_OWNER_ID` on your provider client class, the `AccessToken` returned from `AbstractProvider::getAccessToken()` will have its `$resourceOwnerId` property set, which you may retrieve by calling `AccessToken::getResourceOwnerId()`. + +Next, implement the `AbstractProvider::createResourceOwner()` method. This method accepts as parameters a response array and an `AccessToken` object. You may use this information to request resource owner details from your service, returning an object that implements [`League\OAuth2\Client\Provider\ResourceOwnerInterface`](https://github.com/thephpleague/oauth2-client/blob/master/src/Provider/ResourceOwnerInterface.php). `AbstractProvider::getResourceOwner()` returns this object. + +Make It Available +------------------ + +If you find a package for a certain provider useful, chances are someone else will too! Make your package available by putting it on [Packagist](https://packagist.org) and [GitHub](https://github.com). After it's available, submit a pull request to the [oauth2-client](https://github.com/thephpleague/oauth2-client) repository, adding your provider client to the [provider client list](https://github.com/thephpleague/oauth2-client/blob/master/docs/providers/thirdparty.md). + +Make It Official +---------------- + +If you want to transfer your provider client to the `thephpleague` GitHub organization and add it to the list of officially-supported provider clients, please open a pull request on the thephpleague/oauth2-client package. Before new provider clients will be accepted, they must have 100% unit test code coverage and follow the conventions and code style used in the other [official PHP League OAuth 2.0 Client provider clients](/providers/league/). diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/league.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/league.md new file mode 100755 index 0000000000..2a99c43898 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/league.md @@ -0,0 +1,26 @@ +--- +layout: default +title: Official Provider Clients +permalink: /providers/league/ +--- + +Official Provider Clients +========================= + +You may use [Composer](https://getcomposer.org) to install any of these packages: + +~~~ bash +$ composer require league/ +~~~ + +Gateway | Composer Package | Maintainer +--- | --- | --- +[Facebook](https://github.com/thephpleague/oauth2-facebook) | league/oauth2-facebook | [Sammy Kaye Powers](https://github.com/sammyk) +[Github](https://github.com/thephpleague/oauth2-github) | league/oauth2-github | [Steven Maguire](https://github.com/stevenmaguire) +[Google](https://github.com/thephpleague/oauth2-google) | league/oauth2-google | [Woody Gilk](https://github.com/shadowhand) +[Instagram](https://github.com/thephpleague/oauth2-instagram) | league/oauth2-instagram | [Steven Maguire](https://github.com/stevenmaguire) +[LinkedIn](https://github.com/thephpleague/oauth2-linkedin) | league/oauth2-linkedin | [Steven Maguire](https://github.com/stevenmaguire) + +Due to the vast (and ever-growing) number of OAuth 2.0 services that exist, it is impossible to maintain first-party support for every OAuth 2.0 provider without damaging our ability to make this package the best it can be. Therefore, we will only accept very high-quality provider clients into the `league` namespace on a case-by-case basis. We list criteria for acceptance on the [provider client implementation guide](/providers/implementing/). + +There are a [large number of community packages](/providers/thirdparty/) that integrate with other providers. diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/thirdparty.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/thirdparty.md new file mode 100755 index 0000000000..fb0192e7f1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/providers/thirdparty.md @@ -0,0 +1,162 @@ +--- +layout: default +title: "Third-party Provider Clients" +permalink: /providers/thirdparty/ +--- + +Third-party Provider Clients +============================ + +These provider clients allow integration with other providers not supported by `league/oauth2-client`. They may require an older version, so please help them with a pull request if you notice this. If you're looking for an official `league` provider client, check out the [first-party provider clients](/providers/league/) page. + +All of these packages depend on `league/oauth2-client`, and you may use [Composer](https://getcomposer.org) to install them: + +~~~ bash +$ composer require [vendor/package-name] +~~~ + +Gateway | Composer Package | Maintainer +--- | --- | --- +[42 School](https://github.com/mehdibo/oauth2-fortytwo/) | mehdibo/oauth2-fortytwo | [Mehdi Bounya](https://github.com/mehdibo) +[Amazon](https://github.com/michaelKaefer/oauth2-amazon/) | michaelkaefer/oauth2-amazon | [Michael Käfer](https://github.com/michaelKaefer) +[Amazon Cognito](https://github.com/CakeDC/oauth2-cognito/) | cakedc/oauth2-cognito | [Cake Development Corporation](https://github.com/CakeDC) +[Apple](https://github.com/patrickbussmann/oauth2-apple) | patrickbussmann/oauth2-apple | [Patrick Bußmann](https://github.com/patrickbussmann) +[Auth0](https://github.com/RiskioFr/oauth2-auth0) | riskio/oauth2-auth0 | [Nicolas Eeckeloo](https://github.com/neeckeloo) +[Azure Active Directory](https://github.com/thenetworg/oauth2-azure) | thenetworg/oauth2-azure | [Jan Hajek](https://github.com/hajekj) +[BASE](https://github.com/w-takumi/oauth2-base) | shippinno/oauth-base | [SHIPPInno Corp.](https://www.shippinno.co.jp/) +[Basecamp](https://github.com/stevenmaguire/oauth2-basecamp) | stevenmaguire/oauth2-basecamp | [Steven Maguire](https://github.com/stevenmaguire) +[Battle.net](https://github.com/tpavlek/oauth2-bnet) | depotwarehouse/oauth2-bnet | [Troy Pavlek](https://github.com/tpavlek) +[Bitbucket](https://github.com/stevenmaguire/oauth2-bitbucket) | stevenmaguire/oauth2-bitbucket | [Steven Maguire](https://github.com/stevenmaguire) +[BookingSync](https://github.com/BookingSync/oauth2-bookingsync-php) | bookingsync/oauth2-bookingsync-php | [BookingSync](https://github.com/BookingSync) +[Box](https://github.com/stevenmaguire/oauth2-box) | stevenmaguire/oauth2-box | [Steven Maguire](https://github.com/stevenmaguire) +[Buddy](https://github.com/buddy-works/oauth2-client) | buddy-works/oauth2-client | [Arkadiusz Kondas](https://github.com/akondas) +[Buffer](https://github.com/tgallice/oauth2-buffer) | tgallice/oauth2-buffer | [Thomas Gallice](https://github.com/tgallice) +[ColorMeShop](https://github.com/pepabo/oauth2-colormeshop) | pepabo/oauth2-colormeshop | [GMO Pepabo, Inc.](https://github.com/pepabo) +[Canvas LMS](https://github.com/smtech/oauth2-canvaslms) | smtech/oauth2-canvaslms | [Seth Battis](https://github.com/battis) +[concrete5](https://github.com/concrete5/oauth2-concrete5) | concrete5/oauth2-concrete5 | [Andrew Embler](https://github.com/aembler) +[Chaster App](https://github.com/Austomos/oauth2-chaster-app) | austomos/oauth2-chaster-app | [Ben Hyr](https://github.com/Austomos) +[ChatWork](https://github.com/chatwork/oauth2-chatwork-php) | chatwork/oauth2-chatwork | [Yuta Adachi](https://github.com/ada-u) +[Clever](https://github.com/schoolrunner/oauth2-clever) | schoolrunner/oauth2-clever | [Schoolrunner](https://github.com/schoolrunner) +[CloudConvert](https://github.com/osavchenko/oauth2-cloudconvert) | osavchenko/oauth2-cloudconvert | [Oleksandr Savchenko](https://github.com/osavchenko) +[Clover](https://github.com/wheniwork/oauth2-clover) | wheniwork/oauth2-clover | [When I Work](https://github.com/wheniwork) +[Coinbase](https://github.com/openclerk/coinbase-oauth2) | openclerk/coinbase-oauth2 | [Openclerk](https://github.com/openclerk) +[Deezer](https://github.com/julienbornstein/oauth2-deezer) | julienbornstein/oauth2-deezer | [Julien Bornstein](https://github.com/julienbornstein) +[DeviantArt](https://github.com/SeinopSys/oauth2-deviantart) | seinopsys/oauth2-deviantart | [SeinopSys](https://github.com/SeinopSys) +[DigitalOcean](https://github.com/chrishemmings/oauth2-digitalocean) | chrishemmings/oauth2-digitalocean | [Chris Hemmings](https://github.com/chrishemmings) +[Discord](https://github.com/wohali/oauth2-discord-new) | wohali/oauth2-discord-new | [Joan Touzet](https://github.com/wohali) +[Docusign](https://github.com/AlaaSarhan/oauth2-docusign) | sarhan/oauth2-docusign | [Alaa Sarhan](https://github.com/AlaaSarhan) +[Dokeop](https://github.com/dokeop/oauth2-dokeop) | dokeop/oauth2-dokeop | [Dokeop](https://github.com/dokeop) +[DonationAlerts](https://github.com/mish-ka-mishka/oauth2-donationalerts) | mkaverin/oauth2-donationalerts | [Michael Kaverin](https://github.com/mish-ka-mishka) +[Dribbble](https://github.com/crewlabs/oauth2-dribbble) | crewlabs/oauth2-dribbble | [Crew Labs](https://crew.co/labs) +[Dropbox](https://github.com/stevenmaguire/oauth2-dropbox) | stevenmaguire/oauth2-dropbox | [Steven Maguire](https://github.com/stevenmaguire) +[Drupal](https://github.com/chrishemmings/oauth2-drupal) | chrishemmings/oauth2-drupal | [Chris Hemmings](https://github.com/chrishemmings) +[Ecwid](https://github.com/mugnate/oauth2-ecwid) | mugnate/oauth2-ecwid | [Nikolay Votintsev](https://github.com/votintsev) +[Edenred](https://github.com/jzecca/oauth2-edenred) | jzecca/oauth2-edenred | [Jérôme Zecca](https://github.com/jzecca) +[Elance](https://github.com/stevenmaguire/oauth2-elance) | stevenmaguire/oauth2-elance | [Steven Maguire](https://github.com/stevenmaguire) +[Envato](https://github.com/dilab/envato-oauth2-provider) | dilab/envato-oauth2-provider | [Xu Ding](https://github.com/dilab) +[Epic Games](https://github.com/MrPropre/oauth2-epicgames) | mrpropre/oauth2-epicgames | [Adrien Alais](https://github.com/MrPropre) +[ESIA](https://packagist.org/packages/ekapusta/oauth2-esia) | ekapusta/oauth2-esia | [Alexander Ustimenko](https://github.com/ekapusta) +[Etsy](https://packagist.org/packages/startz/oauth2-etsy) | startz/oauth2-etsy | [Chuck Burgess](https://github.com/cdburgess) +[EVE Online](https://github.com/killmails/oauth2-eve) | killmails/oauth2-eve | [Oizys](https://github.com/syzio) +[Eventbrite](https://github.com/stevenmaguire/oauth2-eventbrite) | stevenmaguire/oauth2-eventbrite | [Steven Maguire](https://github.com/stevenmaguire) +[FieldEdge](https://github.com/compwright/oauth2-fieldedge) | compwright/oauth2-fieldedge | [Jonathon Hill](https://compwright.com) +[Firefly III](https://github.com/StanSoftBG/oauth2-firefly-iii) | stansoft/oauth2-firefly-iii | [Stanimir Stoyanov](https://github.com/stratoss) +[Fitbit](https://github.com/djchen/oauth2-fitbit) | djchen/oauth2-fitbit | [Dan Chen](https://github.com/djchen) +[FormAssembly](https://github.com/FatherShawn/oauth2-formassembly) | fathershawn/oauth2-formassembly | [Shawn Duncan](https://github.com/FatherShawn) +[Foursquare](https://github.com/stevenmaguire/oauth2-foursquare) | stevenmaguire/oauth2-foursquare | [Steven Maguire](https://github.com/stevenmaguire) +[FreeAgent](https://github.com/CloudManaged/oauth2-freeagent) | cloudmanaged/oauth2-freeagent | *Unmaintained* +[FreshBooks](https://github.com/zerospam/oauth2-freshbooks) | zerospam/oauth2-freshbooks | [Antoine Aflalo](https://github.com/Belphemur) +[Genesys](https://github.com/vormkracht10/oauth2-genesys) | vormkracht10/oauth2-genesys | [Vormkracht10](https://github.com/vormkracht10) +[Geocaching](https://github.com/Surfoo/oauth2-geocaching) | surfoo/oauth2-geocaching | [Surfoo](https://github.com/Surfoo) +[GitLab](https://github.com/omines/oauth2-gitlab) | omines/oauth2-gitlab | [Niels Keurentjes](https://github.com/curry684) +[Gumroad](https://github.com/Alofoxx/oauth2-gumroad) | alofoxx/oauth2-gumroad | [Alofoxx](https://github.com/Alofoxx) +[GotoWebinar](https://github.com/dalpras/oauth2-gotowebinar) | dalpras/oauth2-gotowebinar | [Stefano Dal Prà](https://github.com/dalpras) +[Harvest API v2](https://github.com/globalvisionmedia/oauth2-harvest) | globalvisionmedia/oauth2-harvest | [Peter Hawkins](https://www.globalvision.com.au) +[Harvest API v1](https://github.com/nilesuan/oauth2-harvest) | nilesuan/oauth2-harvest | [Nile Suan](https://github.com/nilesuan) +[HeadHunter](https://packagist.org/packages/alexmasterov/oauth2-headhunter) | alexmasterov/oauth2-headhunter | [Alex Masterov](https://github.com/AlexMasterov) +[Heroku](https://github.com/stevenmaguire/oauth2-heroku) | stevenmaguire/oauth2-heroku | [Steven Maguire](https://github.com/stevenmaguire) +[Housecall Pro](https://github.com/compwright/oauth2-housecallpro) | compwright/oauth2-housecallpro | [Jonathon Hill](https://github.com/compwright) +[HubSpot](https://github.com/helpscout/oauth2-hubspot) | helpscout/oauth2-hubspot | [Steven Wade](https://github.com/stevenwadejr) +[IBM App ID](https://github.com/Jampire/oauth2-appid) | jampire/oauth2-appid | [Dzianis Kotau](https://github.com/Jampire) +[Imgur](https://github.com/adam-paterson/oauth2-imgur) | adam-paterson/oauth2-imgur | [Adam Paterson](https://github.com/adam-paterson) +[Jira](https://packagist.org/packages/mrjoops/oauth2-jira) | mrjoops/oauth2-jira | [Alexandre Lahure](https://github.com/mrjoops) +[Keycloak](https://github.com/stevenmaguire/oauth2-keycloak) | stevenmaguire/oauth2-keycloak | [Steven Maguire](https://github.com/stevenmaguire) +[Lichess](https://packagist.org/packages/joseayram/oauth2-lichess) | joseayram/oauth2-lichess | [José Ayram](https://github.com/joseayram) +[Linode](https://packagist.org/packages/webinarium/oauth2-linode) | webinarium/oauth2-linode | [Artem Rodygin](https://github.com/webinarium) +[Mailchimp](https://github.com/chadhutchins/oauth2-mailchimp) | chadhutchins/oauth2-mailchimp | [Chad Hutchins](https://github.com/chadhutchins) +[Mail.ru](https://packagist.org/packages/aego/oauth2-mailru) | aego/oauth2-mailru | [Alexey](https://github.com/rakeev) +[mailXpert](https://packagist.org/packages/mailxpert/oauth2-mailxpert) | mailxpert/oauth2-mailxpert | [mailXpert](https://github.com/mailXpert) +[Marketo](https://packagist.org/packages/kristenlk/oauth2-marketo) | kristenlk/oauth2-marketo | [Kristen Kehlenbeck](https://github.com/kristenlk) +[Mastodon](https://packagist.org/packages/lrf141/oauth2-mastodon) | lrf141/oauth2-mastodon | [Kento Takeuchi](https://github.com/lrf141) +[MDirector](https://github.com/antevenio/oauth2-mdirector) | antevenio/oauth2-mdirector | [Iván Mota](https://github.com/pinfake) +[Meetup](https://packagist.org/packages/wittestier/oauth2-meetup) | wittestier/oauth2-meetup | [WitteStier](https://gitlab.com/WitteStier) +[MercadoLibre](https://github.com/docta/oauth2-mercadolibre) | docta/oauth2-mercadolibre | [Lucas Banegas](https://github.com/lucascono) +[Microsoft](https://github.com/stevenmaguire/oauth2-microsoft) | stevenmaguire/oauth2-microsoft | [Steven Maguire](https://github.com/stevenmaguire) +[MYOB](https://github.com/globalvisionmedia/oauth2-myob) | globalvisionmedia/oauth2-myob | [Peter Hawkins](https://www.globalvision.com.au) +[Mollie](https://github.com/mollie/oauth2-mollie-php) | mollie/oauth2-mollie-php | [Mollie](https://github.com/mollie) +[Monizze](https://github.com/jzecca/oauth2-monizze) | jzecca/oauth2-monizze | [Jérôme Zecca](https://github.com/jzecca) +[Mixer](https://gitlab.com/morgann/oauth2-mixer) | morgann/oauth2-mixer | [Morgann](https://gitlab.com/morgann/oauth2-mixer) +[Naver](https://packagist.org/packages/deminoth/oauth2-naver) | deminoth/oauth2-naver | [SangYeob Bono Yu](https://github.com/deminoth) +[Netatmo](https://github.com/rugaard/oauth2-netatmo) | rugaard/oauth2-netatmo | [Morten Rugaard](https://github.com/rugaard) +[Nest](https://github.com/stevenmaguire/oauth2-nest) | stevenmaguire/oauth2-nest | [Steven Maguire](https://github.com/stevenmaguire) +[NIBE](https://github.com/olssonm/oauth2-nibe) | olssonm/oauth2-nibe | [Marcus Olsson](https://github.com/olssonm) +[Odnoklassniki](https://packagist.org/packages/aego/oauth2-odnoklassniki) | aego/oauth2-odnoklassniki | [Alexey](https://github.com/rakeev) +[Okta](https://packagist.org/packages/foxworth42/oauth2-okta) | foxworth42/oauth2-okta | [Ed Walker](https://github.com/foxworth42) +[OpenStreetMap](https://packagist.org/packages/jbelien/oauth2-openstreetmap) | jbelien/oauth2-openstreetmap | [Jonathan Beliën](https://github.com/jbelien) +[Optimizely](https://packagist.org/packages/widerfunnel/oauth2-optimizely) | widerfunnel/oauth2-optimizely | [WiderFunnel Labs](https://github.com/WiderFunnel-Labs) +[PayPal](https://github.com/stevenmaguire/oauth2-paypal) | stevenmaguire/oauth2-paypal | [Steven Maguire](https://github.com/stevenmaguire) +[Pipedrive](https://github.com/daniti/oauth2-pipedrive) | daniti/oauth2-pipedrive | [Daniele Timo](https://github.com/daniti) +[Phabricator](https://github.com/ofbeaton/oauth2-phabricator) | ofbeaton/oauth2-phabricator | [Finlay Beaton](https://ofbeaton.com) +[Pinterest](https://github.com/vantezzen/oauth2-pinterest) | vantezzen/oauth2-pinterest | [vantezzen](https://github.com/vantezzen) +[Procore](https://packagist.org/packages/oxblue/oauth2-procore) | oxblue/oauth2-procore | [Chris Forrence](https://gitlab.com/chrisforrence) +[PSN](https://github.com/larabros/oauth2-psn) | larabros/oauth2-psn | [Hassan Khan](https://github.com/hassankhan) +[Rocket Beans TV](https://github.com/oliverschloebe/oauth2-rbtv) | oliverschloebe/oauth2-rbtv | [Oliver Schlöbe](https://github.com/oliverschloebe) +[Rdio](https://github.com/adam-paterson/oauth2-rdio) | adam-paterson/oauth2-rdio | [Adam Paterson](https://github.com/adam-paterson) +[Reddit](https://github.com/rtheunissen/oauth2-reddit) | rtheunissen/oauth2-reddit | [Rudi Theunissen](https://github.com/rtheunissen) +[Resource Guru](https://github.com/adam-paterson/oauth2-resource-guru) | adam-paterson/oauth2-resource-guru | [Adam Paterson](https://github.com/adam-paterson) +[Riot (RSO)](https://github.com/kdefives/oauth2-riot) | kdefives/oauth2-riot | [Kevin Defives](https://github.com/kdefives) +[Salesforce](https://github.com/stevenmaguire/oauth2-salesforce) | stevenmaguire/oauth2-salesforce | [Steven Maguire](https://github.com/stevenmaguire) +[SceneId](https://github.com/potibm/oauth2-sceneid) | potibm/oauth2-sceneid | [Stefan Keßeler](https://github.com/potibm) +[Service Fusion](https://github.com/compwright/oauth2-servicefusion) | compwright/oauth2-servicefusion | [Jonathon Hill](https://compwright.com) +[ServiceTitan](https://github.com/compwright/oauth2-servicetitan) | compwright/oauth2-servicetitan | [Jonathon Hill](https://compwright.com) +[Shopify](https://github.com/multidimension-al/oauth2-shopify) | multidimensional/oauth2-shopify | [multidimension.al](https://multidimension.al/) +[Slack](https://github.com/adam-paterson/oauth2-slack) | adam-paterson/oauth2-slack | [Adam Paterson](https://github.com/adam-paterson) +[Snapchat](https://github.com/pbringetto/oauth2-snapchat) | pbringetto/oauth2-snapchat | [Paul Bringetto](https://github.com/pbringetto) +[SoundCloud](https://packagist.org/packages/martin1982/oauth2-soundcloud) | martin1982/oauth2-soundcloud | [Martin de Keijzer](https://github.com/martin1982) +[Spotify](https://packagist.org/packages/audeio/spotify-web-api) | audeio/spotify-web-api | [Jonjo McKay](https://github.com/jonjomckay) +[Spotify](https://packagist.org/packages/kerox/oauth2-spotify) | kerox/oauth2-spotify | [Romain Monteil](https://github.com/ker0x) +[SteemConnect V2](https://github.com/hernandev/oauth2-sc2) | hernandev/oauth2-sc2 | [Diego Hernandes](https://github.com/hernandev) +[Stripe](https://github.com/adam-paterson/oauth2-stripe) | adam-paterson/oauth2-stripe | [Adam Paterson](https://github.com/adam-paterson) +[Strava](https://github.com/Edwin-Luijten/oauth2-strava) | edwin-luijten/oauth2-strava | [Edwin Luijten](https://github.com/Edwin-Luijten) +[Square](https://packagist.org/packages/wheniwork/oauth2-square) | wheniwork/oauth2-square | [Woody Gilk](https://github.com/shadowhand) +[StackExchange](https://packagist.org/packages/alexmasterov/oauth2-stackexchange) | alexmasterov/oauth2-stackexchange | [Alex Masterov](https://github.com/AlexMasterov) +[SuperJob](https://packagist.org/packages/alexmasterov/oauth2-superjob) | alexmasterov/oauth2-superjob | [Alex Masterov](https://github.com/AlexMasterov) +[TikTok](https://github.com/bastiaandewaele/oauth2-tiktok) | bastiaandewaele/oauth2-tiktok | [Bastiaan Dewaele](https://github.com/bastiaandewaele) +[Thingiverse](https://packagist.org/packages/freshworkx/oauth2-thingiverse) | freshworkx/oauth2-thingiverse | [Jens Neumann](https://github.com/freshworkx) +[ThirtySevenSignals](https://github.com/nilesuan/oauth2-thirtysevensignals) | nilesuan/oauth2-thirtysevensignals | [Nile Suan](https://github.com/nilesuan) +[Trakt.tv](https://github.com/Bogstag/oauth2-trakt) | bogstag/oauth2-trakt | [Krister Bogstag](https://github.com/Bogstag/) +[Trovo](https://github.com/artandor/oauth2-trovo) | artandor/oauth2-trovo | [Nicolas Mylle](https://github.com/artandor/) +[Trustpilot](https://github.com/dmt-software/oauth2-trustpilot) | dmt-software/oauth2-trustpilot | [DMT software](https://github.com/dmt-software/) +[Twinfield](https://github.com/php-twinfield/twinfield) | php-twinfield/twinfield | [Mollie B.V.](https://github.com/mollie) +[Twitch.tv](https://github.com/tpavlek/oauth2-twitch) | depotwarehouse/oauth2-twitch | [Troy Pavlek](https://github.com/tpavlek) +[Twitch.tv (New API Helix)](https://github.com/vertisan/oauth2-twitch-helix) | vertisan/oauth2-twitch-helix | [Paweł Farys](https://github.com/vertisan) +[Twitter](https://github.com/smolblog/oauth2-twitter) | smolblog/oauth2-twitter | [Evan Hildreth](https://github.com/oddevan) +[Uber](https://github.com/stevenmaguire/oauth2-uber) | stevenmaguire/oauth2-uber | [Steven Maguire](https://github.com/stevenmaguire) +[Unsplash](https://github.com/hughbertd/oauth2-unsplash) | hughbertd/oauth2-unsplash | [Hugh Downer](https://github.com/hughbertd) +[Untappd](https://github.com/shadowhand/oauth2-untappd) | shadowhand/oauth2-untappd | [Woody Gilk](https://github.com/shadowhand) +[Vend](https://github.com/wheniwork/oauth2-vend) | wheniwork/oauth2-vend | [When I Work](https://github.com/wheniwork) +[Vimeo](https://github.com/saf33r/oauth2-vimeo) | saf33r/oauth2-vimeo | [Safeer Ahmed](https://github.com/saf33r) +[Vkontakte](https://github.com/j4k/oauth2-vkontakte) | j4k/oauth2-vkontakte | [Jack W](https://github.com/j4k) +[Withings](https://github.com/waytohealth/oauth2-withings) | waytohealth/oauth2-withings | [Way to Health](https://github.com/waytohealth) +[WordPress](https://github.com/krombox/oauth2-wordpress) | krombox/oauth2-wordpress | [Roman Kapustian](https://github.com/krombox) +[Webflow](https://github.com/koalatiapp/oauth2-webflow) | koalati/oauth2-webflow | [Koalati](https://github.com/koalatiapp) +[Wechat](https://github.com/oakhope/oauth2-wechat) | oakhope/oauth2-wechat | [Benji Wang](https://github.com/oakhope) +[WeCounsel](https://github.com/stevenmaguire/oauth2-wecounsel) | stevenmaguire/oauth2-wecounsel | [Steven Maguire](https://github.com/stevenmaguire) +[Wrike](https://github.com/michaelKaefer/oauth2-wrike) | michaelkaefer/oauth2-wrike | [Michael Käfer](https://github.com/michaelKaefer) +[Yahoo](https://packagist.org/packages/hayageek/oauth2-yahoo) | hayageek/oauth2-yahoo | [Ravishanker Kusuma](https://github.com/hayageek) +[Yandex](https://packagist.org/packages/aego/oauth2-yandex) | aego/oauth2-yandex | [Alexey](https://github.com/rakeev) +[Yelp](https://github.com/stevenmaguire/oauth2-yelp) | stevenmaguire/oauth2-yelp | [Steven Maguire](https://github.com/stevenmaguire) +[Zendesk](https://github.com/stevenmaguire/oauth2-zendesk) | stevenmaguire/oauth2-zendesk | [Steven Maguire](https://github.com/stevenmaguire) +[ZenPayroll](https://packagist.org/packages/wheniwork/oauth2-zenpayroll) | wheniwork/oauth2-zenpayroll | [Woody Gilk](https://github.com/shadowhand) +[Zoho](https://github.com/asadku34/oauth2-zoho) | asad/oauth2-zoho | [Asadur Rahman](https://github.com/asadku34) +[Zoho](https://github.com/shahariaazam/zoho-oauth2) | shahariaazam/zoho-oauth2 | [Shaharia Azam](https://github.com/shahariaazam) diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/usage.md b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/usage.md new file mode 100755 index 0000000000..88a8c21fa4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/docs/usage.md @@ -0,0 +1,244 @@ +--- +layout: default +permalink: /usage/ +title: "Basic Usage" +--- + +Basic Usage +=========== + +> ℹ️ **NOTE** In most cases, you should use a specific [official](/providers/league/) or [third-party](/providers/thirdparty/) provider client library, rather than this base library alone. + +Authorization Code Grant +------------------------ + +The following example uses the out-of-the-box `GenericProvider` provided by this library. If you're looking for a specific provider client (e.g., Facebook, Google, GitHub, etc.), take a look at our [list of provider client libraries](/providers/league/). **HINT: You're probably looking for a specific provider client.** + +The *authorization code* grant type is the most common grant type used when authenticating users with a third-party service. This grant type utilizes a *client* (this library), a *service provider* (the server), and a *resource owner* (the account with credentials to a protected—or owned—resource) to request access to resources owned by the user. This is often referred to as _3-legged OAuth_, since there are three parties involved. + + +```php +$provider = new \League\OAuth2\Client\Provider\GenericProvider([ + 'clientId' => 'XXXXXX', // The client ID assigned to you by the provider + 'clientSecret' => 'XXXXXX', // The client password assigned to you by the provider + 'redirectUri' => 'https://my.example.com/your-redirect-url/', + 'urlAuthorize' => 'https://service.example.com/authorize', + 'urlAccessToken' => 'https://service.example.com/token', + 'urlResourceOwnerDetails' => 'https://service.example.com/resource' +]); + +// If we don't have an authorization code then get one +if (!isset($_GET['code'])) { + + // Fetch the authorization URL from the provider; this returns the + // urlAuthorize option and generates and applies any necessary parameters + // (e.g. state). + $authorizationUrl = $provider->getAuthorizationUrl(); + + // Get the state generated for you and store it to the session. + $_SESSION['oauth2state'] = $provider->getState(); + + // Optional, only required when PKCE is enabled. + // Get the PKCE code generated for you and store it to the session. + $_SESSION['oauth2pkceCode'] = $provider->getPkceCode(); + + // Redirect the user to the authorization URL. + header('Location: ' . $authorizationUrl); + exit; + +// Check given state against previously stored one to mitigate CSRF attack +} elseif (empty($_GET['state']) || empty($_SESSION['oauth2state']) || $_GET['state'] !== $_SESSION['oauth2state']) { + + if (isset($_SESSION['oauth2state'])) { + unset($_SESSION['oauth2state']); + } + + exit('Invalid state'); + +} else { + + try { + + // Optional, only required when PKCE is enabled. + // Restore the PKCE code stored in the session. + $provider->setPkceCode($_SESSION['oauth2pkceCode']); + + // Try to get an access token using the authorization code grant. + $accessToken = $provider->getAccessToken('authorization_code', [ + 'code' => $_GET['code'] + ]); + + // We have an access token, which we may use in authenticated + // requests against the service provider's API. + echo 'Access Token: ' . $accessToken->getToken() . "
"; + echo 'Refresh Token: ' . $accessToken->getRefreshToken() . "
"; + echo 'Expired in: ' . $accessToken->getExpires() . "
"; + echo 'Already expired? ' . ($accessToken->hasExpired() ? 'expired' : 'not expired') . "
"; + + // Using the access token, we may look up details about the + // resource owner. + $resourceOwner = $provider->getResourceOwner($accessToken); + + var_export($resourceOwner->toArray()); + + // The provider provides a way to get an authenticated API request for + // the service, using the access token; it returns an object conforming + // to Psr\Http\Message\RequestInterface. + $request = $provider->getAuthenticatedRequest( + 'GET', + 'https://service.example.com/resource', + $accessToken + ); + + } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { + + // Failed to get the access token or user details. + exit($e->getMessage()); + + } + +} +``` +### Authorization Code Grant with PKCE + +To enable PKCE (Proof Key for Code Exchange) you can set the `pkceMethod` option for the provider. +Supported methods are: +- `S256` Recommended method. The code challenge will be hashed with sha256. +- `plain` **NOT** recommended. The code challenge will be sent as plain text. Only use this if no other option is possible. + +You can configure the PKCE method as follows: +```php +$provider = new \League\OAuth2\Client\Provider\GenericProvider([ + // ... + // other options + // ... + 'pkceMethod' => \League\OAuth2\Client\Provider\GenericProvider::PKCE_METHOD_S256 +]); +``` +The PKCE code needs to be used between requests and therefore be saved and restored, usually via the session. +In the [example](#authorization-code-grant-example) above this is done as follows: +```php +// Store the PKCE code after the `getAuthorizationUrl()` call. +$_SESSION['oauth2pkceCode'] = $provider->getPkceCode(); +// ... +// Restore the PKCE code before the `getAccessToken()` call. +$provider->setPkceCode($_SESSION['oauth2pkceCode']); +``` + +Refreshing a Token +------------------ + +Once authorizing your application, you may refresh an expired token using a refresh token rather than going through the entire process of obtaining a new token. To do so, use the refresh token from your data store to request a new access token. + +```php +$provider = new \League\OAuth2\Client\Provider\GenericProvider([ + 'clientId' => 'XXXXXX', // The client ID assigned to you by the provider + 'clientSecret' => 'XXXXXX', // The client password assigned to you by the provider + 'redirectUri' => 'https://my.example.com/your-redirect-url/', + 'urlAuthorize' => 'https://service.example.com/authorize', + 'urlAccessToken' => 'https://service.example.com/token', + 'urlResourceOwnerDetails' => 'https://service.example.com/resource' +]); + +$existingAccessToken = getAccessTokenFromYourDataStore(); + +if ($existingAccessToken->hasExpired()) { + $newAccessToken = $provider->getAccessToken('refresh_token', [ + 'refresh_token' => $existingAccessToken->getRefreshToken() + ]); + + // Purge old access token and store new access token to your data store. +} +``` + +Resource Owner Password Credentials Grant +----------------------------------------- + +Some service providers allow you to skip the authorization code step to exchange a user's credentials (username and password) for an access token. This is referred to as the *resource owner password credentials* grant type. + +According to [section 1.3.3](http://tools.ietf.org/html/rfc6749#section-1.3.3) of the OAuth 2.0 standard (emphasis added): + +> The credentials **should only be used when there is a high degree of trust** between the resource owner and the client (e.g., the client is part of the device operating system or a highly privileged application), and when other authorization grant types are not available (such as an authorization code). + +> 🛑 **DANGER!** We advise against using this grant type if the service provider supports the authorization code grant type (see above), as this reinforces the [password anti-pattern](https://agentile.com/the-password-anti-pattern), allowing users to think it's okay to trust third-party applications with their usernames and passwords. + +That said, there are use-cases where the resource owner password credentials grant is acceptable and useful. + +```php +$provider = new \League\OAuth2\Client\Provider\GenericProvider([ + 'clientId' => 'XXXXXX', // The client ID assigned to you by the provider + 'clientSecret' => 'XXXXXX', // The client password assigned to you by the provider + 'redirectUri' => 'https://my.example.com/your-redirect-url/', + 'urlAuthorize' => 'https://service.example.com/authorize', + 'urlAccessToken' => 'https://service.example.com/token', + 'urlResourceOwnerDetails' => 'https://service.example.com/resource' +]); + +try { + + // Try to get an access token using the resource owner password credentials grant. + $accessToken = $provider->getAccessToken('password', [ + 'username' => 'myuser', + 'password' => 'mysupersecretpassword' + ]); + +} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { + + // Failed to get the access token + exit($e->getMessage()); + +} +``` + +Client Credentials Grant +------------------------ + +When your application acts on its own behalf to access resources it controls or owns in a service provider, it may use the *client credentials* grant type. + +The client credentials grant type is best when storing the credentials for your application privately and never exposing them (e.g., through the web browser, etc.) to end-users. This grant type functions like the resource owner password credentials grant type, but it does not request a user's username or password. It uses only the client ID and client secret issued to your client by the service provider. + +```php +// Note: the GenericProvider requires the `urlAuthorize` option, even though +// it's not used in the OAuth 2.0 client credentials grant type. + +$provider = new \League\OAuth2\Client\Provider\GenericProvider([ + 'clientId' => 'XXXXXX', // The client ID assigned to you by the provider + 'clientSecret' => 'XXXXXX', // The client password assigned to you by the provider + 'redirectUri' => 'https://my.example.com/your-redirect-url/', + 'urlAuthorize' => 'https://service.example.com/authorize', + 'urlAccessToken' => 'https://service.example.com/token', + 'urlResourceOwnerDetails' => 'https://service.example.com/resource' +]); + +try { + + // Try to get an access token using the client credentials grant. + $accessToken = $provider->getAccessToken('client_credentials'); + +} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { + + // Failed to get the access token + exit($e->getMessage()); + +} +``` + +Using a Proxy +------------- + +It is possible to use a proxy to debug HTTP calls made to a provider. + +To use a proxy, set the `proxy` and `verify` options when creating your provider client instance. Make sure you enable SSL proxying in your proxy. + +```php +$provider = new \League\OAuth2\Client\Provider\GenericProvider([ + 'clientId' => 'XXXXXX', // The client ID assigned to you by the provider + 'clientSecret' => 'XXXXXX', // The client password assigned to you by the provider + 'redirectUri' => 'https://my.example.com/your-redirect-url/', + 'urlAuthorize' => 'https://service.example.com/authorize', + 'urlAccessToken' => 'https://service.example.com/token', + 'urlResourceOwnerDetails' => 'https://service.example.com/resource', + 'proxy' => '192.168.0.1:8888', + 'verify' => false +]); +``` diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/phpunit.xml b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/phpunit.xml new file mode 100644 index 0000000000..46accb3873 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/phpunit.xml @@ -0,0 +1,28 @@ + + + + + ./test + + + + + + src/ + + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AbstractGrant.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AbstractGrant.php new file mode 100644 index 0000000000..2c0244ba3d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AbstractGrant.php @@ -0,0 +1,80 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant; + +use League\OAuth2\Client\Tool\RequiredParameterTrait; + +/** + * Represents a type of authorization grant. + * + * An authorization grant is a credential representing the resource + * owner's authorization (to access its protected resources) used by the + * client to obtain an access token. OAuth 2.0 defines four + * grant types -- authorization code, implicit, resource owner password + * credentials, and client credentials -- as well as an extensibility + * mechanism for defining additional types. + * + * @link http://tools.ietf.org/html/rfc6749#section-1.3 Authorization Grant (RFC 6749, §1.3) + */ +abstract class AbstractGrant +{ + use RequiredParameterTrait; + + /** + * Returns the name of this grant, eg. 'grant_name', which is used as the + * grant type when encoding URL query parameters. + * + * @return string + */ + abstract protected function getName(); + + /** + * Returns a list of all required request parameters. + * + * @return array + */ + abstract protected function getRequiredRequestParameters(); + + /** + * Returns this grant's name as its string representation. This allows for + * string interpolation when building URL query parameters. + * + * @return string + */ + public function __toString() + { + return $this->getName(); + } + + /** + * Prepares an access token request's parameters by checking that all + * required parameters are set, then merging with any given defaults. + * + * @param array $defaults + * @param array $options + * @return array + */ + public function prepareRequestParameters(array $defaults, array $options) + { + $defaults['grant_type'] = $this->getName(); + + $required = $this->getRequiredRequestParameters(); + $provided = array_merge($defaults, $options); + + $this->checkRequiredParameters($required, $provided); + + return $provided; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AuthorizationCode.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AuthorizationCode.php new file mode 100644 index 0000000000..c49460c02d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/AuthorizationCode.php @@ -0,0 +1,41 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant; + +/** + * Represents an authorization code grant. + * + * @link http://tools.ietf.org/html/rfc6749#section-1.3.1 Authorization Code (RFC 6749, §1.3.1) + */ +class AuthorizationCode extends AbstractGrant +{ + /** + * @inheritdoc + */ + protected function getName() + { + return 'authorization_code'; + } + + /** + * @inheritdoc + */ + protected function getRequiredRequestParameters() + { + return [ + 'code', + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/ClientCredentials.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/ClientCredentials.php new file mode 100644 index 0000000000..dc78c4fdab --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/ClientCredentials.php @@ -0,0 +1,39 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant; + +/** + * Represents a client credentials grant. + * + * @link http://tools.ietf.org/html/rfc6749#section-1.3.4 Client Credentials (RFC 6749, §1.3.4) + */ +class ClientCredentials extends AbstractGrant +{ + /** + * @inheritdoc + */ + protected function getName() + { + return 'client_credentials'; + } + + /** + * @inheritdoc + */ + protected function getRequiredRequestParameters() + { + return []; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Exception/InvalidGrantException.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Exception/InvalidGrantException.php new file mode 100644 index 0000000000..c3c4e677b4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Exception/InvalidGrantException.php @@ -0,0 +1,26 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant\Exception; + +use InvalidArgumentException; + +/** + * Exception thrown if the grant does not extend from AbstractGrant. + * + * @see League\OAuth2\Client\Grant\AbstractGrant + */ +class InvalidGrantException extends InvalidArgumentException +{ +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/GrantFactory.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/GrantFactory.php new file mode 100644 index 0000000000..71990e83db --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/GrantFactory.php @@ -0,0 +1,104 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant; + +use League\OAuth2\Client\Grant\Exception\InvalidGrantException; + +/** + * Represents a factory used when retrieving an authorization grant type. + */ +class GrantFactory +{ + /** + * @var array + */ + protected $registry = []; + + /** + * Defines a grant singleton in the registry. + * + * @param string $name + * @param AbstractGrant $grant + * @return self + */ + public function setGrant($name, AbstractGrant $grant) + { + $this->registry[$name] = $grant; + + return $this; + } + + /** + * Returns a grant singleton by name. + * + * If the grant has not be registered, a default grant will be loaded. + * + * @param string $name + * @return AbstractGrant + */ + public function getGrant($name) + { + if (empty($this->registry[$name])) { + $this->registerDefaultGrant($name); + } + + return $this->registry[$name]; + } + + /** + * Registers a default grant singleton by name. + * + * @param string $name + * @return self + */ + protected function registerDefaultGrant($name) + { + // PascalCase the grant. E.g: 'authorization_code' becomes 'AuthorizationCode' + $class = str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $name))); + $class = 'League\\OAuth2\\Client\\Grant\\' . $class; + + $this->checkGrant($class); + + return $this->setGrant($name, new $class); + } + + /** + * Determines if a variable is a valid grant. + * + * @param mixed $class + * @return boolean + */ + public function isGrant($class) + { + return is_subclass_of($class, AbstractGrant::class); + } + + /** + * Checks if a variable is a valid grant. + * + * @throws InvalidGrantException + * @param mixed $class + * @return void + */ + public function checkGrant($class) + { + if (!$this->isGrant($class)) { + throw new InvalidGrantException(sprintf( + 'Grant "%s" must extend AbstractGrant', + is_object($class) ? get_class($class) : $class + )); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Password.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Password.php new file mode 100644 index 0000000000..6543b2ebd1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/Password.php @@ -0,0 +1,42 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant; + +/** + * Represents a resource owner password credentials grant. + * + * @link http://tools.ietf.org/html/rfc6749#section-1.3.3 Resource Owner Password Credentials (RFC 6749, §1.3.3) + */ +class Password extends AbstractGrant +{ + /** + * @inheritdoc + */ + protected function getName() + { + return 'password'; + } + + /** + * @inheritdoc + */ + protected function getRequiredRequestParameters() + { + return [ + 'username', + 'password', + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/RefreshToken.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/RefreshToken.php new file mode 100644 index 0000000000..8192182301 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Grant/RefreshToken.php @@ -0,0 +1,41 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Grant; + +/** + * Represents a refresh token grant. + * + * @link http://tools.ietf.org/html/rfc6749#section-6 Refreshing an Access Token (RFC 6749, §6) + */ +class RefreshToken extends AbstractGrant +{ + /** + * @inheritdoc + */ + protected function getName() + { + return 'refresh_token'; + } + + /** + * @inheritdoc + */ + protected function getRequiredRequestParameters() + { + return [ + 'refresh_token', + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/HttpBasicAuthOptionProvider.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/HttpBasicAuthOptionProvider.php new file mode 100644 index 0000000000..3da4065682 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/HttpBasicAuthOptionProvider.php @@ -0,0 +1,42 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\OptionProvider; + +use InvalidArgumentException; + +/** + * Add http basic auth into access token request options + * @link https://tools.ietf.org/html/rfc6749#section-2.3.1 + */ +class HttpBasicAuthOptionProvider extends PostAuthOptionProvider +{ + /** + * @inheritdoc + */ + public function getAccessTokenOptions($method, array $params) + { + if (empty($params['client_id']) || empty($params['client_secret'])) { + throw new InvalidArgumentException('clientId and clientSecret are required for http basic auth'); + } + + $encodedCredentials = base64_encode(sprintf('%s:%s', $params['client_id'], $params['client_secret'])); + unset($params['client_id'], $params['client_secret']); + + $options = parent::getAccessTokenOptions($method, $params); + $options['headers']['Authorization'] = 'Basic ' . $encodedCredentials; + + return $options; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/OptionProviderInterface.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/OptionProviderInterface.php new file mode 100644 index 0000000000..1126d25aa0 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/OptionProviderInterface.php @@ -0,0 +1,30 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\OptionProvider; + +/** + * Interface for access token options provider + */ +interface OptionProviderInterface +{ + /** + * Builds request options used for requesting an access token. + * + * @param string $method + * @param array $params + * @return array + */ + public function getAccessTokenOptions($method, array $params); +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/PostAuthOptionProvider.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/PostAuthOptionProvider.php new file mode 100644 index 0000000000..12d920ecf9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/OptionProvider/PostAuthOptionProvider.php @@ -0,0 +1,51 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\OptionProvider; + +use League\OAuth2\Client\Provider\AbstractProvider; +use League\OAuth2\Client\Tool\QueryBuilderTrait; + +/** + * Provide options for access token + */ +class PostAuthOptionProvider implements OptionProviderInterface +{ + use QueryBuilderTrait; + + /** + * @inheritdoc + */ + public function getAccessTokenOptions($method, array $params) + { + $options = ['headers' => ['content-type' => 'application/x-www-form-urlencoded']]; + + if ($method === AbstractProvider::METHOD_POST) { + $options['body'] = $this->getAccessTokenBody($params); + } + + return $options; + } + + /** + * Returns the request body for requesting an access token. + * + * @param array $params + * @return string + */ + protected function getAccessTokenBody(array $params) + { + return $this->buildQueryString($params); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/AbstractProvider.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/AbstractProvider.php new file mode 100644 index 0000000000..293a54d6e6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/AbstractProvider.php @@ -0,0 +1,941 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Provider; + +use GuzzleHttp\Client as HttpClient; +use GuzzleHttp\ClientInterface as HttpClientInterface; +use GuzzleHttp\Exception\BadResponseException; +use InvalidArgumentException; +use League\OAuth2\Client\Grant\AbstractGrant; +use League\OAuth2\Client\Grant\GrantFactory; +use League\OAuth2\Client\OptionProvider\OptionProviderInterface; +use League\OAuth2\Client\OptionProvider\PostAuthOptionProvider; +use League\OAuth2\Client\Provider\Exception\IdentityProviderException; +use League\OAuth2\Client\Token\AccessToken; +use League\OAuth2\Client\Token\AccessTokenInterface; +use League\OAuth2\Client\Tool\ArrayAccessorTrait; +use League\OAuth2\Client\Tool\GuardedPropertyTrait; +use League\OAuth2\Client\Tool\QueryBuilderTrait; +use League\OAuth2\Client\Tool\RequestFactory; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; +use UnexpectedValueException; + +/** + * Represents a service provider (authorization server). + * + * @link http://tools.ietf.org/html/rfc6749#section-1.1 Roles (RFC 6749, §1.1) + */ +abstract class AbstractProvider +{ + use ArrayAccessorTrait; + use GuardedPropertyTrait; + use QueryBuilderTrait; + + /** + * @var string|null Key used in a token response to identify the resource owner. + */ + const ACCESS_TOKEN_RESOURCE_OWNER_ID = null; + + /** + * @var string HTTP method used to fetch access tokens. + */ + const METHOD_GET = 'GET'; + + /** + * @var string HTTP method used to fetch access tokens. + */ + const METHOD_POST = 'POST'; + + /** + * @var string PKCE method used to fetch authorization token. + * The PKCE code challenge will be hashed with sha256 (recommended). + */ + const PKCE_METHOD_S256 = 'S256'; + + /** + * @var string PKCE method used to fetch authorization token. + * The PKCE code challenge will be sent as plain text, this is NOT recommended. + * Only use `plain` if no other option is possible. + */ + const PKCE_METHOD_PLAIN = 'plain'; + + /** + * @var string + */ + protected $clientId; + + /** + * @var string + */ + protected $clientSecret; + + /** + * @var string + */ + protected $redirectUri; + + /** + * @var string + */ + protected $state; + + /** + * @var string|null + */ + protected $pkceCode = null; + + /** + * @var GrantFactory + */ + protected $grantFactory; + + /** + * @var RequestFactory + */ + protected $requestFactory; + + /** + * @var HttpClientInterface + */ + protected $httpClient; + + /** + * @var OptionProviderInterface + */ + protected $optionProvider; + + /** + * Constructs an OAuth 2.0 service provider. + * + * @param array $options An array of options to set on this provider. + * Options include `clientId`, `clientSecret`, `redirectUri`, and `state`. + * Individual providers may introduce more options, as needed. + * @param array $collaborators An array of collaborators that may be used to + * override this provider's default behavior. Collaborators include + * `grantFactory`, `requestFactory`, and `httpClient`. + * Individual providers may introduce more collaborators, as needed. + */ + public function __construct(array $options = [], array $collaborators = []) + { + // We'll let the GuardedPropertyTrait handle mass assignment of incoming + // options, skipping any blacklisted properties defined in the provider + $this->fillProperties($options); + + if (empty($collaborators['grantFactory'])) { + $collaborators['grantFactory'] = new GrantFactory(); + } + $this->setGrantFactory($collaborators['grantFactory']); + + if (empty($collaborators['requestFactory'])) { + $collaborators['requestFactory'] = new RequestFactory(); + } + $this->setRequestFactory($collaborators['requestFactory']); + + if (empty($collaborators['httpClient'])) { + $client_options = $this->getAllowedClientOptions($options); + + $collaborators['httpClient'] = new HttpClient( + array_intersect_key($options, array_flip($client_options)) + ); + } + $this->setHttpClient($collaborators['httpClient']); + + if (empty($collaborators['optionProvider'])) { + $collaborators['optionProvider'] = new PostAuthOptionProvider(); + } + $this->setOptionProvider($collaborators['optionProvider']); + } + + /** + * Returns the list of options that can be passed to the HttpClient + * + * @param array $options An array of options to set on this provider. + * Options include `clientId`, `clientSecret`, `redirectUri`, and `state`. + * Individual providers may introduce more options, as needed. + * @return array The options to pass to the HttpClient constructor + */ + protected function getAllowedClientOptions(array $options) + { + $client_options = ['timeout', 'proxy']; + + // Only allow turning off ssl verification if it's for a proxy + if (!empty($options['proxy'])) { + $client_options[] = 'verify'; + } + + return $client_options; + } + + /** + * Sets the grant factory instance. + * + * @param GrantFactory $factory + * @return self + */ + public function setGrantFactory(GrantFactory $factory) + { + $this->grantFactory = $factory; + + return $this; + } + + /** + * Returns the current grant factory instance. + * + * @return GrantFactory + */ + public function getGrantFactory() + { + return $this->grantFactory; + } + + /** + * Sets the request factory instance. + * + * @param RequestFactory $factory + * @return self + */ + public function setRequestFactory(RequestFactory $factory) + { + $this->requestFactory = $factory; + + return $this; + } + + /** + * Returns the request factory instance. + * + * @return RequestFactory + */ + public function getRequestFactory() + { + return $this->requestFactory; + } + + /** + * Sets the HTTP client instance. + * + * @param HttpClientInterface $client + * @return self + */ + public function setHttpClient(HttpClientInterface $client) + { + $this->httpClient = $client; + + return $this; + } + + /** + * Returns the HTTP client instance. + * + * @return HttpClientInterface + */ + public function getHttpClient() + { + return $this->httpClient; + } + + /** + * Sets the option provider instance. + * + * @param OptionProviderInterface $provider + * @return self + */ + public function setOptionProvider(OptionProviderInterface $provider) + { + $this->optionProvider = $provider; + + return $this; + } + + /** + * Returns the option provider instance. + * + * @return OptionProviderInterface + */ + public function getOptionProvider() + { + return $this->optionProvider; + } + + /** + * Returns the current value of the state parameter. + * + * This can be accessed by the redirect handler during authorization. + * + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Set the value of the pkceCode parameter. + * + * When using PKCE this should be set before requesting an access token. + * + * @param string $pkceCode + * @return self + */ + public function setPkceCode($pkceCode) + { + $this->pkceCode = $pkceCode; + return $this; + } + + /** + * Returns the current value of the pkceCode parameter. + * + * This can be accessed by the redirect handler during authorization. + * + * @return string|null + */ + public function getPkceCode() + { + return $this->pkceCode; + } + + /** + * Returns the base URL for authorizing a client. + * + * Eg. https://oauth.service.com/authorize + * + * @return string + */ + abstract public function getBaseAuthorizationUrl(); + + /** + * Returns the base URL for requesting an access token. + * + * Eg. https://oauth.service.com/token + * + * @param array $params + * @return string + */ + abstract public function getBaseAccessTokenUrl(array $params); + + /** + * Returns the URL for requesting the resource owner's details. + * + * @param AccessToken $token + * @return string + */ + abstract public function getResourceOwnerDetailsUrl(AccessToken $token); + + /** + * Returns a new random string to use as the state parameter in an + * authorization flow. + * + * @param int $length Length of the random string to be generated. + * @return string + */ + protected function getRandomState($length = 32) + { + // Converting bytes to hex will always double length. Hence, we can reduce + // the amount of bytes by half to produce the correct length. + return bin2hex(random_bytes($length / 2)); + } + + /** + * Returns a new random string to use as PKCE code_verifier and + * hashed as code_challenge parameters in an authorization flow. + * Must be between 43 and 128 characters long. + * + * @param int $length Length of the random string to be generated. + * @return string + */ + protected function getRandomPkceCode($length = 64) + { + return substr( + strtr( + base64_encode(random_bytes($length)), + '+/', + '-_' + ), + 0, + $length + ); + } + + /** + * Returns the default scopes used by this provider. + * + * This should only be the scopes that are required to request the details + * of the resource owner, rather than all the available scopes. + * + * @return array + */ + abstract protected function getDefaultScopes(); + + /** + * Returns the string that should be used to separate scopes when building + * the URL for requesting an access token. + * + * @return string Scope separator, defaults to ',' + */ + protected function getScopeSeparator() + { + return ','; + } + + /** + * @return string|null + */ + protected function getPkceMethod() + { + return null; + } + + /** + * Returns authorization parameters based on provided options. + * + * @param array $options + * @return array Authorization parameters + */ + protected function getAuthorizationParameters(array $options) + { + if (empty($options['state'])) { + $options['state'] = $this->getRandomState(); + } + + if (empty($options['scope'])) { + $options['scope'] = $this->getDefaultScopes(); + } + + $options += [ + 'response_type' => 'code', + 'approval_prompt' => 'auto' + ]; + + if (is_array($options['scope'])) { + $separator = $this->getScopeSeparator(); + $options['scope'] = implode($separator, $options['scope']); + } + + // Store the state as it may need to be accessed later on. + $this->state = $options['state']; + + $pkceMethod = $this->getPkceMethod(); + if (!empty($pkceMethod)) { + $this->pkceCode = $this->getRandomPkceCode(); + if ($pkceMethod === static::PKCE_METHOD_S256) { + $options['code_challenge'] = trim( + strtr( + base64_encode(hash('sha256', $this->pkceCode, true)), + '+/', + '-_' + ), + '=' + ); + } elseif ($pkceMethod === static::PKCE_METHOD_PLAIN) { + $options['code_challenge'] = $this->pkceCode; + } else { + throw new InvalidArgumentException('Unknown PKCE method "' . $pkceMethod . '".'); + } + $options['code_challenge_method'] = $pkceMethod; + } + + // Business code layer might set a different redirect_uri parameter + // depending on the context, leave it as-is + if (!isset($options['redirect_uri'])) { + $options['redirect_uri'] = $this->redirectUri; + } + + $options['client_id'] = $this->clientId; + + return $options; + } + + /** + * Builds the authorization URL's query string. + * + * @param array $params Query parameters + * @return string Query string + */ + protected function getAuthorizationQuery(array $params) + { + return $this->buildQueryString($params); + } + + /** + * Builds the authorization URL. + * + * @param array $options + * @return string Authorization URL + */ + public function getAuthorizationUrl(array $options = []) + { + $base = $this->getBaseAuthorizationUrl(); + $params = $this->getAuthorizationParameters($options); + $query = $this->getAuthorizationQuery($params); + + return $this->appendQuery($base, $query); + } + + /** + * Redirects the client for authorization. + * + * @param array $options + * @param callable|null $redirectHandler + * @return mixed + */ + public function authorize( + array $options = [], + callable $redirectHandler = null + ) { + $url = $this->getAuthorizationUrl($options); + if ($redirectHandler) { + return $redirectHandler($url, $this); + } + + // @codeCoverageIgnoreStart + header('Location: ' . $url); + exit; + // @codeCoverageIgnoreEnd + } + + /** + * Appends a query string to a URL. + * + * @param string $url The URL to append the query to + * @param string $query The HTTP query string + * @return string The resulting URL + */ + protected function appendQuery($url, $query) + { + $query = trim($query, '?&'); + + if ($query) { + $glue = strstr($url, '?') === false ? '?' : '&'; + return $url . $glue . $query; + } + + return $url; + } + + /** + * Returns the method to use when requesting an access token. + * + * @return string HTTP method + */ + protected function getAccessTokenMethod() + { + return self::METHOD_POST; + } + + /** + * Returns the key used in the access token response to identify the resource owner. + * + * @return string|null Resource owner identifier key + */ + protected function getAccessTokenResourceOwnerId() + { + return static::ACCESS_TOKEN_RESOURCE_OWNER_ID; + } + + /** + * Builds the access token URL's query string. + * + * @param array $params Query parameters + * @return string Query string + */ + protected function getAccessTokenQuery(array $params) + { + return $this->buildQueryString($params); + } + + /** + * Checks that a provided grant is valid, or attempts to produce one if the + * provided grant is a string. + * + * @param AbstractGrant|string $grant + * @return AbstractGrant + */ + protected function verifyGrant($grant) + { + if (is_string($grant)) { + return $this->grantFactory->getGrant($grant); + } + + $this->grantFactory->checkGrant($grant); + return $grant; + } + + /** + * Returns the full URL to use when requesting an access token. + * + * @param array $params Query parameters + * @return string + */ + protected function getAccessTokenUrl(array $params) + { + $url = $this->getBaseAccessTokenUrl($params); + + if ($this->getAccessTokenMethod() === self::METHOD_GET) { + $query = $this->getAccessTokenQuery($params); + return $this->appendQuery($url, $query); + } + + return $url; + } + + /** + * Returns a prepared request for requesting an access token. + * + * @param array $params Query string parameters + * @return RequestInterface + */ + protected function getAccessTokenRequest(array $params) + { + $method = $this->getAccessTokenMethod(); + $url = $this->getAccessTokenUrl($params); + $options = $this->optionProvider->getAccessTokenOptions($this->getAccessTokenMethod(), $params); + + return $this->getRequest($method, $url, $options); + } + + /** + * Requests an access token using a specified grant and option set. + * + * @param mixed $grant + * @param array $options + * @throws IdentityProviderException + * @return AccessTokenInterface + */ + public function getAccessToken($grant, array $options = []) + { + $grant = $this->verifyGrant($grant); + + $params = [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + 'redirect_uri' => $this->redirectUri, + ]; + + if (!empty($this->pkceCode)) { + $params['code_verifier'] = $this->pkceCode; + } + + $params = $grant->prepareRequestParameters($params, $options); + $request = $this->getAccessTokenRequest($params); + $response = $this->getParsedResponse($request); + if (false === is_array($response)) { + throw new UnexpectedValueException( + 'Invalid response received from Authorization Server. Expected JSON.' + ); + } + $prepared = $this->prepareAccessTokenResponse($response); + $token = $this->createAccessToken($prepared, $grant); + + return $token; + } + + /** + * Returns a PSR-7 request instance that is not authenticated. + * + * @param string $method + * @param string $url + * @param array $options + * @return RequestInterface + */ + public function getRequest($method, $url, array $options = []) + { + return $this->createRequest($method, $url, null, $options); + } + + /** + * Returns an authenticated PSR-7 request instance. + * + * @param string $method + * @param string $url + * @param AccessTokenInterface|string|null $token + * @param array $options Any of "headers", "body", and "protocolVersion". + * @return RequestInterface + */ + public function getAuthenticatedRequest($method, $url, $token, array $options = []) + { + return $this->createRequest($method, $url, $token, $options); + } + + /** + * Creates a PSR-7 request instance. + * + * @param string $method + * @param string $url + * @param AccessTokenInterface|string|null $token + * @param array $options + * @return RequestInterface + */ + protected function createRequest($method, $url, $token, array $options) + { + $defaults = [ + 'headers' => $this->getHeaders($token), + ]; + + $options = array_merge_recursive($defaults, $options); + $factory = $this->getRequestFactory(); + + return $factory->getRequestWithOptions($method, $url, $options); + } + + /** + * Sends a request instance and returns a response instance. + * + * WARNING: This method does not attempt to catch exceptions caused by HTTP + * errors! It is recommended to wrap this method in a try/catch block. + * + * @param RequestInterface $request + * @return ResponseInterface + */ + public function getResponse(RequestInterface $request) + { + return $this->getHttpClient()->send($request); + } + + /** + * Sends a request and returns the parsed response. + * + * @param RequestInterface $request + * @throws IdentityProviderException + * @return mixed + */ + public function getParsedResponse(RequestInterface $request) + { + try { + $response = $this->getResponse($request); + } catch (BadResponseException $e) { + $response = $e->getResponse(); + } + + $parsed = $this->parseResponse($response); + + $this->checkResponse($response, $parsed); + + return $parsed; + } + + /** + * Attempts to parse a JSON response. + * + * @param string $content JSON content from response body + * @return array Parsed JSON data + * @throws UnexpectedValueException if the content could not be parsed + */ + protected function parseJson($content) + { + $content = json_decode($content, true); + + if (json_last_error() !== JSON_ERROR_NONE) { + throw new UnexpectedValueException(sprintf( + "Failed to parse JSON response: %s", + json_last_error_msg() + )); + } + + return $content; + } + + /** + * Returns the content type header of a response. + * + * @param ResponseInterface $response + * @return string Semi-colon separated join of content-type headers. + */ + protected function getContentType(ResponseInterface $response) + { + return join(';', (array) $response->getHeader('content-type')); + } + + /** + * Parses the response according to its content-type header. + * + * @throws UnexpectedValueException + * @param ResponseInterface $response + * @return array + */ + protected function parseResponse(ResponseInterface $response) + { + $content = (string) $response->getBody(); + $type = $this->getContentType($response); + + if (strpos($type, 'urlencoded') !== false) { + parse_str($content, $parsed); + return $parsed; + } + + // Attempt to parse the string as JSON regardless of content type, + // since some providers use non-standard content types. Only throw an + // exception if the JSON could not be parsed when it was expected to. + try { + return $this->parseJson($content); + } catch (UnexpectedValueException $e) { + if (strpos($type, 'json') !== false) { + throw $e; + } + + if ($response->getStatusCode() == 500) { + throw new UnexpectedValueException( + 'An OAuth server error was encountered that did not contain a JSON body', + 0, + $e + ); + } + + return $content; + } + } + + /** + * Checks a provider response for errors. + * + * @throws IdentityProviderException + * @param ResponseInterface $response + * @param array|string $data Parsed response data + * @return void + */ + abstract protected function checkResponse(ResponseInterface $response, $data); + + /** + * Prepares an parsed access token response for a grant. + * + * Custom mapping of expiration, etc should be done here. Always call the + * parent method when overloading this method. + * + * @param mixed $result + * @return array + */ + protected function prepareAccessTokenResponse(array $result) + { + if ($this->getAccessTokenResourceOwnerId() !== null) { + $result['resource_owner_id'] = $this->getValueByKey( + $result, + $this->getAccessTokenResourceOwnerId() + ); + } + return $result; + } + + /** + * Creates an access token from a response. + * + * The grant that was used to fetch the response can be used to provide + * additional context. + * + * @param array $response + * @param AbstractGrant $grant + * @return AccessTokenInterface + */ + protected function createAccessToken(array $response, AbstractGrant $grant) + { + return new AccessToken($response); + } + + /** + * Generates a resource owner object from a successful resource owner + * details request. + * + * @param array $response + * @param AccessToken $token + * @return ResourceOwnerInterface + */ + abstract protected function createResourceOwner(array $response, AccessToken $token); + + /** + * Requests and returns the resource owner of given access token. + * + * @param AccessToken $token + * @return ResourceOwnerInterface + */ + public function getResourceOwner(AccessToken $token) + { + $response = $this->fetchResourceOwnerDetails($token); + + return $this->createResourceOwner($response, $token); + } + + /** + * Requests resource owner details. + * + * @param AccessToken $token + * @return mixed + */ + protected function fetchResourceOwnerDetails(AccessToken $token) + { + $url = $this->getResourceOwnerDetailsUrl($token); + + $request = $this->getAuthenticatedRequest(self::METHOD_GET, $url, $token); + + $response = $this->getParsedResponse($request); + + if (false === is_array($response)) { + throw new UnexpectedValueException( + 'Invalid response received from Authorization Server. Expected JSON.' + ); + } + + return $response; + } + + /** + * Returns the default headers used by this provider. + * + * Typically this is used to set 'Accept' or 'Content-Type' headers. + * + * @return array + */ + protected function getDefaultHeaders() + { + return []; + } + + /** + * Returns the authorization headers used by this provider. + * + * Typically this is "Bearer" or "MAC". For more information see: + * http://tools.ietf.org/html/rfc6749#section-7.1 + * + * No default is provided, providers must overload this method to activate + * authorization headers. + * + * @param mixed|null $token Either a string or an access token instance + * @return array + */ + protected function getAuthorizationHeaders($token = null) + { + return []; + } + + /** + * Returns all headers used by this provider for a request. + * + * The request will be authenticated if an access token is provided. + * + * @param mixed|null $token object or string + * @return array + */ + public function getHeaders($token = null) + { + if ($token) { + return array_merge( + $this->getDefaultHeaders(), + $this->getAuthorizationHeaders($token) + ); + } + + return $this->getDefaultHeaders(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/Exception/IdentityProviderException.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/Exception/IdentityProviderException.php new file mode 100644 index 0000000000..55cb438fb1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/Exception/IdentityProviderException.php @@ -0,0 +1,48 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Provider\Exception; + +/** + * Exception thrown if the provider response contains errors. + */ +class IdentityProviderException extends \Exception +{ + /** + * @var mixed + */ + protected $response; + + /** + * @param string $message + * @param int $code + * @param mixed $response The response body + */ + public function __construct($message, $code, $response) + { + $this->response = $response; + + parent::__construct($message, $code); + } + + /** + * Returns the exception's response body. + * + * @return mixed + */ + public function getResponseBody() + { + return $this->response; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericProvider.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericProvider.php new file mode 100644 index 0000000000..0fc95f2502 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericProvider.php @@ -0,0 +1,247 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Provider; + +use InvalidArgumentException; +use League\OAuth2\Client\Provider\Exception\IdentityProviderException; +use League\OAuth2\Client\Token\AccessToken; +use League\OAuth2\Client\Tool\BearerAuthorizationTrait; +use Psr\Http\Message\ResponseInterface; + +/** + * Represents a generic service provider that may be used to interact with any + * OAuth 2.0 service provider, using Bearer token authentication. + */ +class GenericProvider extends AbstractProvider +{ + use BearerAuthorizationTrait; + + /** + * @var string + */ + private $urlAuthorize; + + /** + * @var string + */ + private $urlAccessToken; + + /** + * @var string + */ + private $urlResourceOwnerDetails; + + /** + * @var string + */ + private $accessTokenMethod; + + /** + * @var string + */ + private $accessTokenResourceOwnerId; + + /** + * @var array|null + */ + private $scopes = null; + + /** + * @var string + */ + private $scopeSeparator; + + /** + * @var string + */ + private $responseError = 'error'; + + /** + * @var string + */ + private $responseCode; + + /** + * @var string + */ + private $responseResourceOwnerId = 'id'; + + /** + * @var string|null + */ + private $pkceMethod = null; + + /** + * @param array $options + * @param array $collaborators + */ + public function __construct(array $options = [], array $collaborators = []) + { + $this->assertRequiredOptions($options); + + $possible = $this->getConfigurableOptions(); + $configured = array_intersect_key($options, array_flip($possible)); + + foreach ($configured as $key => $value) { + $this->$key = $value; + } + + // Remove all options that are only used locally + $options = array_diff_key($options, $configured); + + parent::__construct($options, $collaborators); + } + + /** + * Returns all options that can be configured. + * + * @return array + */ + protected function getConfigurableOptions() + { + return array_merge($this->getRequiredOptions(), [ + 'accessTokenMethod', + 'accessTokenResourceOwnerId', + 'scopeSeparator', + 'responseError', + 'responseCode', + 'responseResourceOwnerId', + 'scopes', + 'pkceMethod', + ]); + } + + /** + * Returns all options that are required. + * + * @return array + */ + protected function getRequiredOptions() + { + return [ + 'urlAuthorize', + 'urlAccessToken', + 'urlResourceOwnerDetails', + ]; + } + + /** + * Verifies that all required options have been passed. + * + * @param array $options + * @return void + * @throws InvalidArgumentException + */ + private function assertRequiredOptions(array $options) + { + $missing = array_diff_key(array_flip($this->getRequiredOptions()), $options); + + if (!empty($missing)) { + throw new InvalidArgumentException( + 'Required options not defined: ' . implode(', ', array_keys($missing)) + ); + } + } + + /** + * @inheritdoc + */ + public function getBaseAuthorizationUrl() + { + return $this->urlAuthorize; + } + + /** + * @inheritdoc + */ + public function getBaseAccessTokenUrl(array $params) + { + return $this->urlAccessToken; + } + + /** + * @inheritdoc + */ + public function getResourceOwnerDetailsUrl(AccessToken $token) + { + return $this->urlResourceOwnerDetails; + } + + /** + * @inheritdoc + */ + public function getDefaultScopes() + { + return $this->scopes; + } + + /** + * @inheritdoc + */ + protected function getAccessTokenMethod() + { + return $this->accessTokenMethod ?: parent::getAccessTokenMethod(); + } + + /** + * @inheritdoc + */ + protected function getAccessTokenResourceOwnerId() + { + return $this->accessTokenResourceOwnerId ?: parent::getAccessTokenResourceOwnerId(); + } + + /** + * @inheritdoc + */ + protected function getScopeSeparator() + { + return $this->scopeSeparator ?: parent::getScopeSeparator(); + } + + /** + * @inheritdoc + */ + protected function getPkceMethod() + { + return $this->pkceMethod ?: parent::getPkceMethod(); + } + + /** + * @inheritdoc + */ + protected function checkResponse(ResponseInterface $response, $data) + { + if (!empty($data[$this->responseError])) { + $error = $data[$this->responseError]; + if (!is_string($error)) { + $error = var_export($error, true); + } + $code = $this->responseCode && !empty($data[$this->responseCode])? $data[$this->responseCode] : 0; + if (!is_int($code)) { + $code = intval($code); + } + throw new IdentityProviderException($error, $code, $data); + } + } + + /** + * @inheritdoc + */ + protected function createResourceOwner(array $response, AccessToken $token) + { + return new GenericResourceOwner($response, $this->responseResourceOwnerId); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericResourceOwner.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericResourceOwner.php new file mode 100644 index 0000000000..f876614851 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/GenericResourceOwner.php @@ -0,0 +1,61 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Provider; + +/** + * Represents a generic resource owner for use with the GenericProvider. + */ +class GenericResourceOwner implements ResourceOwnerInterface +{ + /** + * @var array + */ + protected $response; + + /** + * @var string + */ + protected $resourceOwnerId; + + /** + * @param array $response + * @param string $resourceOwnerId + */ + public function __construct(array $response, $resourceOwnerId) + { + $this->response = $response; + $this->resourceOwnerId = $resourceOwnerId; + } + + /** + * Returns the identifier of the authorized resource owner. + * + * @return mixed + */ + public function getId() + { + return $this->response[$this->resourceOwnerId]; + } + + /** + * Returns the raw resource owner response. + * + * @return array + */ + public function toArray() + { + return $this->response; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/ResourceOwnerInterface.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/ResourceOwnerInterface.php new file mode 100644 index 0000000000..828442425f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Provider/ResourceOwnerInterface.php @@ -0,0 +1,36 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Provider; + +/** + * Classes implementing `ResourceOwnerInterface` may be used to represent + * the resource owner authenticated with a service provider. + */ +interface ResourceOwnerInterface +{ + /** + * Returns the identifier of the authorized resource owner. + * + * @return mixed + */ + public function getId(); + + /** + * Return all of the owner details available as an array. + * + * @return array + */ + public function toArray(); +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessToken.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessToken.php new file mode 100644 index 0000000000..81533c3072 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessToken.php @@ -0,0 +1,243 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Token; + +use InvalidArgumentException; +use RuntimeException; + +/** + * Represents an access token. + * + * @link http://tools.ietf.org/html/rfc6749#section-1.4 Access Token (RFC 6749, §1.4) + */ +class AccessToken implements AccessTokenInterface, ResourceOwnerAccessTokenInterface +{ + /** + * @var string + */ + protected $accessToken; + + /** + * @var int + */ + protected $expires; + + /** + * @var string + */ + protected $refreshToken; + + /** + * @var string + */ + protected $resourceOwnerId; + + /** + * @var array + */ + protected $values = []; + + /** + * @var int + */ + private static $timeNow; + + /** + * Set the time now. This should only be used for testing purposes. + * + * @param int $timeNow the time in seconds since epoch + * @return void + */ + public static function setTimeNow($timeNow) + { + self::$timeNow = $timeNow; + } + + /** + * Reset the time now if it was set for test purposes. + * + * @return void + */ + public static function resetTimeNow() + { + self::$timeNow = null; + } + + /** + * @return int + */ + public function getTimeNow() + { + return self::$timeNow ? self::$timeNow : time(); + } + + /** + * Constructs an access token. + * + * @param array $options An array of options returned by the service provider + * in the access token request. The `access_token` option is required. + * @throws InvalidArgumentException if `access_token` is not provided in `$options`. + */ + public function __construct(array $options = []) + { + if (empty($options['access_token'])) { + throw new InvalidArgumentException('Required option not passed: "access_token"'); + } + + $this->accessToken = $options['access_token']; + + if (!empty($options['resource_owner_id'])) { + $this->resourceOwnerId = $options['resource_owner_id']; + } + + if (!empty($options['refresh_token'])) { + $this->refreshToken = $options['refresh_token']; + } + + // We need to know when the token expires. Show preference to + // 'expires_in' since it is defined in RFC6749 Section 5.1. + // Defer to 'expires' if it is provided instead. + if (isset($options['expires_in'])) { + if (!is_numeric($options['expires_in'])) { + throw new \InvalidArgumentException('expires_in value must be an integer'); + } + + $this->expires = $options['expires_in'] != 0 ? $this->getTimeNow() + $options['expires_in'] : 0; + } elseif (!empty($options['expires'])) { + // Some providers supply the seconds until expiration rather than + // the exact timestamp. Take a best guess at which we received. + $expires = $options['expires']; + + if (!$this->isExpirationTimestamp($expires)) { + $expires += $this->getTimeNow(); + } + + $this->expires = $expires; + } + + // Capture any additional values that might exist in the token but are + // not part of the standard response. Vendors will sometimes pass + // additional user data this way. + $this->values = array_diff_key($options, array_flip([ + 'access_token', + 'resource_owner_id', + 'refresh_token', + 'expires_in', + 'expires', + ])); + } + + /** + * Check if a value is an expiration timestamp or second value. + * + * @param integer $value + * @return bool + */ + protected function isExpirationTimestamp($value) + { + // If the given value is larger than the original OAuth 2 draft date, + // assume that it is meant to be a (possible expired) timestamp. + $oauth2InceptionDate = 1349067600; // 2012-10-01 + return ($value > $oauth2InceptionDate); + } + + /** + * @inheritdoc + */ + public function getToken() + { + return $this->accessToken; + } + + /** + * @inheritdoc + */ + public function getRefreshToken() + { + return $this->refreshToken; + } + + /** + * @inheritdoc + */ + public function getExpires() + { + return $this->expires; + } + + /** + * @inheritdoc + */ + public function getResourceOwnerId() + { + return $this->resourceOwnerId; + } + + /** + * @inheritdoc + */ + public function hasExpired() + { + $expires = $this->getExpires(); + + if (empty($expires)) { + throw new RuntimeException('"expires" is not set on the token'); + } + + return $expires < time(); + } + + /** + * @inheritdoc + */ + public function getValues() + { + return $this->values; + } + + /** + * @inheritdoc + */ + public function __toString() + { + return (string) $this->getToken(); + } + + /** + * @inheritdoc + */ + public function jsonSerialize() + { + $parameters = $this->values; + + if ($this->accessToken) { + $parameters['access_token'] = $this->accessToken; + } + + if ($this->refreshToken) { + $parameters['refresh_token'] = $this->refreshToken; + } + + if ($this->expires) { + $parameters['expires'] = $this->expires; + } + + if ($this->resourceOwnerId) { + $parameters['resource_owner_id'] = $this->resourceOwnerId; + } + + return $parameters; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessTokenInterface.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessTokenInterface.php new file mode 100644 index 0000000000..5fd219ffca --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/AccessTokenInterface.php @@ -0,0 +1,74 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Token; + +use JsonSerializable; +use ReturnTypeWillChange; +use RuntimeException; + +interface AccessTokenInterface extends JsonSerializable +{ + /** + * Returns the access token string of this instance. + * + * @return string + */ + public function getToken(); + + /** + * Returns the refresh token, if defined. + * + * @return string|null + */ + public function getRefreshToken(); + + /** + * Returns the expiration timestamp in seconds, if defined. + * + * @return integer|null + */ + public function getExpires(); + + /** + * Checks if this token has expired. + * + * @return boolean true if the token has expired, false otherwise. + * @throws RuntimeException if 'expires' is not set on the token. + */ + public function hasExpired(); + + /** + * Returns additional vendor values stored in the token. + * + * @return array + */ + public function getValues(); + + /** + * Returns a string representation of the access token + * + * @return string + */ + public function __toString(); + + /** + * Returns an array of parameters to serialize when this is serialized with + * json_encode(). + * + * @return array + */ + #[ReturnTypeWillChange] + public function jsonSerialize(); +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/ResourceOwnerAccessTokenInterface.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/ResourceOwnerAccessTokenInterface.php new file mode 100644 index 0000000000..51e4ce4139 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Token/ResourceOwnerAccessTokenInterface.php @@ -0,0 +1,25 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Token; + +interface ResourceOwnerAccessTokenInterface extends AccessTokenInterface +{ + /** + * Returns the resource owner identifier, if defined. + * + * @return string|null + */ + public function getResourceOwnerId(); +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ArrayAccessorTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ArrayAccessorTrait.php new file mode 100644 index 0000000000..a18198cf30 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ArrayAccessorTrait.php @@ -0,0 +1,52 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +/** + * Provides generic array navigation tools. + */ +trait ArrayAccessorTrait +{ + /** + * Returns a value by key using dot notation. + * + * @param array $data + * @param string $key + * @param mixed|null $default + * @return mixed + */ + private function getValueByKey(array $data, $key, $default = null) + { + if (!is_string($key) || empty($key) || !count($data)) { + return $default; + } + + if (strpos($key, '.') !== false) { + $keys = explode('.', $key); + + foreach ($keys as $innerKey) { + if (!is_array($data) || !array_key_exists($innerKey, $data)) { + return $default; + } + + $data = $data[$innerKey]; + } + + return $data; + } + + return array_key_exists($key, $data) ? $data[$key] : $default; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/BearerAuthorizationTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/BearerAuthorizationTrait.php new file mode 100644 index 0000000000..081c7c861e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/BearerAuthorizationTrait.php @@ -0,0 +1,36 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +use League\OAuth2\Client\Token\AccessTokenInterface; + +/** + * Enables `Bearer` header authorization for providers. + * + * @link http://tools.ietf.org/html/rfc6750 Bearer Token Usage (RFC 6750) + */ +trait BearerAuthorizationTrait +{ + /** + * Returns authorization headers for the 'bearer' grant. + * + * @param AccessTokenInterface|string|null $token Either a string or an access token instance + * @return array + */ + protected function getAuthorizationHeaders($token = null) + { + return ['Authorization' => 'Bearer ' . $token]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/GuardedPropertyTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/GuardedPropertyTrait.php new file mode 100644 index 0000000000..02c9ba5fb6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/GuardedPropertyTrait.php @@ -0,0 +1,70 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +/** + * Provides support for blacklisting explicit properties from the + * mass assignment behavior. + */ +trait GuardedPropertyTrait +{ + /** + * The properties that aren't mass assignable. + * + * @var array + */ + protected $guarded = []; + + /** + * Attempts to mass assign the given options to explicitly defined properties, + * skipping over any properties that are defined in the guarded array. + * + * @param array $options + * @return mixed + */ + protected function fillProperties(array $options = []) + { + if (isset($options['guarded'])) { + unset($options['guarded']); + } + + foreach ($options as $option => $value) { + if (property_exists($this, $option) && !$this->isGuarded($option)) { + $this->{$option} = $value; + } + } + } + + /** + * Returns current guarded properties. + * + * @return array + */ + public function getGuarded() + { + return $this->guarded; + } + + /** + * Determines if the given property is guarded. + * + * @param string $property + * @return bool + */ + public function isGuarded($property) + { + return in_array($property, $this->getGuarded()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/MacAuthorizationTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/MacAuthorizationTrait.php new file mode 100644 index 0000000000..f8dcd77c54 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/MacAuthorizationTrait.php @@ -0,0 +1,83 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +use League\OAuth2\Client\Token\AccessToken; +use League\OAuth2\Client\Token\AccessTokenInterface; + +/** + * Enables `MAC` header authorization for providers. + * + * @link http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-05 Message Authentication Code (MAC) Tokens + */ +trait MacAuthorizationTrait +{ + /** + * Returns the id of this token for MAC generation. + * + * @param AccessToken $token + * @return string + */ + abstract protected function getTokenId(AccessToken $token); + + /** + * Returns the MAC signature for the current request. + * + * @param string $id + * @param integer $ts + * @param string $nonce + * @return string + */ + abstract protected function getMacSignature($id, $ts, $nonce); + + /** + * Returns a new random string to use as the state parameter in an + * authorization flow. + * + * @param int $length Length of the random string to be generated. + * @return string + */ + abstract protected function getRandomState($length = 32); + + /** + * Returns the authorization headers for the 'mac' grant. + * + * @param AccessTokenInterface|string|null $token Either a string or an access token instance + * @return array + * @codeCoverageIgnore + * + * @todo This is currently untested and provided only as an example. If you + * complete the implementation, please create a pull request for + * https://github.com/thephpleague/oauth2-client + */ + protected function getAuthorizationHeaders($token = null) + { + if ($token === null) { + return []; + } + + $ts = time(); + $id = $this->getTokenId($token); + $nonce = $this->getRandomState(16); + $mac = $this->getMacSignature($id, $ts, $nonce); + + $parts = []; + foreach (compact('id', 'ts', 'nonce', 'mac') as $key => $value) { + $parts[] = sprintf('%s="%s"', $key, $value); + } + + return ['Authorization' => 'MAC ' . implode(', ', $parts)]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ProviderRedirectTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ProviderRedirectTrait.php new file mode 100644 index 0000000000..f81b511f9e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/ProviderRedirectTrait.php @@ -0,0 +1,122 @@ +redirectLimit) { + $attempts++; + $response = $this->getHttpClient()->send($request, [ + 'allow_redirects' => false + ]); + + if ($this->isRedirect($response)) { + $redirectUrl = new Uri($response->getHeader('Location')[0]); + $request = $request->withUri($redirectUrl); + } else { + break; + } + } + + return $response; + } + + /** + * Returns the HTTP client instance. + * + * @return GuzzleHttp\ClientInterface + */ + abstract public function getHttpClient(); + + /** + * Retrieves current redirect limit. + * + * @return integer + */ + public function getRedirectLimit() + { + return $this->redirectLimit; + } + + /** + * Determines if a given response is a redirect. + * + * @param ResponseInterface $response + * + * @return boolean + */ + protected function isRedirect(ResponseInterface $response) + { + $statusCode = $response->getStatusCode(); + + return $statusCode > 300 && $statusCode < 400 && $response->hasHeader('Location'); + } + + /** + * Sends a request instance and returns a response instance. + * + * WARNING: This method does not attempt to catch exceptions caused by HTTP + * errors! It is recommended to wrap this method in a try/catch block. + * + * @param RequestInterface $request + * @return ResponseInterface + */ + public function getResponse(RequestInterface $request) + { + try { + $response = $this->followRequestRedirects($request); + } catch (BadResponseException $e) { + $response = $e->getResponse(); + } + + return $response; + } + + /** + * Updates the redirect limit. + * + * @param integer $limit + * @return League\OAuth2\Client\Provider\AbstractProvider + * @throws InvalidArgumentException + */ + public function setRedirectLimit($limit) + { + if (!is_int($limit)) { + throw new InvalidArgumentException('redirectLimit must be an integer.'); + } + + if ($limit < 1) { + throw new InvalidArgumentException('redirectLimit must be greater than or equal to one.'); + } + + $this->redirectLimit = $limit; + + return $this; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/QueryBuilderTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/QueryBuilderTrait.php new file mode 100644 index 0000000000..bdda3e79ef --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/QueryBuilderTrait.php @@ -0,0 +1,33 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +/** + * Provides a standard way to generate query strings. + */ +trait QueryBuilderTrait +{ + /** + * Build a query string from an array. + * + * @param array $params + * + * @return string + */ + protected function buildQueryString(array $params) + { + return http_build_query($params, '', '&', \PHP_QUERY_RFC3986); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequestFactory.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequestFactory.php new file mode 100644 index 0000000000..1af434297f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequestFactory.php @@ -0,0 +1,87 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +use GuzzleHttp\Psr7\Request; + +/** + * Used to produce PSR-7 Request instances. + * + * @link https://github.com/guzzle/guzzle/pull/1101 + */ +class RequestFactory +{ + /** + * Creates a PSR-7 Request instance. + * + * @param null|string $method HTTP method for the request. + * @param null|string $uri URI for the request. + * @param array $headers Headers for the message. + * @param string|resource|StreamInterface $body Message body. + * @param string $version HTTP protocol version. + * + * @return Request + */ + public function getRequest( + $method, + $uri, + array $headers = [], + $body = null, + $version = '1.1' + ) { + return new Request($method, $uri, $headers, $body, $version); + } + + /** + * Parses simplified options. + * + * @param array $options Simplified options. + * + * @return array Extended options for use with getRequest. + */ + protected function parseOptions(array $options) + { + // Should match default values for getRequest + $defaults = [ + 'headers' => [], + 'body' => null, + 'version' => '1.1', + ]; + + return array_merge($defaults, $options); + } + + /** + * Creates a request using a simplified array of options. + * + * @param null|string $method + * @param null|string $uri + * @param array $options + * + * @return Request + */ + public function getRequestWithOptions($method, $uri, array $options = []) + { + $options = $this->parseOptions($options); + + return $this->getRequest( + $method, + $uri, + $options['headers'], + $options['body'], + $options['version'] + ); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequiredParameterTrait.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequiredParameterTrait.php new file mode 100644 index 0000000000..47da977177 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/src/Tool/RequiredParameterTrait.php @@ -0,0 +1,56 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @link http://thephpleague.com/oauth2-client/ Documentation + * @link https://packagist.org/packages/league/oauth2-client Packagist + * @link https://github.com/thephpleague/oauth2-client GitHub + */ + +namespace League\OAuth2\Client\Tool; + +use BadMethodCallException; + +/** + * Provides functionality to check for required parameters. + */ +trait RequiredParameterTrait +{ + /** + * Checks for a required parameter in a hash. + * + * @throws BadMethodCallException + * @param string $name + * @param array $params + * @return void + */ + private function checkRequiredParameter($name, array $params) + { + if (!isset($params[$name])) { + throw new BadMethodCallException(sprintf( + 'Required parameter not passed: "%s"', + $name + )); + } + } + + /** + * Checks for multiple required parameters in a hash. + * + * @throws InvalidArgumentException + * @param array $names + * @param array $params + * @return void + */ + private function checkRequiredParameters(array $names, array $params) + { + foreach ($names as $name) { + $this->checkRequiredParameter($name, $params); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/AuthorizationCodeTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/AuthorizationCodeTest.php new file mode 100644 index 0000000000..bf050498d6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/AuthorizationCodeTest.php @@ -0,0 +1,38 @@ + 'mock_code']], + ]; + } + + protected function getParamExpectation() + { + return function ($body) { + return !empty($body['grant_type']) + && $body['grant_type'] === 'authorization_code' + && !empty($body['code']); + }; + } + + public function testToString() + { + $grant = new AuthorizationCode(); + $this->assertEquals('authorization_code', (string) $grant); + } + + public function testInvalidRefreshToken() + { + $this->expectException(BadMethodCallException::class); + + $this->getMockProvider()->getAccessToken('authorization_code', ['invalid_code' => 'mock_authorization_code']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/ClientCredentialsTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/ClientCredentialsTest.php new file mode 100644 index 0000000000..55375f61dc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/ClientCredentialsTest.php @@ -0,0 +1,29 @@ +assertEquals('client_credentials', (string) $grant); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/Fake.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/Fake.php new file mode 100644 index 0000000000..f3af99ee59 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/Fake.php @@ -0,0 +1,18 @@ +getGrant($name); + $this->assertInstanceOf(AbstractGrant::class, $grant); + } + + public function providerGetGrantDefaults() + { + return [ + 'authorization_code' => ['authorization_code'], + 'client_credentials' => ['client_credentials'], + 'password' => ['password'], + 'refresh_token' => ['refresh_token'], + ]; + } + + public function testGetInvalidGrantFails() + { + $this->expectException(InvalidGrantException::class); + + $factory = new GrantFactory(); + $factory->getGrant('invalid'); + } + + public function testSetGrantReplaceDefault() + { + $mock = new MockGrant(); + + $factory = new GrantFactory(); + $factory->setGrant('password', $mock); + + $grant = $factory->getGrant('password'); + + $this->assertSame($mock, $grant); + } + + public function testSetGrantCustom() + { + $mock = new MockGrant(); + + $factory = new GrantFactory(); + $factory->setGrant('fake', $mock); + + $grant = $factory->getGrant('fake'); + + $this->assertSame($mock, $grant); + } + + public function testIsGrant() + { + $factory = new GrantFactory(); + $grant = $factory->getGrant('password'); + + $this->assertTrue($factory->isGrant($grant)); + $this->assertFalse($factory->isGrant('stdClass')); + } + + public function testCheckGrant() + { + $factory = new GrantFactory(); + $grant = $factory->getGrant('password'); + $this->assertNull($factory->checkGrant($grant)); + } + + public function testCheckGrantInvalidFails() + { + $this->expectException(InvalidGrantException::class); + + $factory = new GrantFactory(); + $factory->checkGrant('stdClass'); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/GrantTestCase.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/GrantTestCase.php new file mode 100644 index 0000000000..5451b33188 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/GrantTestCase.php @@ -0,0 +1,86 @@ + 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + } + + /** + * Test that the grant's __toString method. + */ + abstract public function testToString(); + + /** + * Data provider for access token tests. + * + * @return array + */ + abstract public function providerGetAccessToken(); + + /** + * Callback to test access token request parameters. + * + * @return Closure + */ + abstract protected function getParamExpectation(); + + /** + * @dataProvider providerGetAccessToken + */ + public function testGetAccessToken($grant, array $params = []) + { + $provider = $this->getMockProvider(); + + /** @var StreamInterface & MockInterface $stream */ + $stream = Mockery::spy(StreamInterface::class)->makePartial(); + $stream + ->shouldReceive('__toString') + ->once() + ->andReturn('{"access_token": "mock_access_token", "expires": 3600, "refresh_token": "mock_refresh_token", "uid": 1}'); + + /** @var ResponseInterface & MockInterface $response */ + $response = Mockery::spy(ResponseInterface::class)->makePartial(); + $response + ->shouldReceive('getBody') + ->once() + ->andReturn($stream); + $response + ->shouldReceive('getHeader') + ->once() + ->with('content-type') + ->andReturn('application/json'); + + /** @var ClientInterface & MockInterface $client */ + $client = Mockery::spy(ClientInterface::class)->makePartial(); + $client + ->shouldReceive('send') + ->once() + ->withArgs(function ($request) { + parse_str((string) $request->getBody(), $body); + return call_user_func($this->getParamExpectation(), $body); + }) + ->andReturn($response); + + $provider->setHttpClient($client); + $token = $provider->getAccessToken($grant, $params); + + $this->assertInstanceOf(AccessTokenInterface::class, $token); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/PasswordTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/PasswordTest.php new file mode 100644 index 0000000000..f177eb8693 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/PasswordTest.php @@ -0,0 +1,46 @@ + 'mock_username', 'password' => 'mock_password']], + ]; + } + + protected function getParamExpectation() + { + return function ($body) { + return !empty($body['grant_type']) + && $body['grant_type'] === 'password' + && !empty($body['username']) + && !empty($body['password']); + }; + } + + public function testToString() + { + $grant = new Password(); + $this->assertEquals('password', (string) $grant); + } + + public function testInvalidUsername() + { + $this->expectException(BadMethodCallException::class); + + $this->getMockProvider()->getAccessToken('password', ['invalid_username' => 'mock_username', 'password' => 'mock_password']); + } + + public function testInvalidPassword() + { + $this->expectException(BadMethodCallException::class); + + $this->getMockProvider()->getAccessToken('password', ['username' => 'mock_username', 'invalid_password' => 'mock_password']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/RefreshTokenTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/RefreshTokenTest.php new file mode 100644 index 0000000000..c82769c8b9 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Grant/RefreshTokenTest.php @@ -0,0 +1,37 @@ + 'mock_refresh_token']], + ]; + } + + protected function getParamExpectation() + { + return function ($body) { + return !empty($body['grant_type']) + && $body['grant_type'] === 'refresh_token'; + }; + } + + public function testToString() + { + $grant = new RefreshToken(); + $this->assertEquals('refresh_token', (string) $grant); + } + + public function testInvalidRefreshToken() + { + $this->expectException(BadMethodCallException::class); + + $this->getMockProvider()->getAccessToken('refresh_token', ['invalid_refresh_token' => 'mock_refresh_token']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php new file mode 100644 index 0000000000..bfef71175c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/HttpBasicAuthOptionProviderTest.php @@ -0,0 +1,56 @@ + 'test']], + [['client_secret' => 'test']], + ]; + } + + /** + * @covers ::getAccessTokenOptions + * @dataProvider providerTestGetAccessTokenOptionsException + * @param array $params + */ + public function testGetAccessTokenOptionsException($params) + { + $this->expectException(InvalidArgumentException::class); + + $provider = new HttpBasicAuthOptionProvider(); + $provider->getAccessTokenOptions(AbstractProvider::METHOD_POST, $params); + } + + /** + * @covers ::getAccessTokenOptions + */ + public function testGetAccessTokenOptions() + { + $provider = new HttpBasicAuthOptionProvider(); + $options = $provider->getAccessTokenOptions(AbstractProvider::METHOD_POST, [ + 'client_id' => 'test', + 'client_secret' => 'test', + 'redirect_uri' => 'http://localhost' + ]); + + $this->assertEquals('Basic ' . base64_encode('test:test'), $options['headers']['Authorization']); + $this->assertArrayNotHasKey('client_id', $options); + $this->assertArrayNotHasKey('client_secret', $options); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/PostAuthOptionProviderTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/PostAuthOptionProviderTest.php new file mode 100644 index 0000000000..4d7f906530 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/OptionProvider/PostAuthOptionProviderTest.php @@ -0,0 +1,29 @@ +getAccessTokenOptions(AbstractProvider::METHOD_POST, [ + 'client_id' => 'test', + 'client_secret' => 'test' + ]); + + $this->assertArrayHasKey('headers', $options); + $this->assertEquals('client_id=test&client_secret=test', $options['body']); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/AbstractProviderTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/AbstractProviderTest.php new file mode 100644 index 0000000000..b9ebf6f1fa --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/AbstractProviderTest.php @@ -0,0 +1,925 @@ + 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + } + + public function testGetOptionProvider() + { + $this->assertInstanceOf( + PostAuthOptionProvider::class, + $this->getMockProvider()->getOptionProvider() + ); + } + + public function testInvalidGrantString() + { + $this->expectException(InvalidGrantException::class); + $this->getMockProvider()->getAccessToken('invalid_grant', ['invalid_parameter' => 'none']); + } + + public function testInvalidGrantObject() + { + $this->expectException(InvalidGrantException::class); + $grant = new \StdClass(); + $this->getMockProvider()->getAccessToken($grant, ['invalid_parameter' => 'none']); + } + + public function testAuthorizationUrlStateParam() + { + $authUrl = $this->getMockProvider()->getAuthorizationUrl([ + 'state' => 'XXX', + ]); + + $this->assertTrue(strpos($authUrl, 'state=XXX') !== false); + } + + /** + * Tests https://github.com/thephpleague/oauth2-client/pull/485 + */ + public function testCustomAuthorizationUrlOptions() + { + $url = $this->getMockProvider()->getAuthorizationUrl([ + 'foo' => 'BAR' + ]); + $query = parse_url($url, PHP_URL_QUERY); + $this->assertNotEmpty($query); + + parse_str($query, $params); + $this->assertArrayHasKey('foo', $params); + $this->assertSame('BAR', $params['foo']); + } + + /** + * Tests https://github.com/thephpleague/oauth2-client/issues/134 + */ + public function testConstructorSetsProperties() + { + $options = [ + 'clientId' => '1234', + 'clientSecret' => '4567', + 'redirectUri' => 'http://example.org/redirect' + ]; + + $mockProvider = new MockProvider($options); + + $this->assertSame($options['clientId'], $mockProvider->getClientId()); + $this->assertSame($options['clientSecret'], $mockProvider->getClientSecret()); + $this->assertSame($options['redirectUri'], $mockProvider->getRedirectUri()); + } + + public function testConstructorSetsClientOptions() + { + $timeout = rand(100, 900); + + $mockProvider = new MockProvider(compact('timeout')); + + $config = $mockProvider->getHttpClient()->getConfig(); + + $this->assertArrayHasKey('timeout', $config); + $this->assertEquals($timeout, $config['timeout']); + } + + public function testCanSetAProxy() + { + $proxy = '192.168.0.1:8888'; + + $mockProvider = new MockProvider(['proxy' => $proxy]); + + $config = $mockProvider->getHttpClient()->getConfig(); + + $this->assertArrayHasKey('proxy', $config); + $this->assertEquals($proxy, $config['proxy']); + } + + public function testCannotDisableVerifyIfNoProxy() + { + $mockProvider = new MockProvider(['verify' => false]); + + $config = $mockProvider->getHttpClient()->getConfig(); + + $this->assertArrayHasKey('verify', $config); + $this->assertTrue($config['verify']); + } + + public function testCanDisableVerificationIfThereIsAProxy() + { + $mockProvider = new MockProvider(['proxy' => '192.168.0.1:8888', 'verify' => false]); + + $config = $mockProvider->getHttpClient()->getConfig(); + + $this->assertArrayHasKey('verify', $config); + $this->assertFalse($config['verify']); + } + + public function testConstructorSetsGrantFactory() + { + $mockAdapter = Mockery::mock(GrantFactory::class); + + $mockProvider = new MockProvider([], ['grantFactory' => $mockAdapter]); + $this->assertSame($mockAdapter, $mockProvider->getGrantFactory()); + } + + public function testConstructorSetsHttpAdapter() + { + $mockAdapter = Mockery::mock(ClientInterface::class); + + $mockProvider = new MockProvider([], ['httpClient' => $mockAdapter]); + $this->assertSame($mockAdapter, $mockProvider->getHttpClient()); + } + + public function testConstructorSetsRequestFactory() + { + $mockAdapter = Mockery::mock(RequestFactory::class); + + $mockProvider = new MockProvider([], ['requestFactory' => $mockAdapter]); + $this->assertSame($mockAdapter, $mockProvider->getRequestFactory()); + } + + public function testSetRedirectHandler() + { + $testFunction = false; + $state = false; + + $callback = function ($url, $provider) use (&$testFunction, &$state) { + $testFunction = $url; + $state = $provider->getState(); + }; + + $this->getMockProvider()->authorize([], $callback); + + $this->assertNotFalse($testFunction); + $this->assertNotFalse($state); + } + + /** + * @dataProvider userPropertyProvider + */ + public function testGetUserProperties($name = null, $email = null, $id = null) + { + $provider = new MockProvider([ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + + $token = new AccessToken(['access_token' => 'abc', 'expires_in' => 3600]); + + $stream = Mockery::mock(StreamInterface::class); + $stream + ->shouldReceive('__toString') + ->once() + ->andReturn(json_encode([ + 'id' => $id, + 'name' => $name, + 'email' => $email, + ])); + + $response = Mockery::mock(ResponseInterface::class); + $response + ->shouldReceive('getBody') + ->once() + ->andReturn($stream); + $response + ->shouldReceive('getHeader') + ->once() + ->with('content-type') + ->andReturn('application/json'); + + + $client = Mockery::spy(ClientInterface::class, [ + 'send' => $response, + ]); + + $provider->setHttpClient($client); + $user = $provider->getResourceOwner($token); + $url = $provider->getResourceOwnerDetailsUrl($token); + + $this->assertEquals($id, $user->getId()); + $this->assertEquals($name, $user->getUserScreenName()); + $this->assertEquals($email, $user->getUserEmail()); + + $this->assertArrayHasKey('name', $user->toArray()); + $this->assertArrayHasKey('email', $user->toArray()); + + $client + ->shouldHaveReceived('send') + ->once() + ->withArgs(function ($request) use ($url) { + return $request->getMethod() === 'GET' + && $request->hasHeader('Authorization') + && (string) $request->getUri() === $url; + }); + } + + public function testGetUserPropertiesThrowsExceptionWhenNonJsonResponseIsReceived() + { + $provider = new MockProvider([ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + + $token = new AccessToken(['access_token' => 'abc', 'expires_in' => 3600]); + + $stream = Mockery::mock(StreamInterface::class, [ + '__toString' => 'some unexpected response.', + ]); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getStatusCode' => 200, + 'getBody' => $stream, + ]); + $response + ->shouldReceive('getHeader') + ->with('content-type') + ->andReturn('text/html'); + + $client = Mockery::mock(ClientInterface::class, [ + 'send' => $response, + ]); + + $provider->setHttpClient($client); + + $this->expectException(UnexpectedValueException::class); + + $user = $provider->getResourceOwner($token); + } + + public function userPropertyProvider() + { + return [ + 'full response' => ['test', 'test@example.com', 1], + 'no response' => [], + ]; + } + + public function testGetHeaders() + { + $provider = $this->getMockProvider(); + + $this->assertEquals([], $provider->getHeaders()); + $this->assertEquals(['Authorization' => 'Bearer mock_token'], $provider->getHeaders('mock_token')); + $this->assertEquals(['Authorization' => 'Bearer abc'], $provider->getHeaders('abc')); + + $token = new AccessToken(['access_token' => 'xyz', 'expires_in' => 3600]); + $this->assertEquals(['Authorization' => 'Bearer xyz'], $provider->getHeaders($token)); + } + + public function testScopesOverloadedDuringAuthorize() + { + $provider = $this->getMockProvider(); + + $url = $provider->getAuthorizationUrl(); + + parse_str(parse_url($url, PHP_URL_QUERY), $qs); + + $this->assertArrayHasKey('scope', $qs); + $this->assertSame('test', $qs['scope']); + + $url = $provider->getAuthorizationUrl(['scope' => ['foo', 'bar']]); + + parse_str(parse_url($url, PHP_URL_QUERY), $qs); + + $this->assertArrayHasKey('scope', $qs); + $this->assertSame('foo,bar', $qs['scope']); + } + + public function testAuthorizationStateIsRandom() + { + $last = null; + $provider = $this->getMockProvider(); + + for ($i = 0; $i < 100; $i++) { + // Repeat the test multiple times to verify state changes + $url = $provider->getAuthorizationUrl(); + + parse_str(parse_url($url, PHP_URL_QUERY), $qs); + + $this->assertTrue(1 === preg_match('/^[a-zA-Z0-9\/+]{32}$/', $qs['state'])); + $this->assertNotSame($qs['state'], $last); + + $last = $qs['state']; + } + } + + public function testSetGetPkceCode() + { + $pkceCode = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; + + $provider = $this->getMockProvider(); + $this->assertEquals($provider, $provider->setPkceCode($pkceCode)); + $this->assertEquals($pkceCode, $provider->getPkceCode()); + } + + /** + * @dataProvider pkceMethodProvider + */ + public function testPkceMethod($pkceMethod, $pkceCode, $expectedChallenge) + { + $provider = $this->getMockProvider(); + $provider->setPkceMethod($pkceMethod); + $provider->setFixedPkceCode($pkceCode); + + $url = $provider->getAuthorizationUrl(); + $this->assertSame($pkceCode, $provider->getPkceCode()); + + parse_str(parse_url($url, PHP_URL_QUERY), $qs); + $this->assertArrayHasKey('code_challenge', $qs); + $this->assertArrayHasKey('code_challenge_method', $qs); + $this->assertSame($pkceMethod, $qs['code_challenge_method']); + $this->assertSame($expectedChallenge, $qs['code_challenge']); + + // Simulate re-initialization of provider after authorization request + $provider = $this->getMockProvider(); + + $raw_response = ['access_token' => 'okay', 'expires' => time() + 3600, 'resource_owner_id' => 3]; + $stream = Mockery::mock(StreamInterface::class); + $stream + ->shouldReceive('__toString') + ->once() + ->andReturn(json_encode($raw_response)); + + $response = Mockery::mock(ResponseInterface::class); + $response + ->shouldReceive('getBody') + ->once() + ->andReturn($stream); + $response + ->shouldReceive('getHeader') + ->once() + ->with('content-type') + ->andReturn('application/json'); + + $client = Mockery::spy(ClientInterface::class, [ + 'send' => $response, + ]); + $provider->setHttpClient($client); + + // restore $pkceCode (normally done by client from session) + $provider->setPkceCode($pkceCode); + + $provider->getAccessToken('authorization_code', ['code' => 'mock_authorization_code']); + + $client + ->shouldHaveReceived('send') + ->once() + ->withArgs(function ($request) use ($pkceCode) { + parse_str((string)$request->getBody(), $body); + return $body['code_verifier'] === $pkceCode; + }); + } + + public function pkceMethodProvider() + { + return [ + [ + AbstractProvider::PKCE_METHOD_S256, + '1234567890123456789012345678901234567890', + 'pOvdVBRUuEzGcMnx9VCLr2f_0_5ZuIMmeAh4H5kqCx0', + ], + [ + AbstractProvider::PKCE_METHOD_PLAIN, + '1234567890123456789012345678901234567890', + '1234567890123456789012345678901234567890', + ], + ]; + } + + public function testInvalidPkceMethod() + { + $provider = $this->getMockProvider(); + $provider->setPkceMethod('non-existing'); + + $this->expectExceptionMessage('Unknown PKCE method "non-existing".'); + $provider->getAuthorizationUrl(); + } + + public function testPkceCodeIsRandom() + { + $last = null; + $provider = $this->getMockProvider(); + $provider->setPkceMethod('S256'); + + for ($i = 0; $i < 100; $i++) { + // Repeat the test multiple times to verify code_challenge changes + $url = $provider->getAuthorizationUrl(); + + parse_str(parse_url($url, PHP_URL_QUERY), $qs); + $this->assertTrue(1 === preg_match('/^[a-zA-Z0-9-_]{43}$/', $qs['code_challenge'])); + $this->assertNotSame($qs['code_challenge'], $last); + $last = $qs['code_challenge']; + } + } + + public function testPkceMethodIsDisabledByDefault() + { + $provider = $this->getAbstractProviderMock(); + $pkceMethod = $provider->getPkceMethod(); + $this->assertNull($pkceMethod); + } + + public function testErrorResponsesCanBeCustomizedAtTheProvider() + { + $provider = new MockProvider([ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + + $error = ["error" => "Foo error", "code" => 1337]; + $errorJson = json_encode($error); + + $stream = Mockery::mock(StreamInterface::class); + $stream + ->shouldReceive('__toString') + ->once() + ->andReturn($errorJson); + + $response = Mockery::mock(ResponseInterface::class); + $response + ->shouldReceive('getBody') + ->once() + ->andReturn($stream); + $response + ->shouldReceive('getHeader') + ->once() + ->with('content-type') + ->andReturn('application/json'); + + $client = Mockery::spy(ClientInterface::class, [ + 'send' => $response, + ]); + + $provider->setHttpClient($client); + + $errorMessage = ''; + $errorCode = 0; + $errorBody = false; + + try { + $provider->getAccessToken('authorization_code', ['code' => 'mock_authorization_code']); + } catch (IdentityProviderException $e) { + $errorMessage = $e->getMessage(); + $errorCode = $e->getCode(); + $errorBody = $e->getResponseBody(); + } + + $method = $provider->getAccessTokenMethod(); + $url = $provider->getBaseAccessTokenUrl([]); + + $this->assertEquals($error['error'], $errorMessage); + $this->assertEquals($error['code'], $errorCode); + $this->assertEquals($error, $errorBody); + + $client + ->shouldHaveReceived('send') + ->once() + ->withArgs(function ($request) use ($method, $url) { + return $request->getMethod() === $method + && (string) $request->getUri() === $url; + }); + } + + public function testClientErrorTriggersProviderException() + { + $this->expectException(IdentityProviderException::class); + $provider = new MockProvider([ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + + $stream = Mockery::mock(StreamInterface::class, [ + '__toString' => '{"error":"Foo error","code":1337}', + ]); + + $request = Mockery::mock(RequestInterface::class); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getStatusCode' => 400, + 'getBody' => $stream, + ]); + $response + ->shouldReceive('getHeader') + ->with('content-type') + ->andReturn('application/json'); + + $client = Mockery::mock(ClientInterface::class); + $client + ->shouldReceive('send') + ->andThrow(new BadResponseException('test exception', $request, $response)); + + $provider->setHttpClient($client); + $provider->getAccessToken('authorization_code', ['code' => 'mock_authorization_code']); + } + + public function testGetResponse() + { + $provider = new MockProvider(); + + $request = Mockery::mock(RequestInterface::class); + $response = Mockery::mock(ResponseInterface::class); + + $client = Mockery::mock(ClientInterface::class); + $client + ->shouldReceive('send') + ->with($request) + ->andReturn($response); + + $provider->setHttpClient($client); + $output = $provider->getResponse($request); + + $this->assertSame($output, $response); + } + + public function testAuthenticatedRequestAndResponse() + { + $provider = new MockProvider(); + + $token = new AccessToken(['access_token' => 'abc', 'expires_in' => 3600]); + $request = $provider->getAuthenticatedRequest('get', 'https://api.example.com/v1/test', $token); + + $stream = Mockery::mock(StreamInterface::class, [ + '__toString' => '{"example":"response"}', + ]); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getBody' => $stream, + ]); + $response + ->shouldReceive('getHeader') + ->with('content-type') + ->andReturn('application/json'); + + $client = Mockery::mock(ClientInterface::class); + $client + ->shouldReceive('send') + ->with($request) + ->andReturn($response); + + $provider->setHttpClient($client); + $result = $provider->getParsedResponse($request); + + $this->assertSame(['example' => 'response'], $result); + + $this->assertInstanceOf(RequestInterface::class, $request); + + // Authorization header should contain the token + $header = $request->getHeader('Authorization'); + $this->assertContains('Bearer abc', $header); + } + + public function getAccessTokenMethodProvider() + { + return [ + ['GET'], + ['POST'], + ]; + } + + /** + * @dataProvider getAccessTokenMethodProvider + */ + public function testGetAccessToken($method) + { + $provider = new MockProvider([ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + + $provider->setAccessTokenMethod($method); + + $raw_response = ['access_token' => 'okay', 'expires' => time() + 3600, 'resource_owner_id' => 3]; + + $grant = Mockery::mock(AbstractGrant::class); + $grant + ->shouldReceive('prepareRequestParameters') + ->once() + ->with( + ['client_id' => 'mock_client_id', 'client_secret' => 'mock_secret', 'redirect_uri' => 'none'], + ['code' => 'mock_authorization_code'] + ) + ->andReturn([]); + + $stream = Mockery::mock(StreamInterface::class); + $stream + ->shouldReceive('__toString') + ->once() + ->andReturn(json_encode($raw_response)); + + $response = Mockery::mock(ResponseInterface::class); + $response + ->shouldReceive('getBody') + ->once() + ->andReturn($stream); + $response + ->shouldReceive('getHeader') + ->once() + ->with('content-type') + ->andReturn('application/json'); + + $client = Mockery::spy(ClientInterface::class, [ + 'send' => $response, + ]); + + $provider->setHttpClient($client); + $token = $provider->getAccessToken($grant, ['code' => 'mock_authorization_code']); + + $this->assertInstanceOf(AccessTokenInterface::class, $token); + + $this->assertSame($raw_response['resource_owner_id'], $token->getResourceOwnerId()); + $this->assertSame($raw_response['access_token'], $token->getToken()); + $this->assertSame($raw_response['expires'], $token->getExpires()); + + $client + ->shouldHaveReceived('send') + ->once() + ->withArgs(function ($request) use ($provider) { + return $request->getMethod() === $provider->getAccessTokenMethod() + && (string) $request->getUri() === $provider->getBaseAccessTokenUrl([]); + }); + } + + public function testGetAccessTokenWithNonJsonResponse() + { + $provider = $this->getMockProvider(); + + $stream = Mockery::mock(StreamInterface::class, [ + '__toString' => '', + ]); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getStatusCode' => 200, + 'getBody' => $stream, + ]); + $response + ->shouldReceive('getHeader') + ->with('content-type') + ->andReturn('text/plain'); + + $client = Mockery::mock(ClientInterface::class, [ + 'send' => $response, + ]); + + $provider->setHttpClient($client); + + $this->expectException(UnexpectedValueException::class); + $this->expectExceptionMessage('Invalid response received from Authorization Server. Expected JSON.'); + $provider->getAccessToken('authorization_code', ['code' => 'mock_authorization_code']); + } + + private function getMethod($class, $name) + { + $class = new ReflectionClass($class); + $method = $class->getMethod($name); + + $method->setAccessible(true); + return $method; + } + + public function parseResponseProvider() + { + return [ + [ + 'body' => '{"a": 1}', + 'type' => 'application/json', + 'parsed' => ['a' => 1] + ], + [ + 'body' => 'string', + 'type' => 'unknown', + 'parsed' => 'string' + ], + [ + 'body' => 'a=1&b=2', + 'type' => 'application/x-www-form-urlencoded', + 'parsed' => ['a' => 1, 'b' => 2] + ], + ]; + } + + /** + * @dataProvider parseResponseProvider + */ + public function testParseResponse($body, $type, $parsed, $statusCode = 200) + { + $stream = Mockery::mock(StreamInterface::class, [ + '__toString' => $body, + ]); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getBody' => $stream, + 'getStatusCode' => $statusCode, + ]); + $response + ->shouldReceive('getHeader') + ->with('content-type') + ->andReturn($type); + + $method = $this->getMethod(AbstractProvider::class, 'parseResponse'); + $result = $method->invoke($this->getMockProvider(), $response); + + $this->assertEquals($parsed, $result); + } + + public function testParseResponseJsonFailure() + { + $this->expectException(UnexpectedValueException::class); + $this->testParseResponse('{a: 1}', 'application/json', null); + } + + public function testParseResponseNonJsonFailure() + { + $this->expectException(UnexpectedValueException::class); + $this->testParseResponse('', 'application/xml', null, 500); + } + + public function getAppendQueryProvider() + { + return [ + ['test.com/?a=1', 'test.com/', '?a=1'], + ['test.com/?a=1', 'test.com/', '&a=1'], + ['test.com/?a=1', 'test.com/', 'a=1'], + ['test.com/?a=1', 'test.com/?a=1', '?'], + ['test.com/?a=1', 'test.com/?a=1', '&'], + ['test.com/?a=1&b=2', 'test.com/?a=1', '&b=2'], + ['test.com/?a=1&b=2', 'test.com/?a=1', 'b=2'], + ['test.com/?a=1&b=2', 'test.com/?a=1', '?b=2'], + ['test.com/?a=1&b=1&b=2', 'test.com/?a=1&b=1', 'b=2'], + ['test.com/?a=1&b=2&b=2', 'test.com/?a=1&b=2', 'b=2'], + ]; + } + + /** + * @dataProvider getAppendQueryProvider + */ + public function testAppendQuery($expected, $url, $query) + { + $method = $this->getMethod(AbstractProvider::class, 'appendQuery'); + $this->assertEquals($expected, $method->invoke($this->getMockProvider(), $url, $query)); + } + + protected function getAbstractProviderMock() + { + return Mockery::mock(AbstractProvider::class)->makePartial(); + } + + public function testDefaultAccessTokenMethod() + { + $provider = $this->getAbstractProviderMock(); + + $method = $provider->getAccessTokenMethod(); + + $expectedMethod = 'POST'; + $this->assertEquals($expectedMethod, $method); + } + + public function testDefaultPrepareAccessTokenResponse() + { + $provider = Mockery::mock(Fake\ProviderWithAccessTokenResourceOwnerId::class)->makePartial(); + + $result = ['user_id' => uniqid()]; + $newResult = $provider->prepareAccessTokenResponse($result); + + $this->assertArrayHasKey('resource_owner_id', $newResult); + $this->assertEquals($result['user_id'], $newResult['resource_owner_id']); + } + + public function testGuardedProperties() + { + $options = [ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + 'skipMeDuringMassAssignment' => 'bar', + 'guarded' => 'foo' + ]; + + $provider = new Fake\ProviderWithGuardedProperties($options); + + $this->assertNotEquals( + $options['skipMeDuringMassAssignment'], + $provider->getSkipMeDuringMassAssignment() + ); + + $this->assertNotEquals( + $options['guarded'], + $provider->getGuarded() + ); + } + + public function testPrepareAccessTokenResponseWithDotNotation() + { + $provider = Mockery::mock(Fake\ProviderWithAccessTokenResourceOwnerId::class)->makePartial(); + $provider->shouldAllowMockingProtectedMethods(); + $provider + ->shouldReceive('getAccessTokenResourceOwnerId') + ->andReturn('user.id'); + + $result = ['user' => ['id' => uniqid()]]; + $newResult = $provider->prepareAccessTokenResponse($result); + + $this->assertArrayHasKey('resource_owner_id', $newResult); + $this->assertEquals($result['user']['id'], $newResult['resource_owner_id']); + } + + public function testPrepareAccessTokenResponseWithInvalidKeyType() + { + $provider = Mockery::mock(Fake\ProviderWithAccessTokenResourceOwnerId::class)->makePartial(); + $provider->shouldAllowMockingProtectedMethods(); + $provider + ->shouldReceive('getAccessTokenResourceOwnerId') + ->andReturn(new \stdClass()); + + $result = ['user_id' => uniqid()]; + $newResult = $provider->prepareAccessTokenResponse($result); + + $this->assertFalse(isset($newResult['resource_owner_id'])); + } + + public function testPrepareAccessTokenResponseWithInvalidKeyPath() + { + $provider = Mockery::mock(Fake\ProviderWithAccessTokenResourceOwnerId::class)->makePartial(); + $provider->shouldAllowMockingProtectedMethods(); + $provider + ->shouldReceive('getAccessTokenResourceOwnerId') + ->andReturn('user.name'); + + $result = ['user' => ['id' => uniqid()]]; + $newResult = $provider->prepareAccessTokenResponse($result); + + $this->assertFalse(isset($newResult['resource_owner_id'])); + } + + public function testDefaultAuthorizationHeaders() + { + $provider = $this->getAbstractProviderMock(); + + $headers = $provider->getAuthorizationHeaders(); + + $this->assertEquals([], $headers); + } + + /** + * This test helps show the fatal errors occurring as a result of incompatible + * method signatures after the 2.4.0 release. + * + * @link https://github.com/thephpleague/oauth2-client/issues/752 + */ + public function testExtendedProviderDoesNotErrorWhenUsingAccessTokenAsTheTypeHint() + { + $token = new AccessToken([ + 'access_token' => 'mock_access_token', + 'refresh_token' => 'mock_refresh_token', + 'expires' => time(), + 'resource_owner_id' => 'mock_resource_owner_id', + ]); + + $provider = new Fake\ProviderWithAccessTokenHints([ + 'urlAuthorize' => 'https://example.com/authorize', + 'urlAccessToken' => 'https://example.com/accessToken', + 'urlResourceOwnerDetails' => 'https://api.example.com/owner', + ]); + + $reflectedProvider = new \ReflectionObject($provider); + $getTokenId = $reflectedProvider->getMethod('getTokenId'); + $getTokenId->setAccessible(true); + + $url = $provider->getResourceOwnerDetailsUrl($token); + $tokenId = $getTokenId->invoke($provider, $token); + + $this->assertSame('https://api.example.com/owner/mock_resource_owner_id', $url); + $this->assertSame('fake_token_id', $tokenId); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Exception/IdentityProviderExceptionTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Exception/IdentityProviderExceptionTest.php new file mode 100644 index 0000000000..f6a5a7ae8e --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Exception/IdentityProviderExceptionTest.php @@ -0,0 +1,21 @@ + 'message', + 'code' => 404 + ]; + $exception = new IdentityProviderException($result['error'], $result['code'], $result); + + $this->assertEquals($result, $exception->getResponseBody()); + $this->assertEquals($result['error'], $exception->getMessage()); + $this->assertEquals($result['code'], $exception->getCode()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake.php new file mode 100644 index 0000000000..7a02b51a78 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake.php @@ -0,0 +1,97 @@ +clientId; + } + + public function getClientSecret() + { + return $this->clientSecret; + } + + public function getRedirectUri() + { + return $this->redirectUri; + } + + public function getBaseAuthorizationUrl() + { + return 'http://example.com/oauth/authorize'; + } + + public function getBaseAccessTokenUrl(array $params) + { + return 'http://example.com/oauth/token'; + } + + public function getResourceOwnerDetailsUrl(AccessToken $token) + { + return 'http://example.com/oauth/user'; + } + + protected function getDefaultScopes() + { + return ['test']; + } + + public function setAccessTokenMethod($method) + { + $this->accessTokenMethod = $method; + } + + public function getAccessTokenMethod() + { + return $this->accessTokenMethod; + } + + public function setPkceMethod($method) + { + $this->pkceMethod = $method; + } + + public function getPkceMethod() + { + return $this->pkceMethod; + } + + public function setFixedPkceCode($code) + { + return $this->fixedPkceCode = $code; + } + + protected function getRandomPkceCode($length = 64) + { + return $this->fixedPkceCode ?: parent::getRandomPkceCode($length); + } + + protected function createResourceOwner(array $response, AccessToken $token) + { + return new Fake\User($response); + } + + protected function checkResponse(ResponseInterface $response, $data) + { + if (!empty($data['error'])) { + throw new IdentityProviderException($data['error'], $data['code'], $data); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenHints.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenHints.php new file mode 100644 index 0000000000..346c4ab953 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenHints.php @@ -0,0 +1,43 @@ +getResourceOwnerId(); + } + + protected function createResourceOwner(array $response, AccessToken $token) + { + return new GenericResourceOwner($response, $token->getResourceOwnerId()); + } + + public function getResourceOwner(AccessToken $token) + { + return $this->createResourceOwner([], $token); + } + + protected function fetchResourceOwnerDetails(AccessToken $token) + { + return []; + } + + protected function getTokenId(AccessToken $token) + { + return 'fake_token_id'; + } + + protected function getMacSignature($id, $ts, $nonce) + { + return 'fake_mac_signature'; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenResourceOwnerId.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenResourceOwnerId.php new file mode 100644 index 0000000000..6659f65ab5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/ProviderWithAccessTokenResourceOwnerId.php @@ -0,0 +1,10 @@ +guarded; + } + + public function getSkipMeDuringMassAssignment() + { + return $this->skipMeDuringMassAssignment; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/User.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/User.php new file mode 100644 index 0000000000..8e13d23567 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Fake/User.php @@ -0,0 +1,38 @@ +response = $response; + } + + public function getId() + { + return $this->response['id']; + } + + public function getUserEmail() + { + return $this->response['email']; + } + + public function getUserScreenName() + { + return $this->response['name']; + } + + public function toArray() + { + return $this->response; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Generic.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Generic.php new file mode 100644 index 0000000000..9701de3c3f --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/Generic.php @@ -0,0 +1,30 @@ + 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]; + + parent::__construct($options); + } + + protected function fetchResourceOwnerDetails(AccessToken $token) + { + return [ + 'mock_response_uid' => 1, + 'username' => 'testmock', + 'email' => 'mock@example.com', + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/GenericProviderTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/GenericProviderTest.php new file mode 100644 index 0000000000..65fe93ca6b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Provider/GenericProviderTest.php @@ -0,0 +1,180 @@ + 'http://example.com/authorize', + 'urlAccessToken' => 'http://example.com/token', + 'urlResourceOwnerDetails' => 'http://example.com/user', + ]; + + foreach ($required as $key => $value) { + // Test each of the required options by removing a single value + // and attempting to create a new provider. + $options = $required; + unset($options[$key]); + + try { + $provider = new GenericProvider($options); + } catch (\Exception $e) { + $this->assertInstanceOf(InvalidArgumentException::class, $e); + } + } + + $provider = new GenericProvider($required + [ + ]); + } + + public function testConfigurableOptions() + { + $options = [ + 'urlAuthorize' => 'http://example.com/authorize', + 'urlAccessToken' => 'http://example.com/token', + 'urlResourceOwnerDetails' => 'http://example.com/user', + 'accessTokenMethod' => 'mock_method', + 'accessTokenResourceOwnerId' => 'mock_token_uid', + 'scopeSeparator' => 'mock_separator', + 'responseError' => 'mock_error', + 'responseCode' => 'mock_code', + 'responseResourceOwnerId' => 'mock_response_uid', + 'scopes' => ['mock', 'scopes'], + 'pkceMethod' => 'S256', + ]; + + $provider = new GenericProvider($options + [ + 'clientId' => 'mock_client_id', + 'clientSecret' => 'mock_secret', + 'redirectUri' => 'none', + ]); + + foreach ($options as $key => $expected) { + $property = new ReflectionProperty(GenericProvider::class, $key); + $property->setAccessible(true); + + $this->assertEquals($expected, $property->getValue($provider)); + } + + $this->assertEquals($options['urlAuthorize'], $provider->getBaseAuthorizationUrl()); + $this->assertEquals($options['urlAccessToken'], $provider->getBaseAccessTokenUrl([])); + $this->assertEquals($options['urlResourceOwnerDetails'], $provider->getResourceOwnerDetailsUrl(new AccessToken(['access_token' => '1234']))); + $this->assertEquals($options['scopes'], $provider->getDefaultScopes()); + + $reflection = new ReflectionClass(get_class($provider)); + + $getAccessTokenMethod = $reflection->getMethod('getAccessTokenMethod'); + $getAccessTokenMethod->setAccessible(true); + $this->assertEquals($options['accessTokenMethod'], $getAccessTokenMethod->invoke($provider)); + + $getAccessTokenResourceOwnerId = $reflection->getMethod('getAccessTokenResourceOwnerId'); + $getAccessTokenResourceOwnerId->setAccessible(true); + $this->assertEquals($options['accessTokenResourceOwnerId'], $getAccessTokenResourceOwnerId->invoke($provider)); + + $getScopeSeparator = $reflection->getMethod('getScopeSeparator'); + $getScopeSeparator->setAccessible(true); + $this->assertEquals($options['scopeSeparator'], $getScopeSeparator->invoke($provider)); + + $getPkceMethod = $reflection->getMethod('getPkceMethod'); + $getPkceMethod->setAccessible(true); + $this->assertEquals($options['pkceMethod'], $getPkceMethod->invoke($provider)); + } + + public function testResourceOwnerDetails() + { + $token = new AccessToken(['access_token' => 'mock_token']); + + $provider = new MockProvider([ + 'urlAuthorize' => 'http://example.com/authorize', + 'urlAccessToken' => 'http://example.com/token', + 'urlResourceOwnerDetails' => 'http://example.com/user', + 'responseResourceOwnerId' => 'mock_response_uid', + ]); + + $user = $provider->getResourceOwner($token); + + $this->assertInstanceOf(GenericResourceOwner::class, $user); + $this->assertSame(1, $user->getId()); + + $data = $user->toArray(); + + $this->assertArrayHasKey('username', $data); + $this->assertArrayHasKey('email', $data); + $this->assertSame('testmock', $data['username']); + $this->assertSame('mock@example.com', $data['email']); + } + + public function testCheckResponse() + { + $response = Mockery::mock(ResponseInterface::class); + + $options = [ + 'urlAuthorize' => 'http://example.com/authorize', + 'urlAccessToken' => 'http://example.com/token', + 'urlResourceOwnerDetails' => 'http://example.com/user', + ]; + + $provider = new GenericProvider($options); + + $reflection = new ReflectionClass(get_class($provider)); + + $checkResponse = $reflection->getMethod('checkResponse'); + $checkResponse->setAccessible(true); + + $this->assertNull($checkResponse->invokeArgs($provider, [$response, []])); + } + + /** + * @param array $error The error response to parse + * @param array $extraOptions Any extra options to configure the generic provider with. + * @dataProvider checkResponseThrowsExceptionProvider + */ + public function testCheckResponseThrowsException(array $error, array $extraOptions = []) + { + $response = Mockery::mock(ResponseInterface::class); + + $options = [ + 'urlAuthorize' => 'http://example.com/authorize', + 'urlAccessToken' => 'http://example.com/token', + 'urlResourceOwnerDetails' => 'http://example.com/user', + ]; + + $provider = new GenericProvider($options + $extraOptions); + + $reflection = new ReflectionClass(get_class($provider)); + + $checkResponse = $reflection->getMethod('checkResponse'); + $checkResponse->setAccessible(true); + + $this->expectException(IdentityProviderException::class); + + $checkResponse->invokeArgs($provider, [$response, $error]); + } + + public function checkResponseThrowsExceptionProvider() { + return [ + [['error' => 'foobar',]], + [['error' => 'foobar',] , ['responseCode' => 'code']], + // Some servers return non-compliant responses. Provider shouldn't 'Fatal error: Wrong parameters' + [['error' => 'foobar', 'code' => 'abc55'], ['responseCode' => 'code']], + [['error' => 'foobar', 'code' => ['badformat']], ['responseCode' => 'code']], + [['error' => ['message' => 'msg', 'code' => 56]]], + [['error' => ['errors' => ['code' => 67, 'message' => 'msg']]]], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Token/AccessTokenTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Token/AccessTokenTest.php new file mode 100644 index 0000000000..23ad105f69 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Token/AccessTokenTest.php @@ -0,0 +1,230 @@ +expectException(InvalidArgumentException::class); + + $token = $this->getAccessToken(['invalid_access_token' => 'none']); + + self::tearDownForBackwardsCompatibility(); + } + + protected function getAccessToken($options = []) + { + return new AccessToken($options); + } + + public function testExpiresInCorrection() + { + $options = ['access_token' => 'access_token', 'expires_in' => 100]; + $token = $this->getAccessToken($options); + + $expires = $token->getExpires(); + + $this->assertNotNull($expires); + $this->assertGreaterThan(time(), $expires); + $this->assertLessThan(time() + 200, $expires); + + self::tearDownForBackwardsCompatibility(); + } + + public function testExpiresInCorrectionUsingSetTimeNow() + { + /* set fake time at 2020-01-01 00:00:00 */ + AccessToken::setTimeNow(1577836800); + $options = ['access_token' => 'access_token', 'expires_in' => 100]; + $token = $this->getAccessToken($options); + + $expires = $token->getExpires(); + + $this->assertNotNull($expires); + $this->assertEquals(1577836900, $expires); + + self::tearDownForBackwardsCompatibility(); + } + + public function testSetTimeNow() + { + AccessToken::setTimeNow(1577836800); + $timeNow = $this->getAccessToken(['access_token' => 'asdf'])->getTimeNow(); + + $this->assertEquals(1577836800, $timeNow); + + self::tearDownForBackwardsCompatibility(); + } + + public function testResetTimeNow() + { + AccessToken::setTimeNow(1577836800); + $token = $this->getAccessToken(['access_token' => 'asdf']); + + $this->assertEquals(1577836800, $token->getTimeNow()); + AccessToken::resetTimeNow(); + + $this->assertNotEquals(1577836800, $token->getTimeNow()); + + $timeBeforeAssertion = time(); + $this->assertGreaterThanOrEqual($timeBeforeAssertion, $token->getTimeNow()); + + self::tearDownForBackwardsCompatibility(); + } + + public function testExpiresPastTimestamp() + { + $options = ['access_token' => 'access_token', 'expires' => strtotime('5 days ago')]; + $token = $this->getAccessToken($options); + + $this->assertTrue($token->hasExpired()); + + $options = ['access_token' => 'access_token', 'expires' => 3600]; + $token = $this->getAccessToken($options); + + $this->assertFalse($token->hasExpired()); + + self::tearDownForBackwardsCompatibility(); + } + + public function testGetRefreshToken() + { + $options = [ + 'access_token' => 'access_token', + 'refresh_token' => uniqid() + ]; + $token = $this->getAccessToken($options); + + $refreshToken = $token->getRefreshToken(); + + $this->assertEquals($options['refresh_token'], $refreshToken); + + self::tearDownForBackwardsCompatibility(); + } + + public function testHasNotExpiredWhenPropertySetInFuture() + { + $options = [ + 'access_token' => 'access_token' + ]; + + $expectedExpires = strtotime('+1 day'); + + $token = Mockery::mock(AccessToken::class, [$options])->makePartial(); + $token + ->shouldReceive('getExpires') + ->once() + ->andReturn($expectedExpires); + + $this->assertFalse($token->hasExpired()); + + self::tearDownForBackwardsCompatibility(); + } + + public function testHasExpiredWhenPropertySetInPast() + { + $options = [ + 'access_token' => 'access_token' + ]; + + $expectedExpires = strtotime('-1 day'); + + $token = Mockery::mock(AccessToken::class, [$options])->makePartial(); + $token + ->shouldReceive('getExpires') + ->once() + ->andReturn($expectedExpires); + + $this->assertTrue($token->hasExpired()); + + self::tearDownForBackwardsCompatibility(); + } + + public function testCannotReportExpiredWhenNoExpirationSet() + { + $options = [ + 'access_token' => 'access_token', + ]; + $token = $this->getAccessToken($options); + + $this->expectException(RuntimeException::class); + + $hasExpired = $token->hasExpired(); + + self::tearDownForBackwardsCompatibility(); + } + + public function testInvalidExpiresIn() + { + $options = [ + 'access_token' => 'access_token', + 'expires_in' => 'TEXT', + ]; + + $this->expectException(InvalidArgumentException::class); + + $token = $this->getAccessToken($options); + + self::tearDownForBackwardsCompatibility(); + } + + + public function testJsonSerializable() + { + $options = [ + 'access_token' => 'mock_access_token', + 'refresh_token' => 'mock_refresh_token', + 'expires' => time(), + 'resource_owner_id' => 'mock_resource_owner_id', + ]; + + $token = $this->getAccessToken($options); + $jsonToken = json_encode($token); + + $this->assertEquals($options, json_decode($jsonToken, true)); + + self::tearDownForBackwardsCompatibility(); + } + + public function testValues() + { + $options = [ + 'access_token' => 'mock_access_token', + 'refresh_token' => 'mock_refresh_token', + 'expires' => time(), + 'resource_owner_id' => 'mock_resource_owner_id', + 'custom_thing' => 'i am a test!', + ]; + + $token = $this->getAccessToken($options); + + $values = $token->getValues(); + + $this->assertTrue(is_array($values)); + $this->assertArrayHasKey('custom_thing', $values); + $this->assertSame($options['custom_thing'], $values['custom_thing']); + + self::tearDownForBackwardsCompatibility(); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ArrayAccessorTraitTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ArrayAccessorTraitTest.php new file mode 100644 index 0000000000..df58257eb2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ArrayAccessorTraitTest.php @@ -0,0 +1,48 @@ + 'bar']; + + $result = $this->getValueByKey($array, 'foo'); + + $this->assertEquals($array['foo'], $result); + } + + public function testGetNonExistentValueWithDefault() + { + $array = []; + $default = 'foo'; + + $result = $this->getValueByKey($array, 'bar', $default); + + $this->assertEquals($default, $result); + } + + public function testGetNestedValue() + { + $array = ['foo' => ['bar' => 'murray']]; + + $result = $this->getValueByKey($array, 'foo.bar'); + + $this->assertEquals($array['foo']['bar'], $result); + } + + public function testGetNonExistantRootValue() + { + $array = ['foo' => 'bar']; + + $result = $this->getValueByKey($array, 'foo.bar'); + + $this->assertNull($result); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ProviderRedirectTraitTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ProviderRedirectTraitTest.php new file mode 100644 index 0000000000..dc06f45a58 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/ProviderRedirectTraitTest.php @@ -0,0 +1,165 @@ +httpClient; + } + + public function setHttpClient(ClientInterface $httpClient) + { + $this->httpClient = $httpClient; + + return $this; + } + + public function testRedirectLimitDefault() + { + $this->assertEquals(2, $this->getRedirectLimit()); + } + + public function testSetRedirectLimit() + { + $redirectLimit = rand(3, 5); + $this->setRedirectLimit($redirectLimit); + $this->assertEquals($redirectLimit, $this->getRedirectLimit()); + } + + public function testSetRedirectLimitThrowsExceptionWhenNonNumericProvided() + { + $redirectLimit = 'florp'; + + $this->expectException(InvalidArgumentException::class); + + $this->setRedirectLimit($redirectLimit); + } + + public function testSetRedirectLimitThrowsExceptionWhenZeroProvided() + { + $redirectLimit = 0; + + $this->expectException(InvalidArgumentException::class); + + $this->setRedirectLimit($redirectLimit); + } + + public function testSetRedirectLimitThrowsExceptionWhenNegativeIntegerProvided() + { + $redirectLimit = -10; + + $this->expectException(InvalidArgumentException::class); + + $this->setRedirectLimit($redirectLimit); + } + + public function testClientLimitsRedirectResponse() + { + $redirectLimit = rand(3, 5); + $status = rand(301,399); + $redirectUrl = uniqid(); + + $request = Mockery::mock(RequestInterface::class); + $request + ->shouldReceive('withUri') + ->andReturnSelf(); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getStatusCode' => $status, + ]); + $response + ->shouldReceive('hasHeader') + ->with('Location') + ->andReturnTrue(); + $response + ->shouldReceive('getHeader') + ->with('Location') + ->andReturn([$redirectUrl]); + + $client = Mockery::mock(ClientInterface::class); + $client + ->shouldReceive('send') + ->times($redirectLimit) + ->andReturn($response); + + $this->setHttpClient($client)->setRedirectLimit($redirectLimit); + $finalResponse = $this->getResponse($request); + + $this->assertInstanceOf(ResponseInterface::class, $finalResponse); + } + + public function testClientLimitsRedirectLoopWhenRedirectNotDetected() + { + $redirectLimit = rand(3, 5); + $status = 200; + + $request = Mockery::mock(RequestInterface::class); + $request + ->shouldReceive('withUri') + ->andReturnSelf(); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getStatusCode' => $status, + ]); + $response + ->shouldReceive('hasHeader') + ->with('Location') + ->andReturnTrue(); + + $client = Mockery::mock(ClientInterface::class); + $client + ->shouldReceive('send') + ->once() + ->andReturn($response); + + $this->setHttpClient($client)->setRedirectLimit($redirectLimit); + $finalResponse = $this->getResponse($request); + + $this->assertInstanceOf(ResponseInterface::class, $finalResponse); + } + + public function testClientErrorReturnsResponse() + { + $status = rand(400, 500); + $result = ['foo' => 'bar']; + + $request = Mockery::mock(RequestInterface::class); + $request + ->shouldReceive('withUri') + ->andReturnSelf(); + + $response = Mockery::mock(ResponseInterface::class, [ + 'getStatusCode' => $status, + ]); + + $exception = new BadResponseException('test exception', $request, $response); + + $client = Mockery::mock(ClientInterface::class); + $client + ->shouldReceive('send') + ->andThrow($exception); + + $this->setHttpClient($client); + $finalResponse = $this->getResponse($request); + + $this->assertInstanceOf(ResponseInterface::class, $finalResponse); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/QueryBuilderTraitTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/QueryBuilderTraitTest.php new file mode 100644 index 0000000000..a0b2b83ba1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/QueryBuilderTraitTest.php @@ -0,0 +1,26 @@ + 'foo', + 'b' => 'bar', + 'c' => '+', + ]; + + $query = $this->buildQueryString($params); + + $this->assertSame('a=foo&b=bar&c=%2B', $query); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/RequestFactoryTest.php b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/RequestFactoryTest.php new file mode 100644 index 0000000000..8a9dbc7c70 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/league/oauth2-client/test/src/Tool/RequestFactoryTest.php @@ -0,0 +1,56 @@ +getRequest($method, $uri); + + $this->assertInstanceOf(RequestInterface::class, $request); + $this->assertSame(strtoupper($method), $request->getMethod()); + $this->assertSame($uri, (string) $request->getUri()); + + $headers = ['X-Test' => 'Foo']; + $body = 'test body'; + $protocolVersion = '1.0'; + + $request = $factory->getRequest($method, $uri, $headers, $body, $protocolVersion); + + $this->assertTrue($request->hasHeader('X-Test')); + $this->assertSame($body, (string) $request->getBody()); + $this->assertSame($protocolVersion, $request->getProtocolVersion()); + } + + public function testGetRequestWithOptions() + { + $method = 'head'; + $uri = '/test/options'; + + $factory = new RequestFactory(); + $request = $factory->getRequestWithOptions($method, $uri); + + $this->assertInstanceOf(RequestInterface::class, $request); + $this->assertSame(strtoupper($method), $request->getMethod()); + $this->assertSame($uri, (string) $request->getUri()); + + $options = [ + 'body' => 'another=test&form=body', + 'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'], + ]; + + $request = $factory->getRequestWithOptions($method, $uri, $options); + + $this->assertContains($options['headers']['Content-Type'], $request->getHeader('Content-Type')); + $this->assertSame($options['body'], (string) $request->getBody()); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitattributes b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitattributes new file mode 100644 index 0000000000..829330b1ca --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitattributes @@ -0,0 +1,14 @@ +* text=auto + +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.scrutinizer.yml export-ignore +/.travis.yml export-ignore +/CHANGELOG.md export-ignore +/RATIONALE.md export-ignore +/README.md export-ignore +/SECURITY.md export-ignore +/phpunit.sh export-ignore +/phpunit.xml.dist export-ignore +/other/ide_stubs export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitignore b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitignore new file mode 100644 index 0000000000..de26af5798 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.gitignore @@ -0,0 +1,4 @@ +composer.lock +/vendor/ +/tests/phpunit.phar +/tests/phpunit.phar.asc \ No newline at end of file diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.scrutinizer.yml b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.scrutinizer.yml new file mode 100644 index 0000000000..a2f32ead6b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.scrutinizer.yml @@ -0,0 +1,4 @@ +checks: + php: + code_rating: true + duplication: false \ No newline at end of file diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.travis.yml b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.travis.yml new file mode 100644 index 0000000000..65bd6ba7f3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/.travis.yml @@ -0,0 +1,59 @@ +language: php +sudo: false + +matrix: + fast_finish: true + include: + - dist: precise + php: "5.3" + env: USE_PSALM=0 + CHECK_MBSTRING=1 + - dist: precise + php: "5.4" + env: USE_PSALM=0 + CHECK_MBSTRING=1 + - dist: precise + php: "5.5" + env: USE_PSALM=0 + CHECK_MBSTRING=1 + - dist: precise + php: "5.6" + env: USE_PSALM=1 + CHECK_MBSTRING=1 + - php: "7.0" + env: USE_PSALM=1 + CHECK_MBSTRING=1 + - php: "7.1" + env: USE_PSALM=1 + CHECK_MBSTRING=1 + - php: "7.2" + env: USE_PSALM=1 + CHECK_MBSTRING=0 + - php: "7.3" + env: USE_PSALM=1 + CHECK_MBSTRING=0 + - php: "7.4" + env: USE_PSALM=1 + CHECK_MBSTRING=0 + - php: "nightly" + env: USE_PSALM=1 + CHECK_MBSTRING=0 + - php: "hhvm" + env: USE_PSALM=1 + CHECK_MBSTRING=1 + - php: "master" + env: USE_PSALM=1 + CHECK_MBSTRING=0 + allow_failures: + - php: "hhvm" + - php: "master" + +install: + - composer self-update + - composer install + - if [[ $USE_PSALM -eq 1 ]]; then composer require --dev "vimeo/psalm:^0|^1|^2"; fi + +script: + - vendor/bin/phpunit + - php -dmbstring.func_overload=7 vendor/bin/phpunit + - if [[ $USE_PSALM -eq 1 ]]; then vendor/bin/psalm; fi diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/CHANGELOG.md new file mode 100644 index 0000000000..c767d079a3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/CHANGELOG.md @@ -0,0 +1,3 @@ +# Version 9.99.99 + +Do nothing. Requires PHP 7. diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/LICENSE b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/LICENSE new file mode 100644 index 0000000000..45c7017dfb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Paragon Initiative Enterprises + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/RATIONALE.md b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/RATIONALE.md new file mode 100644 index 0000000000..607271db8a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/RATIONALE.md @@ -0,0 +1,36 @@ +## Rationale (Design Decisions) + +### Reasoning Behind the Order of Preferred Random Data Sources + +The order is: + + 1. `libsodium if available` + 2. `fread() /dev/urandom if available` + 3. `mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)` + 4. `COM('CAPICOM.Utilities.1')->GetRandom()` + +If libsodium is available, we get random data from it. This is the preferred +method on all OSes, but libsodium is not very widely installed, so other +fallbacks are available. + +Next, we read `/dev/urandom` (if it exists). This is the preferred file to read +for random data for cryptographic purposes for BSD and Linux. This step +is skipped on Windows, because someone could create a `C:\dev\urandom` +file and PHP would helpfully (but insecurely) return bytes from it. + +Despite [strongly urging people not to use mcrypt in their projects](https://paragonie.com/blog/2015/05/if-you-re-typing-word-mcrypt-into-your-code-you-re-doing-it-wrong) +(because libmcrypt is abandonware and the API puts too much responsibility on the +implementor) we prioritize `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` above +the remaining implementations. + +The reason is simple: `mcrypt_create_iv()` is part of PHP's `ext/mcrypt` code, +and is not part `libmcrypt`. It actually does the right thing: + + * On Unix-based operating systems, it reads from `/dev/urandom` which + (unlike `/dev/random`) is the sane and correct thing to do. + * On Windows, it reads from `CryptGenRandom`, which is an exclusively Windows + way to get random bytes. + +If we're on Windows and don't have access to `mcrypt`, we use `CAPICOM.Utilities.1`. + +As of random_compat 2.0, we no longer fall through to OpenSSL. diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/README.md b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/README.md new file mode 100644 index 0000000000..75eabd4252 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/README.md @@ -0,0 +1,232 @@ +# random_compat + +[![Build Status](https://travis-ci.org/paragonie/random_compat.svg?branch=master)](https://travis-ci.org/paragonie/random_compat) +[![Scrutinizer](https://scrutinizer-ci.com/g/paragonie/random_compat/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/paragonie/random_compat) +[![Latest Stable Version](https://poser.pugx.org/paragonie/random_compat/v/stable)](https://packagist.org/packages/paragonie/random_compat) +[![Latest Unstable Version](https://poser.pugx.org/paragonie/random_compat/v/unstable)](https://packagist.org/packages/paragonie/random_compat) +[![License](https://poser.pugx.org/paragonie/random_compat/license)](https://packagist.org/packages/paragonie/random_compat) +[![Downloads](https://img.shields.io/packagist/dt/paragonie/random_compat.svg)](https://packagist.org/packages/paragonie/random_compat) + +PHP 5.x polyfill for `random_bytes()` and `random_int()` created and maintained +by [Paragon Initiative Enterprises](https://paragonie.com). + +Although this library *should* function in earlier versions of PHP, we will only +consider issues relevant to [supported PHP versions](https://secure.php.net/supported-versions.php). +**If you are using an unsupported version of PHP, please upgrade as soon as possible.** + +## Important + +Although this library has been examined by some security experts in the PHP +community, there will always be a chance that we overlooked something. Please +ask your favorite trusted hackers to hammer it for implementation errors and +bugs before even thinking about deploying it in production. + +**Do not use the master branch, use a [stable release](https://github.com/paragonie/random_compat/releases/latest).** + +For the background of this library, please refer to our blog post on +[Generating Random Integers and Strings in PHP](https://paragonie.com/blog/2015/07/how-safely-generate-random-strings-and-integers-in-php). + +### Usability Notice + +If PHP cannot safely generate random data, this library will throw an `Exception`. +It will never fall back to insecure random data. If this keeps happening, upgrade +to a newer version of PHP immediately. + +## Installing + +**With [Composer](https://getcomposer.org):** + + composer require paragonie/random_compat + +**Signed PHP Archive:** + +As of version 1.2.0, we also ship an ECDSA-signed PHP Archive with each stable +release on Github. + +1. Download [the `.phar`, `.phar.pubkey`, and `.phar.pubkey.asc`](https://github.com/paragonie/random_compat/releases/latest) files. +2. (**Recommended** but not required) Verify the PGP signature of `.phar.pubkey` + (contained within the `.asc` file) using the [PGP public key for Paragon Initiative Enterprises](https://paragonie.com/static/gpg-public-key.txt). +3. Extract both `.phar` and `.phar.pubkey` files to the same directory. +4. `require_once "/path/to/random_compat.phar";` +5. When a new version is released, you only need to replace the `.phar` file; + the `.pubkey` will not change (unless our signing key is ever compromised). + +**Manual Installation:** + +1. Download [a stable release](https://github.com/paragonie/random_compat/releases/latest). +2. Extract the files into your project. +3. `require_once "/path/to/random_compat/lib/random.php";` + +The entrypoint should be **`lib/random.php`** directly, not any of the other files in `/lib`. + +## Usage + +This library exposes the [CSPRNG functions added in PHP 7](https://secure.php.net/manual/en/ref.csprng.php) +for use in PHP 5 projects. Their behavior should be identical. + +### Generate a string of random bytes + +```php +try { + $string = random_bytes(32); +} catch (TypeError $e) { + // Well, it's an integer, so this IS unexpected. + die("An unexpected error has occurred"); +} catch (Error $e) { + // This is also unexpected because 32 is a reasonable integer. + die("An unexpected error has occurred"); +} catch (Exception $e) { + // If you get this message, the CSPRNG failed hard. + die("Could not generate a random string. Is our OS secure?"); +} + +var_dump(bin2hex($string)); +// string(64) "5787c41ae124b3b9363b7825104f8bc8cf27c4c3036573e5f0d4a91ad2eeac6f" +``` + +### Generate a random integer between two given integers (inclusive) + +```php +try { + $int = random_int(0, 255); +} catch (TypeError $e) { + // Well, it's an integer, so this IS unexpected. + die("An unexpected error has occurred"); +} catch (Error $e) { + // This is also unexpected because 0 and 255 are both reasonable integers. + die("An unexpected error has occurred"); +} catch (Exception $e) { + // If you get this message, the CSPRNG failed hard. + die("Could not generate a random int. Is our OS secure?"); +} + +var_dump($int); +// int(47) +``` + +### Exception handling + +When handling exceptions and errors you must account for differences between +PHP 5 and PHP7. + +The differences: + +* Catching `Error` works, so long as it is caught before `Exception`. +* Catching `Exception` has different behavior, without previously catching `Error`. +* There is *no* portable way to catch all errors/exceptions. + +#### Our recommendation + +**Always** catch `Error` before `Exception`. + +#### Example + +```php +try { + return random_int(1, $userInput); +} catch (TypeError $e) { + // This is okay, so long as `Error` is caught before `Exception`. + throw new Exception('Please enter a number!'); +} catch (Error $e) { + // This is required, if you do not need to do anything just rethrow. + throw $e; +} catch (Exception $e) { + // This is optional and maybe omitted if you do not want to handle errors + // during generation. + throw new InternalServerErrorException( + 'Oops, our server is bust and cannot generate any random data.', + 500, + $e + ); +} +``` + +### Troubleshooting + +#### Exception: "Could not gather sufficient random data"** + +If an Exception is thrown, then your operating system is not secure. + +1. If you're on Windows, make sure you enable mcrypt. +2. If you're on any other OS, make sure `/dev/urandom` is readable. + * FreeBSD jails need to expose `/dev/urandom` from the host OS + * If you use `open_basedir`, make sure `/dev/urandom` is allowed + +This library does not (and will not accept any patches to) fall back to +an insecure random number generator. + +#### Version Conflict with [Other PHP Project] + +If you're using a project that has a line like this in its composer.json + + "require" { + ... + "paragonie/random_compat": "~1.1", + ... + } + +...and then you try to add random_compat 2 (or another library that explicitly +requires random_compat 2, such as [this secure PHP encryption library](https://github.com/defuse/php-encryption)), +you will get a version conflict. + +The solution is to get the project to update its requirement string to allow +version 2 and above to be used instead of hard-locking users to version 1. + +```diff +"require" { + ... +- "paragonie/random_compat": "~1.1", ++ "paragonie/random_compat": "^1|^2", + ... +} +``` + +## Contributors + +This project would not be anywhere near as excellent as it is today if it +weren't for the contributions of the following individuals: + +* [@AndrewCarterUK (Andrew Carter)](https://github.com/AndrewCarterUK) +* [@asgrim (James Titcumb)](https://github.com/asgrim) +* [@bcremer (Benjamin Cremer)](https://github.com/bcremer) +* [@chriscct7 (Chris Christoff)](https://github.com/chriscct7) +* [@CodesInChaos (Christian Winnerlein)](https://github.com/CodesInChaos) +* [@ConnorVG (Connor S. Parks)](https://github.com/ConnorVG) +* [@cs278 (Chris Smith)](https://github.com/cs278) +* [@cweagans (Cameron Eagans)](https://github.com/cweagans) +* [@dd32 (Dion Hulse)](https://github.com/dd32) +* [@geggleto (Glenn Eggleton)](https://github.com/geggleto) +* [@glensc (Elan Ruusamäe)](https://github.com/glensc) +* [@GrahamCampbell (Graham Campbell)](https://github.com/GrahamCampbell) +* [@ircmaxell (Anthony Ferrara)](https://github.com/ircmaxell) +* [@jdevalk (Joost de Valk)](https://github.com/jdevalk) +* [@jedisct1 (Frank Denis)](https://github.com/jedisct1) +* [@juliangut (Julián Gutiérrez)](https://github.com/juliangut) +* [@kelunik (Niklas Keller)](https://github.com/kelunik) +* [@lt (Leigh)](https://github.com/lt) +* [@MasonM (Mason Malone)](https://github.com/MasonM) +* [@menkaff (Mehran NikNafs)](https://github.com/menkaff) +* [@mmeyer2k (Michael M)](https://github.com/mmeyer2k) +* [@narfbg (Andrey Andreev)](https://github.com/narfbg) +* [@nicolas-grekas (Nicolas Grekas)](https://github.com/nicolas-grekas) +* [@ocean90 (Dominik Schilling)](https://github.com/ocean90) +* [@oittaa](https://github.com/oittaa) +* [@oucil (Kevin Farley)](https://github.com/oucil) +* [@philios33 (Phil Nicholls)](https://github.com/philios33) +* [@redragonx (Stephen Chavez)](https://github.com/redragonx) +* [@relaxnow (Boy Baukema)](https://github.com/relaxnow) +* [@rchouinard (Ryan Chouinard)](https://github.com/rchouinard) +* [@rugk](https://github.com/rugk) +* [@SammyK (Sammy Kaye Powers)](https://github.com/SammyK) +* [@scottchiefbaker (Scott Baker)](https://github.com/scottchiefbaker) +* [@skyosev (Stoyan Kyosev)](https://github.com/skyosev) +* [@sthen (Stuart Henderseon)](https://github.com/sthen) +* [@stof (Christophe Coevoet)](https://github.com/stof) +* [@teohhanhui (Teoh Han Hui)](https://github.com/teohhanhui) +* [@tom-- (Tom Worster)](https://github.com/tom--) +* [@tsyr2ko](https://github.com/tsyr2ko) +* [@trowski (Aaron Piotrowski)](https://github.com/trowski) +* [@twistor (Chris Lepannen)](https://github.com/twistor) +* [@vinkla (Vincent Klaiber)](https://github.com/vinkla) +* [@voku (Lars Moelleken)](https://github.com/voku) +* [@xabbuh (Christian Flothmann)](https://github.com/xabbuh) diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/SECURITY.md b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/SECURITY.md new file mode 100644 index 0000000000..7520731314 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/SECURITY.md @@ -0,0 +1,108 @@ +# An Invitation to Security Researchers + +Every company says they take security "very seriously." Rather than bore anyone +with banal boilerplate, here are some quick answers followed by detailed +elaboration. If you have any questions about our policies, please email them to +`scott@paragonie.com`. + +## Quick Answers + +* There is no compulsion to disclose vulnerabilities privately, but we + appreciate a head's up. +* `security@paragonie.com` will get your reports to the right person. Our GPG + fingerprint, should you decide to encrypt your report, is + `7F52 D5C6 1D12 55C7 3136 2E82 6B97 A1C2 8264 04DA`. +* **YES**, we will reward security researchers who disclose vulnerabilities in + our software. +* In most cases, **No Proof-of-Concept Required.** +* We have a [bug bounty program on HackerOne](https://hackerone.com/paragonie). + +## How to Report a Security Bug to Paragon Initiative Enterprises + +### There is no compulsion to disclose privately. + +We believe vulnerability disclosure style is a personal choice and enjoy working +with a diverse community. We understand and appreciate the importance of Full +Disclosure in the history and practice of security research. + +We would *like* to know about high-severity bugs before they become public +knowledge, so we can fix them in a timely manner, but **we do not believe in +threatening researchers or trying to enforce vulnerability embargoes**. + +Ultimately, if you discover a security-affecting vulnerability, what you do with +it is your choice. We would like to work with people, and to celebrate and +reward their skill, experience, and dedication. We appreciate being informed of +our mistakes so we can learn from them and build a better product. Our goal is +to empower the community. + +### Where to Send Security Vulnerabilities + +Our security email address is `security@paragonie.com`. Also feel free to open a +new issue on Github if you want to disclose publicly. + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: G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7PJn+9KS6wOxXul/UE0jct/5f7KLMdWMJ1VgniQmm +hjvkHLPSICteqCI04RfcmMseW9gueHQXeUu1SNIvsWa2MhxjeBej3pDnrZWszKwy +gF45GO9/v4tkIXNMy5J1AtOyRgQ3IUMqp8EAEQEAAYkBHwQYAQIACQUCVSDBFQIb +DAAKCRBrl6HCgmQE2jnIB/4/xFz8InpM7eybnBOAir3uGcYfs3DOmaKn7qWVtGzv +rKpQPYnVtlU2i6Z5UO4c4jDLT/8Xm1UDz3Lxvqt4xCaDwJvBZexU5BMK8l5DvOzH +6o6P2L1UDu6BvmPXpVZz7/qUhOnyf8VQg/dAtYF4/ax19giNUpI5j5o5mX5w80Rx +qSXV9NdSL4fdjeG1g/xXv2luhoV53T1bsycI3wjk/x5tV+M2KVhZBvvuOm/zhJje +oLWp0saaESkGXIXqurj6gZoujJvSvzl0n9F9VwqMEizDUfrXgtD1siQGhP0sVC6q +ha+F/SAEJ0jEquM4TfKWWU2S5V5vgPPpIQSYRnhQW4b1 +=xJPW +-----END PGP PUBLIC KEY BLOCK----- +``` + +### We Will Reward Security Researchers + +**This process has not been formalized; nor have dollar amounts been +discussed.** + +However, if you report a valid security-affecting bug, we will compensate you +for the time spent finding the vulnerability and reward you for being a good +neighbor. + +#### What does a "valid" bug mean? + +There are two sides to this: + +1. Some have spammed projects with invalid bug reports hoping to collect + bounties for pressing a button and running an automated analysis tool. This + is not cool. +2. There is a potential for the developers of a project to declare all security + bug reports as invalid to save money. + +Our team members have an established history of reporting vulnerabilities to +large open source projects. **We aren't in the business of ripping people off.** +When in doubt, our policy is to err on the side of generosity. + +### No Proof-of-Concept Required + +We might ask for one if we feel we do not understand some of the details +pertaining to a specific vulnerability. We certainly appreciate them if you +include them in your report, but we believe **the burden lies with the developer +to prove their software *is* secure** rather than with the researcher to prove +that it isn't. + +In our experience, most bugs are simpler to fix than they are to exploit. + diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/build-phar.sh b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/build-phar.sh new file mode 100755 index 0000000000..b4a5ba31cc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/build-phar.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) + +php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/composer.json b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/composer.json new file mode 100644 index 0000000000..f2b9c4e510 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/composer.json @@ -0,0 +1,34 @@ +{ + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "polyfill", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "vimeo/psalm": "^1", + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey new file mode 100644 index 0000000000..eb50ebfcd6 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm +pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p ++h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc +-----END PUBLIC KEY----- diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey.asc b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey.asc new file mode 100644 index 0000000000..6a1d7f3006 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/dist/random_compat.phar.pubkey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (MingW32) + +iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip +QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg +1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW +NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA +NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV +JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74= +=B6+8 +-----END PGP SIGNATURE----- diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/lib/random.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/lib/random.php new file mode 100644 index 0000000000..c7731a56ff --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/lib/random.php @@ -0,0 +1,32 @@ +buildFromDirectory(dirname(__DIR__).'/lib'); +rename( + dirname(__DIR__).'/lib/index.php', + dirname(__DIR__).'/lib/random.php' +); + +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = file_get_contents($argv[1]); + + $private = openssl_get_privatekey($pkeyFile); + if ($private !== false) { + $pkey = ''; + openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); + + /** + * Save the corresponding public key to the file + */ + if (!@is_readable($dist.'/random_compat.phar.pubkey')) { + $details = openssl_pkey_get_details($private); + file_put_contents( + $dist.'/random_compat.phar.pubkey', + $details['key'] + ); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/COM.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/COM.php new file mode 100644 index 0000000000..4ba4bb317b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/other/ide_stubs/COM.php @@ -0,0 +1,20 @@ + + + + + tests/unit + + + + + ./tests/unit + + + + + ./lib + + + diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/psalm-autoload.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/psalm-autoload.php new file mode 100644 index 0000000000..d71d1b818c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/psalm-autoload.php @@ -0,0 +1,9 @@ + + + + + + + + + + + + + + + diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/DieHardTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/DieHardTest.php new file mode 100644 index 0000000000..2e6dc70051 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/DieHardTest.php @@ -0,0 +1,61 @@ + $i, + 'value' => $buckets[$i], + 'min' => $min, + 'nums' => $nums_to_generate, + 'reason' => 'below min' + ]); + } + if ($buckets[$i] >= $max ) { + var_dump([ + 'bucket' => $i, + 'value' => $buckets[$i], + 'maax' => $max, + 'nums' => $nums_to_generate, + 'reason' => 'above max' + ]); + } + + $this->assertTrue($buckets[$i] < $max && $buckets[$i] > $min); + } + } + } +} \ No newline at end of file diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/StatTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/StatTest.php new file mode 100644 index 0000000000..e78eb14633 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/full/StatTest.php @@ -0,0 +1,52 @@ + 30% but less than 170% + * + * This also catches 0 and 1000 + */ + public function testDistribution() + { + $integers = array_fill(0, 100, 0); + for ($i = 0; $i < 10000; ++$i) { + ++$integers[random_int(0,99)]; + } + for ($i = 0; $i < 100; ++$i) { + $this->assertFalse($integers[$i] < 30); + $this->assertFalse($integers[$i] > 170); + } + } + + /** + * This should be between 55% and 75%, always + */ + public function testCoverage() + { + $integers = array_fill(0, 2000, 0); + for ($i = 0; $i < 2000; ++$i) { + ++$integers[random_int(0,1999)]; + } + $coverage = 0; + for ($i = 0; $i < 2000; ++$i) { + if ($integers[$i] > 0) { + ++$coverage; + } + } + $this->assertTrue($coverage >= 1150); + $this->assertTrue($coverage <= 1350); + } + + public function testCompressionRatios() + { + $some_bytes = random_bytes(65536); + $compressed = gzcompress($some_bytes, 9); + if (function_exists('mb_strlen')) { + $length = mb_strlen($compressed, '8bit'); + } else { + $length = strlen($compressed); + } + $this->assertTrue($length >= 65000 && $length <= 67000); + } +} \ No newline at end of file diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/capicom.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/capicom.php new file mode 100644 index 0000000000..640be1b5b8 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/specific/capicom.php @@ -0,0 +1,7 @@ +assertTrue(function_exists('random_bytes')); + } + + public function testInvalidParams() + { + try { + $bytes = random_bytes('good morning'); + $this->fail("random_bytes() should accept only an integer"); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + + try { + $bytes = random_bytes(array(12)); + $this->fail("random_bytes() should accept only an integer"); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + + // This should succeed: + $bytes = random_bytes('123456'); + } + + public function testOutput() + { + $bytes = array( + random_bytes(12), + random_bytes(64), + random_bytes(64), + random_bytes(1.5) + ); + + $this->assertTrue( + strlen(bin2hex($bytes[0])) === 24 + ); + $this->assertTrue( + strlen(bin2hex($bytes[3])) === 2 + ); + + // This should never generate identical byte strings + $this->assertFalse( + $bytes[1] === $bytes[2] + ); + + try { + $x = random_bytes(~PHP_INT_MAX - 1000000000); + $this->fail("Integer overflow (~PHP_INT_MAX - 1000000000)."); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + + try { + $x = random_bytes(PHP_INT_MAX + 1000000000); + $this->fail("Requesting too many bytes should fail."); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/RandomIntTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/RandomIntTest.php new file mode 100644 index 0000000000..c8cbb0de1a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/RandomIntTest.php @@ -0,0 +1,63 @@ +assertTrue(function_exists('random_int')); + } + + public function testOutput() + { + $half_neg_max = (~PHP_INT_MAX / 2); + $integers = array( + random_int(0, 1000), + random_int(1001,2000), + random_int(-100, -10), + random_int(-1000, 1000), + random_int(~PHP_INT_MAX, PHP_INT_MAX), + random_int("0", "1"), + random_int(0.11111, 0.99999), + random_int($half_neg_max, PHP_INT_MAX), + random_int(0.0, 255.0), + random_int(-4.5, -4.5), + random_int("1337e3","1337e3") + ); + + $this->assertFalse($integers[0] === $integers[1]); + $this->assertTrue($integers[0] >= 0 && $integers[0] <= 1000); + $this->assertTrue($integers[1] >= 1001 && $integers[1] <= 2000); + $this->assertTrue($integers[2] >= -100 && $integers[2] <= -10); + $this->assertTrue($integers[3] >= -1000 && $integers[3] <= 1000); + $this->assertTrue($integers[4] >= ~PHP_INT_MAX && $integers[4] <= PHP_INT_MAX); + $this->assertTrue($integers[5] >= 0 && $integers[5] <= 1); + $this->assertTrue($integers[6] === 0); + $this->assertTrue($integers[7] >= $half_neg_max && $integers[7] <= PHP_INT_MAX); + $this->assertTrue($integers[8] >= 0 && $integers[8] <= 255); + $this->assertSame($integers[9], -4); + $this->assertSame($integers[10], 1337000); + + try { + $h = random_int("2147483648", "2147483647"); + $i = random_int("9223372036854775808", "9223372036854775807"); + $this->assertFalse(is_int($i)); + $h = random_int("-2147483648", "2147483647"); + $i = random_int("-9223372036854775808", "9223372036854775807"); + $this->fail("One of these options should have thrown an exception."); + } catch (Error $ex) { + $this->assertTrue($ex instanceof Error); + } catch (Exception $ex) { + $this->assertTrue($ex instanceof Exception); + } + } + + public function testRandomRange() + { + $try = 64; + $maxLen = strlen(~PHP_INT_MAX); + do { + $rand = random_int(~PHP_INT_MAX, PHP_INT_MAX); + } while (strlen($rand) !== $maxLen && $try--); + + $this->assertGreaterThan(0, $try); + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/UtilityTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/UtilityTest.php new file mode 100644 index 0000000000..294a8019db --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit/UtilityTest.php @@ -0,0 +1,95 @@ +markTestSkipped( + 'We don\' need to test this in PHP 7.' + ); + } + $this->assertEquals(RandomCompat_strlen("\xF0\x9D\x92\xB3"), 4); + } + + public function testIntval() + { + if (!function_exists('RandomCompat_intval')) { + return $this->markTestSkipped( + 'We don\' need to test this in PHP 7.' + ); + } + // Equals + $this->assertEquals( + abs(RandomCompat_intval(-4.5)), + abs(RandomCompat_intval(4.5)) + ); + + // True + $this->assertTrue( + is_int(RandomCompat_intval(PHP_INT_MAX, true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval(~PHP_INT_MAX, true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval(~PHP_INT_MAX + 1, true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("1337e3", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("1.", true)) + ); + + // False + $this->assertFalse( + is_int(RandomCompat_intval((float) PHP_INT_MAX, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval((float) ~PHP_INT_MAX, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(PHP_INT_MAX + 1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(~PHP_INT_MAX - 1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(~PHP_INT_MAX - 0.1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(PHP_INT_MAX + 0.1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval("hello", true)) + ); + + if (PHP_INT_SIZE === 8) { + $this->assertFalse( + is_int(RandomCompat_intval("-9223372036854775809", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("-9223372036854775808", true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval("9223372036854775808", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("9223372036854775807", true)) + ); + } else { + $this->assertFalse( + is_int(RandomCompat_intval("2147483648", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("2147483647", true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval("-2147483649", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("-2147483648", true)) + ); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomBytesTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomBytesTest.php new file mode 100644 index 0000000000..69964ffd4a --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomBytesTest.php @@ -0,0 +1,100 @@ +assertTrue(function_exists('random_bytes')); + } + + public function testInvalidParams() + { + try { + $bytes = random_bytes('good morning'); + $this->fail("random_bytes() should accept only an integer"); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + if ($ex->getMessage() === self::NO_BASEDIR) { + return; + } + } + + try { + $bytes = random_bytes(array(12)); + $this->fail("random_bytes() should accept only an integer"); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + + // This should succeed: + try { + $bytes = random_bytes('123456'); + } catch (Exception $ex) { + $this->assertEquals( + $ex->getMessage(), + self::NO_BASEDIR + ); + } + } + + public function testOutput() + { + try { + $bytes = array( + random_bytes(12), + random_bytes(64), + random_bytes(64), + random_bytes(1.5) + ); + } catch (Exception $ex) { + $this->assertEquals( + $ex->getMessage(), + self::NO_BASEDIR + ); + return; + } + + $this->assertTrue( + strlen(bin2hex($bytes[0])) === 24 + ); + $this->assertTrue( + strlen(bin2hex($bytes[3])) === 2 + ); + + // This should never generate identical byte strings + $this->assertFalse( + $bytes[1] === $bytes[2] + ); + + try { + $x = random_bytes(~PHP_INT_MAX - 1000000000); + $this->fail("Integer overflow (~PHP_INT_MAX - 1000000000)."); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + + try { + $x = random_bytes(PHP_INT_MAX + 1000000000); + $this->fail("Requesting too many bytes should fail."); + } catch (TypeError $ex) { + $this->assertTrue(true); + } catch (Error $ex) { + $this->assertTrue(true); + } catch (Exception $ex) { + $this->assertTrue(true); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomIntTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomIntTest.php new file mode 100644 index 0000000000..56197b094d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/RandomIntTest.php @@ -0,0 +1,82 @@ +assertTrue(function_exists('random_int')); + } + + public function testOutput() + { + try { + $half_neg_max = (~PHP_INT_MAX / 2); + + $integers = array( + random_int(0, 1000), + random_int(1001,2000), + random_int(-100, -10), + random_int(-1000, 1000), + random_int(~PHP_INT_MAX, PHP_INT_MAX), + random_int("0", "1"), + random_int(0.11111, 0.99999), + random_int($half_neg_max, PHP_INT_MAX), + random_int(0.0, 255.0), + random_int(-4.5, -4.5), + random_int("1337e3","1337e3") + ); + + $this->assertFalse($integers[0] === $integers[1]); + $this->assertTrue($integers[0] >= 0 && $integers[0] <= 1000); + $this->assertTrue($integers[1] >= 1001 && $integers[1] <= 2000); + $this->assertTrue($integers[2] >= -100 && $integers[2] <= -10); + $this->assertTrue($integers[3] >= -1000 && $integers[3] <= 1000); + $this->assertTrue($integers[4] >= ~PHP_INT_MAX && $integers[4] <= PHP_INT_MAX); + $this->assertTrue($integers[5] >= 0 && $integers[5] <= 1); + $this->assertTrue($integers[6] === 0); + $this->assertTrue($integers[7] >= $half_neg_max && $integers[7] <= PHP_INT_MAX); + $this->assertTrue($integers[8] >= 0 && $integers[8] <= 255); + $this->assertTrue($integers[9] === -4); + $this->assertTrue($integers[10] === 1337000); + } catch (Exception $ex) { + $this->assertEquals( + $ex->getMessage(), + self::NO_BASEDIR + ); + return; + } + + try { + $h = random_int("2147483648", "2147483647"); + $i = random_int("9223372036854775808", "9223372036854775807"); + $this->assertFalse(is_int($i)); + $h = random_int("-2147483648", "2147483647"); + $i = random_int("-9223372036854775808", "9223372036854775807"); + $this->fail("One of these options should have thrown an exception."); + } catch (Error $ex) { + $this->assertTrue($ex instanceof Error); + } catch (Exception $ex) { + $this->assertTrue($ex instanceof Exception); + } + } + + public function testRandomRange() + { + try { + $try = 64; + $maxLen = strlen(~PHP_INT_MAX); + do { + $rand = random_int(~PHP_INT_MAX, PHP_INT_MAX); + } while (strlen($rand) !== $maxLen && $try--); + + $this->assertGreaterThan(0, $try); + } catch (Exception $ex) { + $this->assertEquals( + $ex->getMessage(), + self::NO_BASEDIR + ); + return; + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/UtilityTest.php b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/UtilityTest.php new file mode 100644 index 0000000000..294a8019db --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/paragonie/random_compat/tests/unit_with_basedir/UtilityTest.php @@ -0,0 +1,95 @@ +markTestSkipped( + 'We don\' need to test this in PHP 7.' + ); + } + $this->assertEquals(RandomCompat_strlen("\xF0\x9D\x92\xB3"), 4); + } + + public function testIntval() + { + if (!function_exists('RandomCompat_intval')) { + return $this->markTestSkipped( + 'We don\' need to test this in PHP 7.' + ); + } + // Equals + $this->assertEquals( + abs(RandomCompat_intval(-4.5)), + abs(RandomCompat_intval(4.5)) + ); + + // True + $this->assertTrue( + is_int(RandomCompat_intval(PHP_INT_MAX, true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval(~PHP_INT_MAX, true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval(~PHP_INT_MAX + 1, true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("1337e3", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("1.", true)) + ); + + // False + $this->assertFalse( + is_int(RandomCompat_intval((float) PHP_INT_MAX, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval((float) ~PHP_INT_MAX, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(PHP_INT_MAX + 1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(~PHP_INT_MAX - 1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(~PHP_INT_MAX - 0.1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval(PHP_INT_MAX + 0.1, true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval("hello", true)) + ); + + if (PHP_INT_SIZE === 8) { + $this->assertFalse( + is_int(RandomCompat_intval("-9223372036854775809", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("-9223372036854775808", true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval("9223372036854775808", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("9223372036854775807", true)) + ); + } else { + $this->assertFalse( + is_int(RandomCompat_intval("2147483648", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("2147483647", true)) + ); + $this->assertFalse( + is_int(RandomCompat_intval("-2147483649", true)) + ); + $this->assertTrue( + is_int(RandomCompat_intval("-2147483648", true)) + ); + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-client/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/psr/http-client/CHANGELOG.md new file mode 100644 index 0000000000..babba7c7b2 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-client/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.0.3 + +Add `source` link in composer.json. No code changes. + +## 1.0.2 + +Allow PSR-7 (psr/http-message) 2.0. No code changes. + +## 1.0.1 + +Allow installation with PHP 8. No code changes. + +## 1.0.0 + +First stable release. No changes since 0.3.0. + +## 0.3.0 + +Added Interface suffix on exceptions + +## 0.2.0 + +All exceptions are in `Psr\Http\Client` namespace + +## 0.1.0 + +First release diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-client/LICENSE b/code/web/Drivers/oauth2_client_php_league/psr/http-client/LICENSE new file mode 100644 index 0000000000..cd5e0020af --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-client/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-client/README.md b/code/web/Drivers/oauth2_client_php_league/psr/http-client/README.md new file mode 100644 index 0000000000..84af5c55d5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-client/README.md @@ -0,0 +1,12 @@ +HTTP Client +=========== + +This repository holds all the common code related to [PSR-18 (HTTP Client)][psr-url]. + +Note that this is not a HTTP Client implementation of its own. It is merely abstractions that describe the components of a HTTP Client. + +The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist. + +[psr-url]: https://www.php-fig.org/psr/psr-18 +[package-url]: https://packagist.org/packages/psr/http-client +[implementation-url]: https://packagist.org/providers/psr/http-client-implementation diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-client/composer.json b/code/web/Drivers/oauth2_client_php_league/psr/http-client/composer.json new file mode 100644 index 0000000000..6fed350beb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-client/composer.json @@ -0,0 +1,30 @@ +{ + "name": "psr/http-client", + "description": "Common interface for HTTP clients", + "keywords": ["psr", "psr-18", "http", "http-client"], + "homepage": "https://github.com/php-fig/http-client", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-client/src/ClientExceptionInterface.php b/code/web/Drivers/oauth2_client_php_league/psr/http-client/src/ClientExceptionInterface.php new file mode 100644 index 0000000000..aa0b9cf14b --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-client/src/ClientExceptionInterface.php @@ -0,0 +1,10 @@ +=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/RequestFactoryInterface.php b/code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/RequestFactoryInterface.php new file mode 100644 index 0000000000..cb39a08bf5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-factory/src/RequestFactoryInterface.php @@ -0,0 +1,18 @@ + `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`. +> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered. + diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-message/docs/PSR7-Usage.md b/code/web/Drivers/oauth2_client_php_league/psr/http-message/docs/PSR7-Usage.md new file mode 100644 index 0000000000..b6d048a341 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-message/docs/PSR7-Usage.md @@ -0,0 +1,159 @@ +### PSR-7 Usage + +All PSR-7 applications comply with these interfaces +They were created to establish a standard between middleware implementations. + +> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`. +> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered. + + +The following examples will illustrate how basic operations are done in PSR-7. + +##### Examples + + +For this examples to work (at least) a PSR-7 implementation package is required. (eg: zendframework/zend-diactoros, guzzlehttp/psr7, slim/slim, etc) +All PSR-7 implementations should have the same behaviour. + +The following will be assumed: +`$request` is an object of `Psr\Http\Message\RequestInterface` and + +`$response` is an object implementing `Psr\Http\Message\RequestInterface` + + +### Working with HTTP Headers + +#### Adding headers to response: + +```php +$response->withHeader('My-Custom-Header', 'My Custom Message'); +``` + +#### Appending values to headers + +```php +$response->withAddedHeader('My-Custom-Header', 'The second message'); +``` + +#### Checking if header exists: + +```php +$request->hasHeader('My-Custom-Header'); // will return false +$response->hasHeader('My-Custom-Header'); // will return true +``` + +> Note: My-Custom-Header was only added in the Response + +#### Getting comma-separated values from a header (also applies to request) + +```php +// getting value from request headers +$request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8" +// getting value from response headers +$response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message" +``` + +#### Getting array of value from a header (also applies to request) +```php +// getting value from request headers +$request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"] +// getting value from response headers +$response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"] +``` + +#### Removing headers from HTTP Messages +```php +// removing a header from Request, removing deprecated "Content-MD5" header +$request->withoutHeader('Content-MD5'); + +// removing a header from Response +// effect: the browser won't know the size of the stream +// the browser will download the stream till it ends +$response->withoutHeader('Content-Length'); +``` + +### Working with HTTP Message Body + +When working with the PSR-7 there are two methods of implementation: +#### 1. Getting the body separately + +> This method makes the body handling easier to understand and is useful when repeatedly calling body methods. (You only call `getBody()` once). Using this method mistakes like `$response->write()` are also prevented. + +```php +$body = $response->getBody(); +// operations on body, eg. read, write, seek +// ... +// replacing the old body +$response->withBody($body); +// this last statement is optional as we working with objects +// in this case the "new" body is same with the "old" one +// the $body variable has the same value as the one in $request, only the reference is passed +``` + +#### 2. Working directly on response + +> This method is useful when only performing few operations as the `$request->getBody()` statement fragment is required + +```php +$response->getBody()->write('hello'); +``` + +### Getting the body contents + +The following snippet gets the contents of a stream contents. +> Note: Streams must be rewinded, if content was written into streams, it will be ignored when calling `getContents()` because the stream pointer is set to the last character, which is `\0` - meaning end of stream. +```php +$body = $response->getBody(); +$body->rewind(); // or $body->seek(0); +$bodyText = $body->getContents(); +``` +> Note: If `$body->seek(1)` is called before `$body->getContents()`, the first character will be ommited as the starting pointer is set to `1`, not `0`. This is why using `$body->rewind()` is recommended. + +### Append to body + +```php +$response->getBody()->write('Hello'); // writing directly +$body = $request->getBody(); // which is a `StreamInterface` +$body->write('xxxxx'); +``` + +### Prepend to body +Prepending is different when it comes to streams. The content must be copied before writing the content to be prepended. +The following example will explain the behaviour of streams. + +```php +// assuming our response is initially empty +$body = $repsonse->getBody(); +// writing the string "abcd" +$body->write('abcd'); + +// seeking to start of stream +$body->seek(0); +// writing 'ef' +$body->write('ef'); // at this point the stream contains "efcd" +``` + +#### Prepending by rewriting separately + +```php +// assuming our response body stream only contains: "abcd" +$body = $response->getBody(); +$body->rewind(); +$contents = $body->getContents(); // abcd +// seeking the stream to beginning +$body->rewind(); +$body->write('ef'); // stream contains "efcd" +$body->write($contents); // stream contains "efabcd" +``` + +> Note: `getContents()` seeks the stream while reading it, therefore if the second `rewind()` method call was not present the stream would have resulted in `abcdefabcd` because the `write()` method appends to stream if not preceeded by `rewind()` or `seek(0)`. + +#### Prepending by using contents as a string +```php +$body = $response->getBody(); +$body->rewind(); +$contents = $body->getContents(); // efabcd +$contents = 'ef'.$contents; +$body->rewind(); +$body->write($contents); +``` diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/MessageInterface.php b/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/MessageInterface.php new file mode 100644 index 0000000000..a83c98518d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/MessageInterface.php @@ -0,0 +1,187 @@ +getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * While header names are not case-sensitive, getHeaders() will preserve the + * exact case in which headers were originally specified. + * + * @return string[][] Returns an associative array of the message's headers. Each + * key MUST be a header name, and each value MUST be an array of strings + * for that header. + */ + public function getHeaders(): array; + + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader(string $name): bool; + + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader(string $name): array; + + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * concatenated together using a comma. If the header does not appear in + * the message, this method MUST return an empty string. + */ + public function getHeaderLine(string $name): string; + + /** + * Return an instance with the provided value replacing the specified header. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withHeader(string $name, $value): MessageInterface; + + /** + * Return an instance with the specified header appended with the given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withAddedHeader(string $name, $value): MessageInterface; + + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader(string $name): MessageInterface; + + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody(): StreamInterface; + + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws \InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body): MessageInterface; +} diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/RequestInterface.php b/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/RequestInterface.php new file mode 100644 index 0000000000..33f85e559d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/RequestInterface.php @@ -0,0 +1,130 @@ +getQuery()` + * or from the `QUERY_STRING` server param. + * + * @return array + */ + public function getQueryParams(): array; + + /** + * Return an instance with the specified query string arguments. + * + * These values SHOULD remain immutable over the course of the incoming + * request. They MAY be injected during instantiation, such as from PHP's + * $_GET superglobal, or MAY be derived from some other value such as the + * URI. In cases where the arguments are parsed from the URI, the data + * MUST be compatible with what PHP's parse_str() would return for + * purposes of how duplicate query parameters are handled, and how nested + * sets are handled. + * + * Setting query string arguments MUST NOT change the URI stored by the + * request, nor the values in the server params. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated query string arguments. + * + * @param array $query Array of query string arguments, typically from + * $_GET. + * @return static + */ + public function withQueryParams(array $query): ServerRequestInterface; + + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles(): array; + + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface; + + /** + * Retrieve any parameters provided in the request body. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, this method MUST + * return the contents of $_POST. + * + * Otherwise, this method may return any results of deserializing + * the request body content; as parsing returns structured content, the + * potential types MUST be arrays or objects only. A null value indicates + * the absence of body content. + * + * @return null|array|object The deserialized body parameters, if any. + * These will typically be an array or object. + */ + public function getParsedBody(); + + /** + * Return an instance with the specified body parameters. + * + * These MAY be injected during instantiation. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, use this method + * ONLY to inject the contents of $_POST. + * + * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of + * deserializing the request body content. Deserialization/parsing returns + * structured data, and, as such, this method ONLY accepts arrays or objects, + * or a null value if nothing was available to parse. + * + * As an example, if content negotiation determines that the request data + * is a JSON payload, this method could be used to create a request + * instance with the deserialized parameters. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param null|array|object $data The deserialized body data. This will + * typically be in an array or object. + * @return static + * @throws \InvalidArgumentException if an unsupported argument type is + * provided. + */ + public function withParsedBody($data): ServerRequestInterface; + + /** + * Retrieve attributes derived from the request. + * + * The request "attributes" may be used to allow injection of any + * parameters derived from the request: e.g., the results of path + * match operations; the results of decrypting cookies; the results of + * deserializing non-form-encoded message bodies; etc. Attributes + * will be application and request specific, and CAN be mutable. + * + * @return array Attributes derived from the request. + */ + public function getAttributes(): array; + + /** + * Retrieve a single derived request attribute. + * + * Retrieves a single derived request attribute as described in + * getAttributes(). If the attribute has not been previously set, returns + * the default value as provided. + * + * This method obviates the need for a hasAttribute() method, as it allows + * specifying a default value to return if the attribute is not found. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute(string $name, $default = null); + + /** + * Return an instance with the specified derived request attribute. + * + * This method allows setting a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute(string $name, $value): ServerRequestInterface; + + /** + * Return an instance that removes the specified derived request attribute. + * + * This method allows removing a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute(string $name): ServerRequestInterface; +} diff --git a/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/StreamInterface.php b/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/StreamInterface.php new file mode 100644 index 0000000000..a62aabb828 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/psr/http-message/src/StreamInterface.php @@ -0,0 +1,158 @@ + + * [user-info@]host[:port] + * + * + * If the port component is not set or is the standard port for the current + * scheme, it SHOULD NOT be included. + * + * @see https://tools.ietf.org/html/rfc3986#section-3.2 + * @return string The URI authority, in "[user-info@]host[:port]" format. + */ + public function getAuthority(): string; + + /** + * Retrieve the user information component of the URI. + * + * If no user information is present, this method MUST return an empty + * string. + * + * If a user is present in the URI, this will return that value; + * additionally, if the password is also present, it will be appended to the + * user value, with a colon (":") separating the values. + * + * The trailing "@" character is not part of the user information and MUST + * NOT be added. + * + * @return string The URI user information, in "username[:password]" format. + */ + public function getUserInfo(): string; + + /** + * Retrieve the host component of the URI. + * + * If no host is present, this method MUST return an empty string. + * + * The value returned MUST be normalized to lowercase, per RFC 3986 + * Section 3.2.2. + * + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 + * @return string The URI host. + */ + public function getHost(): string; + + /** + * Retrieve the port component of the URI. + * + * If a port is present, and it is non-standard for the current scheme, + * this method MUST return it as an integer. If the port is the standard port + * used with the current scheme, this method SHOULD return null. + * + * If no port is present, and no scheme is present, this method MUST return + * a null value. + * + * If no port is present, but a scheme is present, this method MAY return + * the standard port for that scheme, but SHOULD return null. + * + * @return null|int The URI port. + */ + public function getPort(): ?int; + + /** + * Retrieve the path component of the URI. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * Normally, the empty path "" and absolute path "/" are considered equal as + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically + * do this normalization because in contexts with a trimmed base path, e.g. + * the front controller, this difference becomes significant. It's the task + * of the user to handle both "" and "/". + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.3. + * + * As an example, if the value should include a slash ("/") not intended as + * delimiter between path segments, that value MUST be passed in encoded + * form (e.g., "%2F") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.3 + * @return string The URI path. + */ + public function getPath(): string; + + /** + * Retrieve the query string of the URI. + * + * If no query string is present, this method MUST return an empty string. + * + * The leading "?" character is not part of the query and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.4. + * + * As an example, if a value in a key/value pair of the query string should + * include an ampersand ("&") not intended as a delimiter between values, + * that value MUST be passed in encoded form (e.g., "%26") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.4 + * @return string The URI query string. + */ + public function getQuery(): string; + + /** + * Retrieve the fragment component of the URI. + * + * If no fragment is present, this method MUST return an empty string. + * + * The leading "#" character is not part of the fragment and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.5. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.5 + * @return string The URI fragment. + */ + public function getFragment(): string; + + /** + * Return an instance with the specified scheme. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified scheme. + * + * Implementations MUST support the schemes "http" and "https" case + * insensitively, and MAY accommodate other schemes if required. + * + * An empty scheme is equivalent to removing the scheme. + * + * @param string $scheme The scheme to use with the new instance. + * @return static A new instance with the specified scheme. + * @throws \InvalidArgumentException for invalid or unsupported schemes. + */ + public function withScheme(string $scheme): UriInterface; + + /** + * Return an instance with the specified user information. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified user information. + * + * Password is optional, but the user information MUST include the + * user; an empty string for the user is equivalent to removing user + * information. + * + * @param string $user The user name to use for authority. + * @param null|string $password The password associated with $user. + * @return static A new instance with the specified user information. + */ + public function withUserInfo(string $user, ?string $password = null): UriInterface; + + /** + * Return an instance with the specified host. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified host. + * + * An empty host value is equivalent to removing the host. + * + * @param string $host The hostname to use with the new instance. + * @return static A new instance with the specified host. + * @throws \InvalidArgumentException for invalid hostnames. + */ + public function withHost(string $host): UriInterface; + + /** + * Return an instance with the specified port. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified port. + * + * Implementations MUST raise an exception for ports outside the + * established TCP and UDP port ranges. + * + * A null value provided for the port is equivalent to removing the port + * information. + * + * @param null|int $port The port to use with the new instance; a null value + * removes the port information. + * @return static A new instance with the specified port. + * @throws \InvalidArgumentException for invalid ports. + */ + public function withPort(?int $port): UriInterface; + + /** + * Return an instance with the specified path. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified path. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * If the path is intended to be domain-relative rather than path relative then + * it must begin with a slash ("/"). Paths not starting with a slash ("/") + * are assumed to be relative to some base path known to the application or + * consumer. + * + * Users can provide both encoded and decoded path characters. + * Implementations ensure the correct encoding as outlined in getPath(). + * + * @param string $path The path to use with the new instance. + * @return static A new instance with the specified path. + * @throws \InvalidArgumentException for invalid paths. + */ + public function withPath(string $path): UriInterface; + + /** + * Return an instance with the specified query string. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified query string. + * + * Users can provide both encoded and decoded query characters. + * Implementations ensure the correct encoding as outlined in getQuery(). + * + * An empty query string value is equivalent to removing the query string. + * + * @param string $query The query string to use with the new instance. + * @return static A new instance with the specified query string. + * @throws \InvalidArgumentException for invalid query strings. + */ + public function withQuery(string $query): UriInterface; + + /** + * Return an instance with the specified URI fragment. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified URI fragment. + * + * Users can provide both encoded and decoded fragment characters. + * Implementations ensure the correct encoding as outlined in getFragment(). + * + * An empty fragment value is equivalent to removing the fragment. + * + * @param string $fragment The fragment to use with the new instance. + * @return static A new instance with the specified fragment. + */ + public function withFragment(string $fragment): UriInterface; + + /** + * Return the string representation as a URI reference. + * + * Depending on which components of the URI are present, the resulting + * string is either a full URI or relative reference according to RFC 3986, + * Section 4.1. The method concatenates the various components of the URI, + * using the appropriate delimiters: + * + * - If a scheme is present, it MUST be suffixed by ":". + * - If an authority is present, it MUST be prefixed by "//". + * - The path can be concatenated without delimiters. But there are two + * cases where the path has to be adjusted to make the URI reference + * valid as PHP does not allow to throw an exception in __toString(): + * - If the path is rootless and an authority is present, the path MUST + * be prefixed by "/". + * - If the path is starting with more than one "/" and no authority is + * present, the starting slashes MUST be reduced to one. + * - If a query is present, it MUST be prefixed by "?". + * - If a fragment is present, it MUST be prefixed by "#". + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @return string + */ + public function __toString(): string; +} diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitattributes b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitattributes new file mode 100644 index 0000000000..44d5cff3a8 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitattributes @@ -0,0 +1,6 @@ +.gitattributes export-ignore +.gitignore export-ignore +.gitreview export-ignore +.travis.yml export-ignore +phpunit.xml export-ignore +tests/ export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitignore b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitignore new file mode 100644 index 0000000000..1324e7d3eb --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.gitignore @@ -0,0 +1,5 @@ +.idea +.DS_store +/vendor/ +composer.phar +composer.lock diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.travis.yml b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.travis.yml new file mode 100644 index 0000000000..c20956e05c --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/.travis.yml @@ -0,0 +1,18 @@ +language: php + +php: + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - 7.3 + +before_script: + - composer install + +script: + - mkdir -p build/logs + - php vendor/bin/phpunit -c phpunit.xml + +after_script: + - php vendor/bin/coveralls -v diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/LICENSE b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/LICENSE new file mode 100644 index 0000000000..be5540c2af --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/README.md b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/README.md new file mode 100644 index 0000000000..9430d76bbc --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/README.md @@ -0,0 +1,27 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) +[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +For PHP version **`>= 5.6`**: + +``` +composer require ralouphie/getallheaders +``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/composer.json b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/composer.json new file mode 100644 index 0000000000..de8ce62e45 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/composer.json @@ -0,0 +1,26 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/phpunit.xml b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/phpunit.xml new file mode 100644 index 0000000000..e90126d429 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/phpunit.xml @@ -0,0 +1,21 @@ + + + + ./tests + + + + + src + + + + + + + + \ No newline at end of file diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/src/getallheaders.php b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 0000000000..c7285a5ba1 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ + 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +} diff --git a/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/tests/GetAllHeadersTest.php b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/tests/GetAllHeadersTest.php new file mode 100644 index 0000000000..fb59597674 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/ralouphie/getallheaders/tests/GetAllHeadersTest.php @@ -0,0 +1,128 @@ + $val) { + $_SERVER[$key] = $val; + } + $result = getallheaders(); + $this->assertEquals($expected, $result, "Error testing $test_type works."); + // Clean up. + foreach ($server as $key => $val) { + unset($_SERVER[$key]); + } + } + + public function dataWorks() + { + return [ + [ + 'normal case', + [ + 'Key-One' => 'foo', + 'Key-Two' => 'bar', + 'Another-Key-For-Testing' => 'baz', + ], + [ + 'HTTP_KEY_ONE' => 'foo', + 'HTTP_KEY_TWO' => 'bar', + 'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz', + ], + ], + [ + 'Content-Type', + [ + 'Content-Type' => 'two', + ], + [ + 'HTTP_CONTENT_TYPE' => 'one', + 'CONTENT_TYPE' => 'two', + ], + ], + [ + 'Content-Length', + [ + 'Content-Length' => '222', + ], + [ + 'CONTENT_LENGTH' => '222', + 'HTTP_CONTENT_LENGTH' => '111', + ], + ], + [ + 'Content-Length (HTTP_CONTENT_LENGTH only)', + [ + 'Content-Length' => '111', + ], + [ + 'HTTP_CONTENT_LENGTH' => '111', + ], + ], + [ + 'Content-MD5', + [ + 'Content-Md5' => 'aef123', + ], + [ + 'CONTENT_MD5' => 'aef123', + 'HTTP_CONTENT_MD5' => 'fea321', + ], + ], + [ + 'Content-MD5 (HTTP_CONTENT_MD5 only)', + [ + 'Content-Md5' => 'f123', + ], + [ + 'HTTP_CONTENT_MD5' => 'f123', + ], + ], + [ + 'Authorization (normal)', + [ + 'Authorization' => 'testing', + ], + [ + 'HTTP_AUTHORIZATION' => 'testing', + ], + ], + [ + 'Authorization (redirect)', + [ + 'Authorization' => 'testing redirect', + ], + [ + 'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect', + ], + ], + [ + 'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)', + [ + 'Authorization' => 'Basic ' . base64_encode('foo:bar'), + ], + [ + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => 'bar', + ], + ], + [ + 'Authorization (PHP_AUTH_DIGEST)', + [ + 'Authorization' => 'example-digest', + ], + [ + 'PHP_AUTH_DIGEST' => 'example-digest', + ], + ], + ]; + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitattributes b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitattributes new file mode 100644 index 0000000000..825312826d --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitattributes @@ -0,0 +1 @@ +/.git* export-ignore diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/PULL_REQUEST_TEMPLATE.md b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..4689c4dad4 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Please do not submit any Pull Requests here. They will be closed. +--- + +Please submit your PR here instead: +https://github.com/symfony/symfony + +This repository is what we call a "subtree split": a read-only subset of that main repository. +We're looking forward to your PR there! diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/workflows/check-subtree-split.yml b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/workflows/check-subtree-split.yml new file mode 100644 index 0000000000..16be48bae3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.github/workflows/check-subtree-split.yml @@ -0,0 +1,37 @@ +name: Check subtree split + +on: + pull_request_target: + +jobs: + close-pull-request: + runs-on: ubuntu-latest + + steps: + - name: Close pull request + uses: actions/github-script@v6 + with: + script: | + if (context.repo.owner === "symfony") { + github.rest.issues.createComment({ + owner: "symfony", + repo: context.repo.repo, + issue_number: context.issue.number, + body: ` + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/symfony + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! + ` + }); + + github.rest.pulls.update({ + owner: "symfony", + repo: context.repo.repo, + pull_number: context.issue.number, + state: "closed" + }); + } diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitignore b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitignore new file mode 100644 index 0000000000..c49a5d8df5 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/CHANGELOG.md b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/CHANGELOG.md new file mode 100644 index 0000000000..7932e26132 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/LICENSE b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/LICENSE new file mode 100644 index 0000000000..0ed3a24655 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/README.md b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/README.md new file mode 100644 index 0000000000..9814864c03 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/README.md @@ -0,0 +1,26 @@ +Symfony Deprecation Contracts +============================= + +A generic function and convention to trigger deprecation notices. + +This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. + +By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, +the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. + +The function requires at least 3 arguments: + - the name of the Composer package that is triggering the deprecation + - the version of the package that introduced the deprecation + - the message of the deprecation + - more arguments can be provided: they will be inserted in the message using `printf()` formatting + +Example: +```php +trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); +``` + +This will generate the following message: +`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` + +While not recommended, the deprecation notices can be completely ignored by declaring an empty +`function trigger_deprecation() {}` in your application. diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/composer.json b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/composer.json new file mode 100644 index 0000000000..ceb6c07961 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/composer.json @@ -0,0 +1,35 @@ +{ + "name": "symfony/deprecation-contracts", + "type": "library", + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=8.1" + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + } +} diff --git a/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/function.php b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/function.php new file mode 100644 index 0000000000..2d56512ba3 --- /dev/null +++ b/code/web/Drivers/oauth2_client_php_league/symfony/deprecation-contracts/function.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (!function_exists('trigger_deprecation')) { + /** + * Triggers a silenced deprecation notice. + * + * @param string $package The name of the Composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string $message The message of the deprecation + * @param mixed ...$args Values to insert in the message using printf() formatting + * + * @author Nicolas Grekas + */ + function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void + { + @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); + } +} From 3abd48957ead02852a348af94138bea9873d1415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 12:25:57 +0000 Subject: [PATCH 02/12] DIS-65 chore: database updates --- code/web/services/API/SystemAPI.php | 4 +- .../sys/DBMaintenance/OCLCRSFG_updates.php | 114 ++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 code/web/sys/DBMaintenance/OCLCRSFG_updates.php diff --git a/code/web/services/API/SystemAPI.php b/code/web/services/API/SystemAPI.php index e605b57d7a..35c908ea7a 100644 --- a/code/web/services/API/SystemAPI.php +++ b/code/web/services/API/SystemAPI.php @@ -405,13 +405,15 @@ public function getDatabaseUpdates(): array { $webBuilderUpdates = getWebBuilderUpdates(); require_once ROOT_DIR . '/sys/DBMaintenance/grapes_web_builder_updates.php'; $grapesWebBuilderUpdates = getGrapesWebBuilderUpdates(); + require_once ROOT_DIR . '/sys/DBMaintenance/OCLCRSFG_updates.php'; + $oclcRSFGUpdates = getOclcRSFGUpdates(); require_once ROOT_DIR . '/sys/DBMaintenance/events_integration_updates.php'; $eventsIntegrationUpdates = getEventsIntegrationUpdates(); require_once ROOT_DIR . '/sys/DBMaintenance/file_upload_updates.php'; $fileUploadUpdates = getFileUploadUpdates(); $finalBaseUpdates = getFinalBaseUpdates(); - $baseUpdates = array_merge($initialUpdates, $library_location_updates, $postLibraryBaseUpdates, $user_updates, $grouped_work_updates, $genealogy_updates, $browse_updates, $collection_spotlight_updates, $indexing_updates, $overdrive_updates, $ebscoUpdates, $summonUpdates, $axis360Updates, $hoopla_updates, $rbdigital_updates, $sierra_api_updates, $theming_updates, $translation_updates, $open_archives_updates, $redwood_updates, $cloudLibraryUpdates, $websiteIndexingUpdates, $webBuilderUpdates, $grapesWebBuilderUpdates, $eventsIntegrationUpdates, $fileUploadUpdates, $finalBaseUpdates); + $baseUpdates = array_merge($initialUpdates, $library_location_updates, $postLibraryBaseUpdates, $user_updates, $grouped_work_updates, $genealogy_updates, $browse_updates, $collection_spotlight_updates, $indexing_updates, $overdrive_updates, $ebscoUpdates, $summonUpdates, $axis360Updates, $hoopla_updates, $rbdigital_updates, $sierra_api_updates, $theming_updates, $translation_updates, $open_archives_updates, $redwood_updates, $cloudLibraryUpdates, $websiteIndexingUpdates, $webBuilderUpdates, $grapesWebBuilderUpdates,$oclcRSFGUpdates, $eventsIntegrationUpdates, $fileUploadUpdates, $finalBaseUpdates); //Get version updates require_once ROOT_DIR . '/sys/Utils/StringUtils.php'; diff --git a/code/web/sys/DBMaintenance/OCLCRSFG_updates.php b/code/web/sys/DBMaintenance/OCLCRSFG_updates.php new file mode 100644 index 0000000000..4599b0b000 --- /dev/null +++ b/code/web/sys/DBMaintenance/OCLCRSFG_updates.php @@ -0,0 +1,114 @@ + [ + 'title' => 'Create OCLC Resource Sharing For Groups Module', + 'description' => 'Add OCLC Resource Sharing For Groups to the list of modules', + 'sql' => [ + "INSERT INTO modules (name) VALUES ('OCLC Resource Sharing For Groups')", + ], + ], + 'create_oclc_resource_sharing_for_groups_permissions' => [ + 'title' => 'Create OCLC Resource Sharing For Groups Permissions', + 'description' => 'Add an OCLC Resource Sharing For Groups permission section containing the permissions to do with this module', + 'sql' => [ + "INSERT INTO permissions (name, sectionName, requiredModule, weight, description) VALUES ( 'Administer OCLC Resource Sharing For Groups Settings','ILL Integration','OCLC Resource Sharing For Groups', 0, 'Allows the user to administer the integration with OCLC Resource Sharing For Groups')", + "INSERT INTO permissions (name, sectionName, requiredModule, weight, description) VALUES ( 'Administer OCLC Resource Sharing For Groups Forms','ILL Integration','OCLC Resource Sharing For Groups', 0, 'Allows the user to administer the OCLC Resource Sharing For Groups ILL request forms')", + "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='opacAdmin'), (SELECT id from permissions where name='Administer OCLC Resource Sharing For Groups Settings'))", + "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='opacAdmin'), (SELECT id from permissions where name='Administer OCLC Resource Sharing For Groups Forms'))", + ], + ], + 'create_oclc_resource_sharing_for_groups_form_table' => [ + 'title' => 'Add the OCLC Resource Sharing For Groups Form Table', + 'description' => 'Add a table to store the forms created by admins to keep track of which optional fields should be displayed', + 'sql' => [ + "CREATE TABLE oclc_resource_sharing_for_groups_form ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(50), + introText TEXT, + showAuthor BOOLEAN, + showEdition TINYINT(1) DEFAULT 0, + showPublisher TINYINT(1) DEFAULT 0, + showAcceptFee TINYINT(1) DEFAULT 0, + showMaximumFee TINYINT(1) DEFAULT 0, + feeInformationText TEXT + )" + ] + ], + 'add_oclc_resource_sharing_for_groups_settings_id_to_library' => [ + 'title' => 'Add OCLC Resource Sharing For Groups Settings Id To Library', + 'description' => 'Add an oclcRSFGSettingsId property to libraries so that they can be assigned the relevant OCLC Resource Sharing For Groups Setting', + 'sql' => [ + "ALTER TABLE library ADD oclcRSFGSettingsId INT NOT NULL DEFAULT -1", + ], + ], + 'add_oclc_resource_sharing_for_groups_form_id_to_library' => [ + 'title' => 'Add OCLC Resource Sharing For Groups Form Id To Library', + 'description' => 'Add an oclcRSFGFormId property to libraries so that they can be assigned the relevant OCLC Resource Sharing For Groups Form', + 'sql' => [ + "ALTER TABLE library ADD oclcRSFGFormId INT NOT NULL DEFAULT -1", + ], + ], + 'add_oclc_resource_sharing_for_groups_registry_id_to_location' => [ + 'title' => 'Add OCLC Resource Sharing For Groups Settings Id To Location', + 'description' => 'Add an oclcRegistryId property to locations to use when patrons submit, view, or manage ILL requests', + 'sql' => [ + "ALTER TABLE location ADD oclcRegistryId INT NOT NULL DEFAULT -1", + ], + ], + 'create_oclc_resource_sharing_for_groups_setting_table' => [ + 'title' => 'Add the OCLC Resource Sharing For Groups Setting Table', + 'description' => 'Add a table to store the different OCLC resource settings (profiles) so that different libraries in one Aspen system can have or share different settings', + 'sql' => [ + "CREATE TABLE oclc_resource_sharing_for_groups_setting ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(50), + clientKey VARCHAR(255) NOT NULL, + clientSecret VARCHAR(255) NOT NULL, + serviceBaseUrl VARCHAR(255) NOT NULL, + authBaseUrl VARCHAR(255) NOT NULL DEFAULT 'https://oauth.oclc.org/', + urlResourceOwnerDetails VARCHAR(255), + scopes VARCHAR(255) NOT NULL, + expirationDate DATETIME + )" + ], + ], + 'store_active_ill_requests' => [ + 'title' => 'Store Active ILL Requests', + 'description' => 'Add a database table to store the ILL requests made by a patron via the OCLC Resource Sharing Request API', + 'sql' => [ + "CREATE TABLE user_oclc_resource_sharing_for_groups_request ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + oclcRequesterRegistryId INT(11) DEFAULT NULL, + oclcRequestId INT UNIQUE DEFAULT NULL, + requestStatus VARCHAR(50), + requestStatusDescription VARCHAR(255) NULL, + createdDate DATETIME DEFAULT NULL, + verification VARCHAR(255), + needed DATETIME DEFAULT NULL, + serviceType VARCHAR(50), + userId INT(11) DEFAULT NULL, + email VARCHAR(255), + isbn VARCHAR(20) DEFAULT NULL, + issn VARCHAR(20) DEFAULT NULL, + oclcNumber VARCHAR(20) DEFAULT NULL, + mediaType VARCHAR(255) DEFAULT NULL, + title VARCHAR(255) DEFAULT NULL, + author VARCHAR(255) DEFAULT NULL, + edition VARCHAR(255) DEFAULT NULL, + publisher VARCHAR(255) DEFAULT NULL, + language VARCHAR(255) DEFAULT NULL, + feeAccepted TINYINT(1) DEFAULT NULL, + maximumFeeAmount VARCHAR(10) DEFAULT NULL, + catalogKey varchar(20) DEFAULT NULL, + note TEXT DEFAULT NULL, + pickupLocation VARCHAR(75) DEFAULT NULL, + datePlaced DATETIME DEFAULT CURRENT_TIMESTAMP() + )" + ], + ], + ]; +} From c2af6ccc992b40128bb4dfce91c28dde771f88e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 13:00:44 +0000 Subject: [PATCH 03/12] DIS-65 feat: Administer OCLC RSFG settings This enables admin with the right permissions to view existing Resource Sharing For Groups settings, export them as CSV, update them, delete them and create new ones. The above is pre-existent behaviour. This test plan aims to ensure that all functionalities normally present in Aspen (e.g for VDX) for settings Administration also work for the newly introduced Resource Sharing For Groups settings. Additionally, admininstrators will be able to assign an OCLC RegistryId to one or more locations. Test plan: - Ensure that the OCLC Resource Sharing For Groups module is enabled - Ensure that the admin user you are logged in has the Administer OCLC Resource Sharing For Groups Settings permission - Navigate to Aspen Administration > Interlibrary Loan - Select Resource Sharing For Groups Settings - Select 'Add New' - Name your form and select which fields you would like to see displayed on it - Save your changes - Return to the list of setting and notice that the one you created has been added - Create some more setting - Select one of them, edit it, save the changes - Batch update some of them - Batch delete some of them - Export CSV for one, some, all settings - Navigate to Primary Configuration > Locations - In the Interlibrary Loans section, notice there is now an OCLC Registry Id with a default value of -1 - Set it to a different value, save your changes, and notice that the entered value stills displays in the input field upon page reload --- .../services/OCLCRSFG/OCLCRSFGSettings.php | 84 ++++++++++ code/web/sys/LibraryLocation/Library.php | 30 ++++ code/web/sys/LibraryLocation/Location.php | 34 +++- code/web/sys/OCLCRSFG/OCLCRSFGSetting.php | 156 ++++++++++++++++++ 4 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 code/web/services/OCLCRSFG/OCLCRSFGSettings.php create mode 100644 code/web/sys/OCLCRSFG/OCLCRSFGSetting.php diff --git a/code/web/services/OCLCRSFG/OCLCRSFGSettings.php b/code/web/services/OCLCRSFG/OCLCRSFGSettings.php new file mode 100644 index 0000000000..a299e99091 --- /dev/null +++ b/code/web/services/OCLCRSFG/OCLCRSFGSettings.php @@ -0,0 +1,84 @@ +limit(($page - 1) * $recordsPerPage, $recordsPerPage); + $this->applyFilters($object); + $object->orderBy($this->getSort()); + $object->find(); + $objectList = []; + while ($object->fetch()) { + $objectList[$object->id] = clone $object; + } + return $objectList; + } + + function getDefaultSort(): string { + return 'id asc'; + } + + function getObjectStructure($context = ''): array { + return OCLCRSFGSetting::getObjectStructure($context); + } + + function getPrimaryKeyColumn(): string { + return 'id'; + } + + function getIdKeyColumn(): string { + return 'id'; + } + + function getAdditionalObjectActions($existingObject): array { + return []; + } + + function getInstructions(): string { + return ''; + } + + function getBreadcrumbs(): array { + $breadcrumbs = []; + $breadcrumbs[] = new Breadcrumb('/Admin/Home', 'Administration Home'); + $breadcrumbs[] = new Breadcrumb('/Admin/Home#ill_integration', 'Interlibrary Loan'); + $breadcrumbs[] = new Breadcrumb('/OCLCRSFG/OCLCRSFGSettings', 'OCLC Resource Sharing For Groups Settings'); + return $breadcrumbs; + } + + function getActiveAdminSection(): string { + return 'ill_integration'; + } + + function canView(): bool { + return UserAccount::userHasPermission([ + 'Administer OCLC Resource Sharing For Groups Settings', + ]); + } + + function canBatchEdit(): bool { + return UserAccount::userHasPermission([ + 'Administer OCLC Resource Sharing For Groups Settings', + ]); + } +} \ No newline at end of file diff --git a/code/web/sys/LibraryLocation/Library.php b/code/web/sys/LibraryLocation/Library.php index 9f0d3cbb43..fd9982ddd4 100644 --- a/code/web/sys/LibraryLocation/Library.php +++ b/code/web/sys/LibraryLocation/Library.php @@ -386,6 +386,9 @@ class Library extends DataObject { public $summonSettingsId; public $showAvailableCoversInSummon; + //OCLC Resource Sharing For Groups + public $oclcRSFGSettingsId; + //Combined Results (Bento Box) public /** @noinspection PhpUnused */ $enableCombinedResults; @@ -802,6 +805,15 @@ static function getObjectStructure($context = ''): array { $summonSettings[$summonSetting->id] = $summonSetting->name; } + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + $oclcRSFGSetting = new OCLCRSFGSetting(); + $oclcRSFGSetting->orderBy('name'); + $oclcRSFGSettings = []; + $oclcRSFGSetting->find(); + $oclcRSFGSettings[-1] = 'none'; + while ($oclcRSFGSetting->fetch()) { + $oclcRSFGSettings[$oclcRSFGSetting->id] = $oclcRSFGSetting->name; + } require_once ROOT_DIR . '/sys/Ebsco/EBSCOhostSetting.php'; $ebscohostSetting = new EBSCOhostSearchSetting(); @@ -3888,6 +3900,24 @@ static function getObjectStructure($context = ''): array { ], ], + 'oclcRSFGSection' => [ + 'property' => 'oclcRSFGSection', + 'type' => 'section', + 'label' => 'OCLC Resource Sharing For Groups', + 'hideInLists' => true, + 'renderAsHeading' => true, + 'properties' => [ + 'oclcRSFGSettingsId' => [ + 'property' => 'oclcRSFGSettingsId', + 'type' => 'enum', + 'values' => $oclcRSFGSettings, + 'label' => 'OCLC Resource Sharing For Groups Settings', + 'description' => 'Allow patrons of this library to make ILL requests through the OCLC Resource Sharing For Groups Settings selected', + 'hideInLists' => true, + 'default' => -1, + ], + ], + ], 'casSection' => [ 'property' => 'casSection', diff --git a/code/web/sys/LibraryLocation/Location.php b/code/web/sys/LibraryLocation/Location.php index 4f2f26a53e..a67ab56c46 100644 --- a/code/web/sys/LibraryLocation/Location.php +++ b/code/web/sys/LibraryLocation/Location.php @@ -97,6 +97,7 @@ class Location extends DataObject { public $vdxFormId; public $vdxLocation; public $localIllFormId; + public $oclcRegistryId; public $systemsToRepeatIn; public $homeLink; public $ptypesToAllowRenewals; @@ -277,6 +278,13 @@ static function getObjectStructure($context = ''): array { $localIllForms[$localIllForm->id] = $localIllForm->name; } + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + $oclcRSFGActive = false; + $oclcRSFGSettings = new OCLCRSFGSetting(); + if ($oclcRSFGSettings->find(true)) { + $oclcRSFGActive = true; + } + $hasScoping = false; $isKohaActive = false; foreach (UserAccount::getAccountProfiles() as $accountProfileInfo) { @@ -1084,6 +1092,13 @@ static function getObjectStructure($context = ''): array { 'description' => 'The form to use when submitting VDX requests', 'permissions' => ['Library ILL Options'], ], + 'oclcRegistryId' => [ + 'property' => 'oclcRegistryId', + 'type' => 'text', + 'label' => 'OCLC Registry Id', + 'description' => 'The Registry ID of your WorldShare institution', + 'maxLength' => 50, + ], ], ], ]; @@ -1467,9 +1482,17 @@ static function getObjectStructure($context = ''): array { unset($structure['curbsidePickupSettings']); } - if (!$vdxActive) { + if (!$vdxActive && !$oclcRSFGActive) { unset($structure['interLibraryLoanSection']['properties']['vdxFormId']); unset($structure['interLibraryLoanSection']['properties']['vdxLocation']); + unset($structure['interLibraryLoanSection']['properties']['oclcRegistryId']); + } + if (!$vdxActive) { + unset($structure['interLibraryLoanSection']['properties']['vdxLocation']); + unset($structure['interLibraryLoanSection']['properties']['vdxFormId']); + } + if (!$oclcRSFGActive) { + unset($structure['interLibraryLoanSection']['properties']['oclcRegistryId']); } return $structure; } @@ -3143,6 +3166,15 @@ function getInterlibraryLoanType(): string { return 'vdx'; } } + //Local ILL and VDX are not available, check to see if OCLC Resource Sharing For Groups is available. + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGForm.php'; + $oclcRSFGSettings = new OCLCRSFGSetting(); + $homeLibrary = Library::getActiveLibrary(); + $oclcRSFGSettings->whereAdd("id={$homeLibrary->oclcRSFGSettingsId}"); + if ($oclcRSFGSettings->find(true)) { + return 'oclc_resource_sharing_for_groups'; + } } catch (Exception $e) { //This happens if the tables aren't setup, ignore } diff --git a/code/web/sys/OCLCRSFG/OCLCRSFGSetting.php b/code/web/sys/OCLCRSFG/OCLCRSFGSetting.php new file mode 100644 index 0000000000..27706b773a --- /dev/null +++ b/code/web/sys/OCLCRSFG/OCLCRSFGSetting.php @@ -0,0 +1,156 @@ + [ + 'property' => 'id', + 'type' => 'label', + 'label' => 'Id', + 'description' => 'The unique id', + ], + 'name' => [ + 'property' => 'name', + 'type' => 'text', + 'label' => 'Name', + 'description' => 'The Name of this Setting Profile', + 'maxLength' => 50, + ], + 'clientKey' => [ + 'property' => 'clientKey', + 'type' => 'storedPassword', + 'label' => 'OCLC WSKey Client ID', + 'description' => 'The Client ID of the OCLC-issued WSKey to be used for authentication when making requests to Resource Sharing Requests APIs', + 'hideInLists' => true, + ], + 'clientSecret' => [ + 'property' => 'clientSecret', + 'type' => 'storedPassword', + 'label' => 'OCLC WSKey Secret', + 'description' => 'The Secret of the OCLC-issued WSKey to be used for authentication when making requests to Resource Sharing Requests APIs', + 'hideInLists' => true, + ], + 'serviceBaseUrl' => [ // may be redundant - might not change + 'property' => 'serviceBaseUrl', + 'type' => 'url', + 'label' => 'Resource Sharing API URL', + 'description' => 'The base URL of the Resource Sharing Requests API', + 'maxLength' => 255, + ], + 'authBaseUrl' => [ // may be redundant - will not change + 'property' => 'authBaseUrl', + 'type' => 'url', + 'label' => 'OCLC Authentication URL ', + 'description' => 'The base URL of the Resource Sharing Requests API', + 'maxLength' => 255, + 'default' => 'https://oauth.oclc.org/' + ], + 'scopes' => [ + 'property' => 'scopes', + 'label' => 'Allowed Request Types', + 'listStyle' => 'checkboxSimple', + 'type' => 'hidden', + 'description' => 'A list of the types of requests that can be made', + 'default' => 'resource-sharing:my-requests resource-sharing:create-requests resource-sharing:manage-requests resource-sharing:read-requests resource-sharing:search-requests', + ], + 'expirationDate' => [ + 'property' => 'expirationDate', + 'type' => 'date', + 'label' => 'WSKey Expiration Date', + 'description' => 'The data when the WSKey will expire. Format: MM/DD/YYYY', + ], + 'libraries' => [ + 'property' => 'libraries', + 'type' => 'multiSelect', + 'listStyle' => 'checkboxSimple', + 'label' => 'Libraries', + 'description' => 'Define libraries that use these settings', + 'values' => $libraryList, + 'hideInLists' => false, + ], + ]; + } + + public function __get($name) { + if ($name == 'libraries') { + if (!isset($this->_libraries) && $this->id) { + $this->_libraries = []; + $obj = new Library(); + $obj->oclcRSFGSettingsId = $this->id; + $obj->find(); + while ($obj->fetch()) { + $this->_libraries[$obj->libraryId] = $obj->libraryId; + } + } + return $this->_libraries; + } else { + return parent::__get($name); + } + } + + public function __set($name, $value) { + if ($name == 'libraries') { + $this->_libraries = $value; + } else { + parent::__set($name, $value); + } + } + + public function update($context = '') { + $ret = parent::update(); + if ($ret !== FALSE) { + $this->saveLibraries(); + } + return true; + } + + public function insert($context = '') { + $ret = parent::insert(); + if ($ret !== FALSE) { + $this->saveLibraries(); + } + return $ret; + } + + public function saveLibraries(): void { + if (!isset ($this->_libraries) || !is_array($this->_libraries)) { + return; + } + $libraryList = Library::getLibraryList(!UserAccount::userHasPermission('Administer All Libraries')); + foreach ($libraryList as $libraryId => $displayName) { + $library = new Library(); + $library->libraryId = $libraryId; + $library->find(true); + if (in_array($libraryId, $this->_libraries)) { + if ($library->oclcRSFGSettingsId != $this->id) { + $library->oclcRSFGSettingsId = $this->id; + $library->update(); + } + } else { + if ($library->oclcRSFGSettingsId == $this->id) { + $library->oclcRSFGSettingsId = -1; + $library->update(); + } + } + } + unset($this->_libraries); + } +} From 244a3a32b78d47515991cc345cd0f3a63e6f1ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 13:02:54 +0000 Subject: [PATCH 04/12] DIS-65 feat: Administer Resource Sharing For Groups Forms This enables admin with the right permissions to view existing Resource Sharing For Groups forms, export them as CSV, update them, delete them and create new ones. The above is pre-existent behaviour. This test plan aims to ensure that all functionalities normally present in Aspen (e.g for VDX) for form Administration also work for the newly introduced Resource Sharing For Groups forms. Test plan: - Ensure that the OCLC Resource Sharing For Groups module is enabled - Ensure that the admin user you are logged in has the Administer OCLC Resource Sharing For Groups Forms permission - Navigate to Aspen Administration > Interlibrary Loan - Select Resource Sharing For Groups Forms - Select 'Add New' - Name your form and select which fields you would like to see displayed on it - Save your changes - Return to the list of forms and notice that the one you created has been added - Create some more forms - Select one of them, edit it, save the changes - Batch update some of them - Batch delete some of them - Export CSV for one, some, all forms --- code/web/services/OCLCRSFG/OCLCRSFGForms.php | 76 ++++ code/web/sys/LibraryLocation/Library.php | 20 ++ code/web/sys/OCLCRSFG/OCLCRSFGForm.php | 354 +++++++++++++++++++ 3 files changed, 450 insertions(+) create mode 100644 code/web/services/OCLCRSFG/OCLCRSFGForms.php create mode 100644 code/web/sys/OCLCRSFG/OCLCRSFGForm.php diff --git a/code/web/services/OCLCRSFG/OCLCRSFGForms.php b/code/web/services/OCLCRSFG/OCLCRSFGForms.php new file mode 100644 index 0000000000..189fe204a2 --- /dev/null +++ b/code/web/services/OCLCRSFG/OCLCRSFGForms.php @@ -0,0 +1,76 @@ +limit(($page - 1) * $recordsPerPage, $recordsPerPage); + $this->applyFilters($object); + $object->orderBy($this->getSort()); + $object->find(); + $objectList = []; + while ($object->fetch()) { + $objectList[$object->id] = clone $object; + } + return $objectList; + } + + function getDefaultSort(): string { + return 'id asc'; + } + + function getObjectStructure($context = ''): array { + return OCLCRSFGForm::getObjectStructure($context); + } + + function getPrimaryKeyColumn(): string { + return 'id'; + } + + function getIdKeyColumn(): string { + return 'id'; + } + + function getBreadcrumbs(): array { + $breadcrumbs = []; + $breadcrumbs[] = new Breadcrumb('/Admin/Home', 'Administration Home'); + $breadcrumbs[] = new Breadcrumb('/Admin/Home#ill_integration', 'Interlibrary Loan'); + $breadcrumbs[] = new Breadcrumb('/OCLCRSFG/OCLCRSFGForms', 'OCLC Resource Sharing For Groups Forms'); + return $breadcrumbs; + } + + function getActiveAdminSection(): string { + return 'ill_integration'; + } + + function canView(): bool { + return UserAccount::userHasPermission([ + 'Administer OCLC Resource Sharing For Groups Forms', + ]); + } + + function canBatchEdit(): bool { + return UserAccount::userHasPermission([ + 'Administer OCLC Resource Sharing For Groups Forms', + ]); + } +} \ No newline at end of file diff --git a/code/web/sys/LibraryLocation/Library.php b/code/web/sys/LibraryLocation/Library.php index fd9982ddd4..0b488a4a56 100644 --- a/code/web/sys/LibraryLocation/Library.php +++ b/code/web/sys/LibraryLocation/Library.php @@ -388,6 +388,7 @@ class Library extends DataObject { //OCLC Resource Sharing For Groups public $oclcRSFGSettingsId; + public $oclcRSFGFormId; //Combined Results (Bento Box) public /** @noinspection PhpUnused */ @@ -815,6 +816,16 @@ static function getObjectStructure($context = ''): array { $oclcRSFGSettings[$oclcRSFGSetting->id] = $oclcRSFGSetting->name; } + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGForm.php'; + $oclcRSFGForm = new OCLCRSFGForm(); + $oclcRSFGForm->orderBy('name'); + $oclcRSFGForms = []; + $oclcRSFGForm->find(); + $oclcRSFGForms[-1] = 'none'; + while ($oclcRSFGForm->fetch()) { + $oclcRSFGForms[$oclcRSFGForm->id] = $oclcRSFGForm->name; + } + require_once ROOT_DIR . '/sys/Ebsco/EBSCOhostSetting.php'; $ebscohostSetting = new EBSCOhostSearchSetting(); $ebscohostSetting->orderBy('name'); @@ -3916,6 +3927,15 @@ static function getObjectStructure($context = ''): array { 'hideInLists' => true, 'default' => -1, ], + 'oclcRSFGFormsId' => [ + 'property' => 'oclcRSFGFormId', + 'type' => 'enum', + 'values' => $oclcRSFGForms, + 'label' => 'OCLC Resource Sharing For Groups Form', + 'description' => 'Allow patrons of this library to make ILL requests through the OCLC Resource Sharing For Groups Form selected', + 'hideInLists' => true, + 'default' => -1, + ], ], ], diff --git a/code/web/sys/OCLCRSFG/OCLCRSFGForm.php b/code/web/sys/OCLCRSFG/OCLCRSFGForm.php new file mode 100644 index 0000000000..3cc59171ee --- /dev/null +++ b/code/web/sys/OCLCRSFG/OCLCRSFGForm.php @@ -0,0 +1,354 @@ + [ + 'property' => 'id', + 'type' => 'label', + 'label' => 'Id', + 'description' => 'The unique id', + ], + 'name' => [ + 'property' => 'name', + 'type' => 'text', + 'label' => 'Name', + 'description' => 'The Name of the Form', + 'maxLength' => 50, + ], + 'introText' => [ + 'property' => 'introText', + 'type' => 'textarea', + 'label' => 'Intro Text', + 'description' => 'Introductory Text to be displayed at the top of the form', + 'maxLength' => 5000, + ], + 'showAuthor' => [ + 'property' => 'showAuthor', + 'type' => 'checkbox', + 'label' => 'Show Author?', + 'description' => 'Whether or not the user should be prompted to enter the author name', + ], + 'showPublisher' => [ + 'property' => 'showPublisher', + 'type' => 'checkbox', + 'label' => 'Show Publisher?', + 'description' => 'Whether or not the user should be prompted to enter the publisher name', + ], + 'showAcceptFee' => [ + 'property' => 'showAcceptFee', + 'type' => 'checkbox', + 'label' => 'Show Accept Fee?', + 'description' => 'Whether or not the user should be prompted to accept the fee (if any)', + ], + 'showMaximumFee' => [ + 'property' => 'showMaximumFee', + 'type' => 'checkbox', + 'label' => 'Show Maximum Fee?', + 'description' => 'Whether or not the user should be prompted for the maximum fee they will pay', + ], + 'feeInformationText' => [ + 'property' => 'feeInformationText', + 'type' => 'textarea', + 'label' => 'Fee Information Text', + 'description' => 'Text to be displayed to give additional information about the fees charged.', + 'maxLength' => 5000, + ], + 'libraries' => [ + 'property' => 'libraries', + 'type' => 'multiSelect', + 'listStyle' => 'checkboxSimple', + 'label' => 'Libraries', + 'description' => 'Define libraries that use these settings', + 'values' => $libraryList, + 'hideInLists' => false, + ], + ]; + } + + public function __get($name) { + if ($name == 'libraries') { + if (!isset($this->_libraries) && $this->id) { + $this->_libraries = []; + $obj = new Library(); + $obj->oclcRSFGSettingsId = $this->id; + $obj->find(); + while ($obj->fetch()) { + $this->_libraries[$obj->libraryId] = $obj->libraryId; + } + } + return $this->_libraries; + } else { + return parent::__get($name); + } + } + + public function __set($name, $value) { + if ($name == 'libraries') { + $this->_libraries = $value; + } else { + parent::__set($name, $value); + } + } + + public function update($context = '') { + $ret = parent::update(); + if ($ret !== FALSE) { + $this->saveLibraries(); + } + return true; + } + + public function insert($context = '') { + $ret = parent::insert(); + if ($ret !== FALSE) { + $this->saveLibraries(); + } + return $ret; + } + + public function saveLibraries(): void { + if (!isset ($this->_libraries) || !is_array($this->_libraries)) { + return; + } + $libraryList = Library::getLibraryList(!UserAccount::userHasPermission('Administer All Libraries')); + foreach ($libraryList as $libraryId => $displayName) { + $library = new Library(); + $library->libraryId = $libraryId; + $library->find(true); + if (in_array($libraryId, $this->_libraries)) { + if ($library->oclcRSFGSettingsId != $this->id) { + $library->oclcRSFGSettingsId = $this->id; + $library->update(); + } + } else { + if ($library->oclcRSFGSettingsId == $this->id) { + $library->oclcRSFGSettingsId = -1; + $library->update(); + } + } + } + unset($this->_libraries); + } + + public function getFormFields(?MarcRecordDriver $marcRecordDriver, ?string $volumeInfo = null): array { + $fields = []; + if ($this->introText) { + $fields['introText'] = [ + 'property' => 'introText', + 'type' => 'label', + 'label' => $this->introText, + 'description' => '', + ]; + } + require_once ROOT_DIR . '/sys/Utils/StringUtils.php'; + $fields['title'] = [ + 'property' => 'title', + 'type' => 'text', + 'label' => 'Title', + 'description' => 'The title of the title to be request', + 'maxLength' => 255, + 'required' => true, + 'default' => ($marcRecordDriver != null ? StringUtils::removeTrailingPunctuation($marcRecordDriver->getTitle()) : ''), + ]; + $fields['author'] = [ + 'property' => 'author', + 'type' => ($this->showAuthor ? 'text' : 'hidden'), + 'label' => 'Author', + 'description' => 'The author of the title to request', + 'maxLength' => 255, + 'required' => false, + 'default' => ($marcRecordDriver != null ? $marcRecordDriver->getAuthor() : ''), + ]; + $publisher = ''; + if ($marcRecordDriver != null) { + $publishers = $marcRecordDriver->getPublishers(); + if (count($publishers) > 0) { + $publisher = reset($publishers); + } + } + $fields['publisher'] = [ + 'property' => 'publisher', + 'type' => ($this->showPublisher ? 'text' : 'hidden'), + 'label' => 'Publisher', + 'description' => 'The publisher of the title to request', + 'maxLength' => 255, + 'required' => false, + 'default' => $publisher, + ]; + + // if an ISBN, ISSN, or OCLC number is present, pre-fill the field and only display this identifier + if ($marcRecordDriver != null) { + if (!empty($marcRecordDriver->getCleanISBN())) { + $fields['isbn'] = [ + 'property' => 'isbn', + 'type' => 'text', + 'label' => 'ISBN', + 'description' => 'The ISBN of the title to request', + 'maxLength' => 20, + 'required' => true, + 'default' => ($marcRecordDriver != null ? $marcRecordDriver->getCleanISBN() : ''), + ]; + } else if (!empty($marcRecordDriver->getISSNs())) { + $fields['issn'] = [ + 'property' => 'issn', + 'type' => 'text', + 'label' => 'ISBN', + 'description' => 'The ISSN of the title to request', + 'maxLength' => 20, + 'required' => true, + 'default' => ($marcRecordDriver != null ? $marcRecordDriver->getISSNs()[0] : ''), + ]; + } else if (!empty($oclcNumber != null)) { + /** @var File_MARC_Control_Field $oclcNumber */ + $oclcNumber = $marcRecordDriver->getMarcRecord()->getField('001'); + if ($oclcNumber != null) { + $oclcNumberString = StringUtils::truncate($oclcNumber->getData(), 50); + } else { + $oclcNumberString = ''; + } + $fields['oclcNumber'] = [ + 'property' => 'oclcNumber', + 'type' => 'text', + 'lable' => 'OCLC Number', + 'description' => 'The OCLC Number of the title to request', + 'maxLength' => 50, + 'required' => true, + 'default' => $oclcNumberString, + ]; + } else { + // if no ISBN, ISSN, or OCLC number are present, then let the user pick one and fill in the field + $fields['uniqueIdentifierKey'] = [ + 'property' => 'uniqueIdentifierKey', + 'type' => 'enum', + 'label' => 'Unique Record Identifier Key', + 'description' => 'Whether to use ISBN, ISSN, or OCLC Number to make the request', + 'required' => true, + 'values' => [ + 'isbn' => 'ISBN', + 'issn' => 'ISSN', + 'oclcNumber' => 'OCLC Number', + ], + 'default' => 'isbn', + ]; + $fields['uniqueIdentifierValue'] = [ + 'property' => 'uniqueIdentifierValue', + 'type' => 'text', + 'label' => 'Unique Record Identifier', + 'description' => 'The unique identifier number', + 'maxLength' => 20, + 'required' => true, + ]; + } + } else { + // if no Marc Record driver is found, then let the user pick whther to submit an ISBN, ISSN, or OCLC and fill in the field + $fields['uniqueIdentifierKey'] = [ + 'property' => 'uniqueIdentifierKey', + 'type' => 'enum', + 'label' => 'Unique Record Identifier Key', + 'description' => 'Whether to use ISBN, ISSN, or OCLC Number to make the request', + 'required' => true, + 'values' => [ + 'isbn' => 'ISBN', + 'issn' => 'ISSN', + 'oclcNumber' => 'OCLC Number' + ], + 'default' => 'isbn', + ]; + $fields['uniqueIdentifierValue'] = [ + 'property' => 'uniqueIdentifierValue', + 'type' => 'text', + 'label' => 'Unique Record Identifier', + 'description' => 'The unique identifier number', + 'maxLength' => 20, + 'required' => true, + ]; + } + + if ($this->showAcceptFee) { + $fields['feeInformationText'] = [ + 'property' => 'feeInformationText', + 'type' => 'label', + 'label' => $this->feeInformationText, + 'description' => '', + ]; + if ($this->showMaximumFee) { + $fields['maximumFeeAmount'] = [ + 'property' => 'maximumFeeAmount', + 'type' => 'currency', + 'label' => 'Maximum Fee ', + 'description' => 'The maximum fee you are willing to pay to have this title transferred to the library.', + 'default' => 0, + 'displayFormat' => '%0.2f', + ]; + $fields['acceptFee'] = [ + 'property' => 'acceptFee', + 'type' => 'checkbox', + 'label' => 'I will pay any fees associated with this request up to the maximum amount defined above', + 'description' => '', + ]; + } else { + $fields['acceptFee'] = [ + 'property' => 'acceptFee', + 'type' => 'checkbox', + 'label' => 'I will pay any fees associated with this request', + 'description' => '', + ]; + } + } + $user = UserAccount::getLoggedInUser(); + $locations = $user->getValidPickupBranches($user->getCatalogDriver()->accountProfile->recordSource); + $pickupLocations = []; + foreach ($locations as $key => $location) { + if ($location instanceof Location) { + $pickupLocations[$location->code] = $location->displayName; + } else { + if ($key == '0default') { + $pickupLocations[-1] = $location; + } + } + } + $fields['pickupLocation'] = [ + 'property' => 'pickupLocation', + 'type' => 'enum', + 'values' => $pickupLocations, + 'label' => 'Pickup Location', + 'description' => 'Where you would like to pickup the title', + 'required' => true, + 'default' => $user->getHomeLocationCode(), + ]; + $fields['note'] = [ + 'property' => 'note', + 'type' => 'textarea', + 'label' => 'Note', + 'description' => 'Any additional information you want us to have about this request', + 'required' => false, + 'default' => ($volumeInfo == null) ? '' : $volumeInfo, + ]; + $fields['catalogKey'] = [ + 'property' => 'catalogKey', + 'type' => 'hidden', + 'label' => 'Record Number', + 'description' => 'The record number to be requested', + 'maxLength' => 20, + 'required' => false, + 'default' => ($marcRecordDriver != null ? $marcRecordDriver->getId() : ''), + ]; + return $fields; + } +} \ No newline at end of file From d9098bd53c8a6d4693024e3f4a162b3a4dbcccf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 13:04:26 +0000 Subject: [PATCH 05/12] DIS-65 feat: Administer Resource Sharing For Groups Permissions Creates the two following permissions in the Interlibrary Loans section in Aspen Administration > System Administration > Permissions: - Administer OCLC Resource Sharing For Groups Settings - Administer OCLC Resource Sharing For Groups Forms Test plan: - ensure that the OCLC Resource Sharing For Groups is enabled in Aspen Administration > Systems Administration > Modules - navigate to Aspen Administration > System Administration > Permissions > Interlibrary Loans - notice the two new permissions - notice that these are enabled for opacAdmin --- code/web/sys/Account/User.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/web/sys/Account/User.php b/code/web/sys/Account/User.php index f2d5a35aa8..6a4e44fed2 100644 --- a/code/web/sys/Account/User.php +++ b/code/web/sys/Account/User.php @@ -4579,6 +4579,11 @@ public function getAdminActions() { $sections['aspen_lida']->addAction(new AdminAction('Self-Check Settings', 'Define settings for self-check in Aspen LiDA.', '/AspenLiDA/SelfCheckSettings'), 'Administer Aspen LiDA Self-Check Settings'); } + if (array_key_exists('OCLC Resource Sharing For Groups', $enabledModules)) { + $sections['ill_integration']->addAction(new AdminAction('Resource Sharing For Groups Settings', 'Manage connections to OCLC Resource Sharing For Groups for various profiles', '/OCLCRSFG/OCLCRSFGSettings'), 'Administer OCLC Resource Sharing For Groups Settings'); + $sections['ill_integration']->addAction(new AdminAction('Resource Sharing For Groups Forms', 'Create forms for patrons to use to submit an ILL by selecting the fields to be displayed', '/OCLCRSFG/OCLCRSFGForms'), 'Administer OCLC Resource Sharing For Groups Forms'); + } + $sections['support'] = new AdminSection('Aspen Discovery Support'); $sections['support']->addAction(new AdminAction('Request Tracker Settings', 'Define settings for a Request Tracker support system.', '/Support/RequestTrackerConnections'), 'Administer Request Tracker Connection'); try { From d18786f4274d37408ddbf73f381f4a278746fdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 13:30:49 +0000 Subject: [PATCH 06/12] DIS-65 feat: Display Pre-filled ILL Request Form Patrons that meet the following conditions will have the option to place ILL requests for some of the records found in catalogue search results. The patrons must: - be logged in - be on the website of their home library - have a home library that has been assigned an OCLC RSFG Setting in Aspen - have a home location that has been assigned an OCLC RegistryId in Aspen The 'Request' option will only appear for records that meet all the following criteria: - they are found within the Aspen System - no item for these records is available at the patron's home library - no item for these records is available at a library that shares a hold group with the patron's home library Set up: - ensure that the OCLC Setting, Form, and RegistryId have all been properly assigned and set up for the home library and location of the patron you will be testing as. - also ensure that the library site you will be visiting is one of a specific location (if using adb, it can be useful to set a library other than 'main library' as default). - start masquerading, or log in as this patron Test plan: - run a search - select 'Entire Collection' to view all results, including those for records not found at the patron's home library - in the results, find a record that is not available at the patron's home library (these will have a 'Available from another library' tag) - notice the 'Request' button on the record - select 'Request' and notice that a pop up opens containing a Request form - notice that most fields are pre-filled with the record's details and check this agains the marc record Note that: - the ISBN field only display for records with an ISBN - the ISSN field only displays for records with an ISSN - the OCLC number field only displays for records with an OCLC number - if none of these identifier numbers are found, two fields display instead: - a 'Unique Record Identifier Key' dropdown field displays with ISSN, ISBN, and OCLC number as available options - a 'Unique Record Identifer' input field displays - both of these are marked as required --- code/web/RecordDrivers/MarcRecordDriver.php | 2 + .../RecordDrivers/RecordActionGenerator.php | 16 +++ .../Record/oclc-rsfg-request-popup.tpl | 8 ++ .../interface/themes/responsive/js/aspen.js | 20 +++ .../themes/responsive/js/aspen/record.js | 20 +++ code/web/services/Record/AJAX.php | 124 ++++++++++++++++++ code/web/sys/User/CircEntry.php | 2 +- 7 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 code/web/interface/themes/responsive/Record/oclc-rsfg-request-popup.tpl diff --git a/code/web/RecordDrivers/MarcRecordDriver.php b/code/web/RecordDrivers/MarcRecordDriver.php index 48dcadc6c3..fdac9ea1f9 100644 --- a/code/web/RecordDrivers/MarcRecordDriver.php +++ b/code/web/RecordDrivers/MarcRecordDriver.php @@ -1196,6 +1196,8 @@ public function getRecordActions($relatedRecord, $variationId, $isAvailable, $is $this->_actions[$variationId][] = getVdxRequestAction($this->getModule(), $source, $id); } else if ($interLibraryLoanType == 'localIll') { $this->_actions[$variationId][] = getLocalIllRequestAction($this->getModule(), $source, $id); + } else if ($interLibraryLoanType == 'oclc_resource_sharing_for_groups') { + $this->_actions[$variationId][] = getOCLCRSFGRequestAction($this->getModule(), $source, $id); } } else { $this->_actions[$variationId][] = getHoldRequestAction($this->getModule(), $source, $id, $variationId); diff --git a/code/web/RecordDrivers/RecordActionGenerator.php b/code/web/RecordDrivers/RecordActionGenerator.php index 47f0cc7d21..cc4d6bc08a 100644 --- a/code/web/RecordDrivers/RecordActionGenerator.php +++ b/code/web/RecordDrivers/RecordActionGenerator.php @@ -93,6 +93,22 @@ function getVdxRequestAction($module, $source, $id) : array { ]; } +//OCLC RSFG (Resource Sharing For Groups) Requests +function getOCLCRSFGRequestAction($module, $source, $id) : array { + return [ + 'title' => translate([ + 'text' => 'Request', + 'isPublicFacing' => true, + ]), + 'url' => '', + 'id' => "actionButton$id", + 'onclick' => "return AspenDiscovery.Record.showOCLCRSFGRequest('$module', '$source', '$id');", + 'requireLogin' => false, + 'type' => 'OCLCRSFGRequest_request', + 'btnType' => 'btn-OCLCRSFGRequest-request btn-action' + ]; +} + //PDF Actions function getViewSinglePdfAction($fileId) : array { return [ diff --git a/code/web/interface/themes/responsive/Record/oclc-rsfg-request-popup.tpl b/code/web/interface/themes/responsive/Record/oclc-rsfg-request-popup.tpl new file mode 100644 index 0000000000..7133461d36 --- /dev/null +++ b/code/web/interface/themes/responsive/Record/oclc-rsfg-request-popup.tpl @@ -0,0 +1,8 @@ +{strip} +
+ {if !empty($fromHoldError)} +

{translate text='Sorry, we could not place a hold on that title for you. Would you like to make an Interlibrary Loan Request instead?' isPublicFacing='true'}

+ {/if} + {$rsfgFormFields} +
+{/strip} \ No newline at end of file diff --git a/code/web/interface/themes/responsive/js/aspen.js b/code/web/interface/themes/responsive/js/aspen.js index bf4f8b53ed..31a8613a98 100644 --- a/code/web/interface/themes/responsive/js/aspen.js +++ b/code/web/interface/themes/responsive/js/aspen.js @@ -14333,6 +14333,26 @@ AspenDiscovery.Record = (function () { return false; }, + showOCLCRSFGRequest: function(module, source, id) { + if (Globals.loggedIn){ + document.body.style.cursor = "wait"; + var url = Globals.path + "/" + module + "/" + "AJAX?method=getOCLCRSFGRequestForm&recordSource=" + source + "&id=" + id; + $.getJSON(url, function(data){ + document.body.style.cursor = "default"; + if (data.success) { + AspenDiscovery.showMessageWithButtons(data.title, data.modalBody, data.modalButtons); + } else { + AspenDiscovery.showMessage(data.title, data.message); + } + }).fail(AspenDiscovery.ajaxFail); + }else{ + AspenDiscovery.Account.ajaxLogin(null, function(){ + AspenDiscovery.Record.showOCLCRSFGRequest(module, source, id); + }, false); + } + return false; + }, + showPlaceHoldEditions: function (module, source, id, volume, variationId) { if (Globals.loggedIn) { var url = Globals.path + "/" + module + "/" + id + "/AJAX?method=getPlaceHoldEditionsForm&recordSource=" + source; diff --git a/code/web/interface/themes/responsive/js/aspen/record.js b/code/web/interface/themes/responsive/js/aspen/record.js index 0a023ee9b2..9b53ebf122 100644 --- a/code/web/interface/themes/responsive/js/aspen/record.js +++ b/code/web/interface/themes/responsive/js/aspen/record.js @@ -185,6 +185,26 @@ AspenDiscovery.Record = (function () { return false; }, + showOCLCRSFGRequest: function(module, source, id) { + if (Globals.loggedIn){ + document.body.style.cursor = "wait"; + var url = Globals.path + "/" + module + "/" + "AJAX?method=getOCLCRSFGRequestForm&recordSource=" + source + "&id=" + id; + $.getJSON(url, function(data){ + document.body.style.cursor = "default"; + if (data.success) { + AspenDiscovery.showMessageWithButtons(data.title, data.modalBody, data.modalButtons); + } else { + AspenDiscovery.showMessage(data.title, data.message); + } + }).fail(AspenDiscovery.ajaxFail); + }else{ + AspenDiscovery.Account.ajaxLogin(null, function(){ + AspenDiscovery.Record.showOCLCRSFGRequest(module, source, id); + }, false); + } + return false; + }, + showPlaceHoldEditions: function (module, source, id, volume, variationId) { if (Globals.loggedIn) { var url = Globals.path + "/" + module + "/" + id + "/AJAX?method=getPlaceHoldEditionsForm&recordSource=" + source; diff --git a/code/web/services/Record/AJAX.php b/code/web/services/Record/AJAX.php index d43ca56c1e..d8f5ad2335 100644 --- a/code/web/services/Record/AJAX.php +++ b/code/web/services/Record/AJAX.php @@ -376,6 +376,130 @@ function submitLocalIllRequest(): array { return $results; } + function getOCLCRSFGRequestForm() { + global $interface; + if (UserAccount::isLoggedIn()) { + $user = UserAccount::getLoggedInUser(); + $id = $_REQUEST['id']; + if (strpos($id, ':') > 0) { + [ + , + $id, + ] = explode(':', $id); + } + $recordSource = $_REQUEST['recordSource']; + $interface->assign('recordSource', $recordSource); + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGForm.php'; + $OCLCRSFGSettings = new OCLCRSFGSetting(); + $activeLibrary = Library::getActiveLibrary(); + $OCLCRSFGSettings->whereAdd("id=" . $activeLibrary->oclcRSFGSettingsId); + if ($OCLCRSFGSettings->find(true)) { + if ($activeLibrary != null) { + $rsfgForm = new OCLCRSFGForm(); + $rsfgForm->id = $activeLibrary->OCLCRSFGFormId; + if ($rsfgForm->find(true)) { + $accountSummary = $user->getAccountSummary(); + if ($accountSummary->isExpired()) { + $results = [ + 'title' => translate([ + 'text' => 'Request Title', + 'isPublicFacing' => true, + ]), + 'modalBody' => translate([ + 'text' => 'Your account is not eligible to request titles from other libraries. Please visit the library to renew your account.', + 'isPublicFacing' => true, + ]), + 'modalButtons' => '', + 'success' => true, + ]; + } elseif ($user->isBlockedFromIllRequests()) { + $results = [ + 'title' => translate([ + 'text' => 'Request Title', + 'isPublicFacing' => true, + ]), + 'modalBody' => translate([ + 'text' => 'Your account is not eligible to request titles from other libraries. Please visit the library to update your account.', + 'isPublicFacing' => true, + ]), + 'modalButtons' => '', + 'success' => true, + ]; + } else { + $marcRecord = new MarcRecordDriver($id); + $interface->assign('OCLCRSFGForm', $rsfgForm); + $rsfgFormFields = $rsfgForm->getFormFields($marcRecord); + $interface->assign('structure', $rsfgFormFields); + $interface->assign('rsfgFormFields', $interface->fetch('DataObjectUtil/ajaxForm.tpl')); + $results = [ + 'title' => translate([ + 'text' => 'Request Title', + 'isPublicFacing' => true, + ]), + 'modalBody' => $interface->fetch("Record/oclc-rsfg-request-popup.tpl"), + 'modalButtons' => '' . translate([ + 'text' => 'Place Request', + 'isPublicFacing' => true, + ]) . '', + 'success' => true, + ]; + } + } else { + $results = [ + 'title' => translate([ + 'text' => 'Invalid Configuration', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Unable to find the specified form.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + } else { + $results = [ + 'title' => translate([ + 'text' => 'Invalid Configuration', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Unable to determine home library to place request from.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + } else { + $results = [ + 'title' => translate([ + 'text' => 'Invalid Configuration', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => " Settings do not exist, please contact the library to make a request.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + } else { + $results = [ + 'title' => translate([ + 'text' => 'Please login', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "You must be logged in. Please close this dialog and login before placing your request.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + return $results; + + } /** @noinspection PhpUnused */ function getPlaceHoldForm() { global $interface; diff --git a/code/web/sys/User/CircEntry.php b/code/web/sys/User/CircEntry.php index cb8f6b2a2f..6b36eeee25 100644 --- a/code/web/sys/User/CircEntry.php +++ b/code/web/sys/User/CircEntry.php @@ -25,7 +25,7 @@ function objectHistoryEnabled() : bool { */ public function getRecordDriver() : GroupedWorkSubDriver|false { if ($this->_recordDriver == null) { - if ($this->type == 'ils') { + if ($this->type == 'ils' || ($this->type == 'interlibrary_loan' && $this->source == 'oclcRSFG')) { require_once ROOT_DIR . '/RecordDrivers/MarcRecordDriver.php'; $this->_recordDriver = new MarcRecordDriver($this->recordId); if (!$this->_recordDriver->isValid()) { From 56b7bd1f55ad0511b8617a04ff9169f2ba287be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 13:42:42 +0000 Subject: [PATCH 07/12] DIS-65 feat: Submit RS4G ILL Request Allow a patron meeting the requirements (see the previous commit for details) to place an ILL request through the Resource Sharing API. This assumes that: - the OCLC RSFG integration in Aspen has been set up - the tester is logged in / masquerading as a patron of a library with an OCLC RSFG Setting assigned to it, and has a home location with an OCLC registryId assigned to it Test plan: - run a catologue search to find a record showing as 'Available from another library' and for which a 'Request' button is available - select 'Request', and check that all required fields are pre-filled in the form that pops up (if not, fill in any missing information) - select 'Submit' - notice the success message - allow 2-3 minutes for the request to have reached OCLC and be ready to view - Navigate to 'Titles On Hold' > 'Interlibrary Loans' - Select 'Refresh' - Notice that the record you requested now displays both under the 'all' and the 'Interlibrary Loans' type - Also notice that the number displayed next to 'all' and 'Interlibrary Loans' has been increased by 1 --- code/web/Drivers/OCLCRSFGDriver.php | 360 ++++++++++++++++++ .../interface/themes/responsive/js/aspen.js | 36 ++ .../themes/responsive/js/aspen/record.js | 36 ++ code/web/services/Record/AJAX.php | 41 ++ code/web/sys/OCLCRSFG/OCLCRSFGRequest.php | 31 ++ 5 files changed, 504 insertions(+) create mode 100644 code/web/Drivers/OCLCRSFGDriver.php create mode 100644 code/web/sys/OCLCRSFG/OCLCRSFGRequest.php diff --git a/code/web/Drivers/OCLCRSFGDriver.php b/code/web/Drivers/OCLCRSFGDriver.php new file mode 100644 index 0000000000..4723f362f3 --- /dev/null +++ b/code/web/Drivers/OCLCRSFGDriver.php @@ -0,0 +1,360 @@ +_registryId = $homeLocation ? $homeLocation->oclcRegistryId : "" ; + } + + // Controllers + public function submitRequest(OCLCRSFGSetting $setting, User $patron, $requestFormData): array { + global $logger; + if (empty($this->_registryId)) { + $logger->log("Could not Authenticate: home location has not been assigned an OCLC Registry Id", Logger::LOG_ERROR); + throw new Exception("This library branch is not configured to send ILL requests. Please contact your library."); + } + + try { + if (empty($this->accessToken) || time() > $this->accessToken->expires) { + $this->setAccessToken($setting); + } + } catch (Exception $e) { + global $logger; + $logger->log("Exception conducting pre-submission checks for an ILL request to the Resource Sharing Requests API: $e", Logger::LOG_DEBUG); + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Could not send request to the Resource Sharing For Groups system.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + + $requestInAspenDb = new OCLCRSFGRequest(); + $this->populateNewRequest($requestInAspenDb, $requestFormData, $patron); + + if ($this->isDuplicate($setting, $patron->id, $requestInAspenDb)) { + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "This title has already been requested for you. You may only have one active request for a title.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + $requestInAspenDb->insert(); + try { + $IllRequestCreated = $this->postToOCLCRSFG($setting->serviceBaseUrl, $requestInAspenDb); + $requestInAspenDb->requestStatus = $IllRequestCreated['responses']['illRequest']['requestStatus']; + $requestInAspenDb->oclcRequestId = $IllRequestCreated['responses']['illRequest']['requestId']; + } catch (Exception $e) { + global $logger; + $logger->log("Exception submitting an ILL request to the Resource Sharing Requests API: $e", Logger::LOG_ERROR); + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Could not send request to the Resource Sharing For Groups system.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + $requestInAspenDb->update(); + return [ + 'title' => translate([ + 'text' => 'Request Sent', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Your request has been submitted. You can check the status of your request within your account under Titles On Hold. Please allow for a few minutes before refreshing the page to see your new interlibrary loan request.", + 'isPublicFacing' => true, + ]), + 'success' => true, + ]; + } + + private function isDuplicate(OCLCRSFGSetting $setting, Int $patronId, OCLCRSFGRequest $requestInAspenDb): bool { + $this->updateRequestsInAspenDbForPatron($setting, $patronId); + $existingRequests = $this->getAllRequestsFromAspenDbForPatron($patronId); + foreach ($existingRequests as $existingRequest) { + if (!$existingRequest->catalogKey) { + return false; + } + if ( + $requestInAspenDb->catalogKey == $existingRequest->catalogKey + && $existingRequest->requestStatus != "RETURNED" + && $existingRequest->requestStatus != "CLOSED" + ) { + return true; + } + } + return false; + } + + public function updateRequestsInAspenDbForPatron(OCLCRSFGSetting $setting, int $patronId): array { + try { + if (empty($this->accessToken)) { + $this->setAccessToken($setting); + } + } catch (Exception $e) { + global $logger; + $logger->log("Exception conducting pre-submission checks for an ILL request to the Resource Sharing Requests API: $e", Logger::LOG_ERROR); + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Could not send request to the Resource Sharing For Groups system.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + + if (empty($this->_registryId)) { + global $logger; + $logger->log("Could not Authenticate: home location has not been assigned an OCLC Registry Id", Logger::LOG_ERROR); + throw new Exception("This library branch is not configured to send ILL requests. Please contact your library."); + } + + $requests = $this->getAllRequestsFromOCLCRSFGForPatron($setting, $patronId); + + foreach ($requests as $requestInOCLCRSFG) { + $requestInAspenDb = new OCLCRSFGRequest(); + if (!empty($requestInOCLCRSFG)) { + $this->updateRequestInAspenDb($requestInAspenDb, $requestInOCLCRSFG); + } + } + + return $requests; + } + + // Services - interacts with Aspen DB + + private function getAllRequestsFromAspenDbForPatron(Int $patronId): array { + $requestsToProcess = []; + $request = new OCLCRSFGRequest(); + $request->userId = $patronId; + $request->find(); + while ($request->fetch()) { + if (empty($request->vdxId) && ($request->status != 'Not found in OCLC Resource Sharing For Groups' && $request->status != 'CANCELLED')) { + $requestsToProcess[] = clone $request; + } + } + return $requestsToProcess; + } + + private function updateRequestInAspenDb(OCLCRSFGRequest $requestInAspenDb, $request): void { + if (!isset($request['illRequest']['requestId'])) { + return; + } + $requestInAspenDb->oclcRequestId = $request['illRequest']['requestId']; + if (!$requestInAspenDb->find(true)) { + return; + } + + // as of now, OCLC RS API will send back all requests, regardless of status. + if(isset($request['illRequest']['requestStatus']) && $request['illRequest']['requestStatus'] == "CLOSED") { + $requestInAspenDb->whereAdd('oclcRequestId=' . $request['illRequest']['requestId']); + $requestInAspenDb->delete(true); + return; + } + + if (isset($request['illRequest']['requestStatus'])) { + $requestInAspenDb->requestStatus = $request['illRequest']['requestStatus']; + } + if (isset($request['illRequest']['requestStatusDescription'])) { + $requestInAspenDb->requestStatusDescription = $request['illRequest']['requestStatusDescription']; + } + if (isset($request['illRequest']['created'])) { + $requestInAspenDb->createdDate = date_format(date_create($request['illRequest']['created']), 'Y-m-d g:i:s.u'); + } + if (isset($request['illRequest']['verification'])) { + $requestInAspenDb->verification = $request['illRequest']['verification']; + } + if (isset($request['illRequest']['needed'])) { + $requestInAspenDb->needed = date_format(date_create($request['illRequest']['needed']), 'Y-m-d g:i:s.u'); + } + if (isset($request['illRequest']['requester']['serviceType'])) { + $requestInAspenDb->serviceType = $request['illRequest']['requester']['serviceType']; + } + if (isset($request['illRequest']['item']['userId'])) { + $requestInAspenDb->userId = $request['illRequest']['item']['userId']; + } + if (isset($request['illRequest']['item']['email'])) { + $requestInAspenDb->email = $request['illRequest']['item']['email']; + } + if (isset($request['illRequest']['item']['isbn'])) { + $requestInAspenDb->isbn = $request['illRequest']['item']['isbn']; + } + if (isset($request['illRequest']['item']['issn'])) { + $requestInAspenDb->issn = $request['illRequest']['item']['issn']; + } + if (isset($request['illRequest']['item']['oclcNumber'])) { + $requestInAspenDb->oclcNumber = $request['illRequest']['item']['oclcNumber']; + } + if (isset($request['illRequest']['item']['mediaType'])) { + $requestInAspenDb->mediaType = $request['illRequest']['item']['mediaType']; + } + if (isset($request['illRequest']['item']['title'])) { + $requestInAspenDb->title = $request['illRequest']['item']['title']; + } + if (isset($request['illRequest']['item']['author'])) { + $requestInAspenDb->author = $request['illRequest']['item']['author']; + } + if (isset($request['illRequest']['item']['edition']['editionSpecific'])) { + $requestInAspenDb->edition = $request['illRequest']['item']['edition']['editionSpecific']; + } + if (isset($request['illRequest']['item']['publisherName'])) { + $requestInAspenDb->publisher = $request['illRequest']['item']['publisherName']; + } + if (isset($request['illRequest']['item']['language'])) { + $requestInAspenDb->language = $request['illRequest']['item']['language']; + } + if (isset($request['illRequest']['feeAccepted'])) { + $requestInAspenDb->feeAccepted = $request['illRequest']['feeAccepted']; + } + if (isset($request['illRequest']['maximumFeeAmount'])) { + $requestInAspenDb->maximumFeeAmount = $request['illRequest']['maximumFeeAmount']; + } + if (isset($request['illRequest']['catalogKey'])) { + $requestInAspenDb->catalogKey = $request['illRequest']['catalogKey']; + } + if (isset($request['illRequest']['note'])) { + $requestInAspenDb->note = $request['illRequest']['note']; + } + if (isset($request['illRequest']['pickupLocation'])) { + $requestInAspenDb->pickupLocation = $request['illRequest']['pickupLocation']; + } + + $requestInAspenDb->update(); + } + + // Services - interacts with the Resource Sharing Request API from OCLC + + private function getAllRequestsFromOCLCRSFGForPatron(OCLCRSFGSetting $setting, Int $patronId): array { + require_once ROOT_DIR . '/sys/CurlWrapper.php'; + $searchTerm = "searchTerm=patronID"; + $searchValue = "searchValue=" . "$patronId"; + $url = $setting->serviceBaseUrl . "/requests" . "?" . $searchTerm . "&" . $searchValue; + $curl = new CurlWrapper(); + $customHeaders = [ + "Authorization" => "Authorization: Bearer " . $this->accessToken->getToken(), + ]; + $curl->addCustomHeaders($customHeaders, false); + $curl->curl_connect($url); + $response = $curl->curlGetPage($url); + return json_decode(json_encode(simplexml_load_string($response)), true)['responses']; + } + + private function postToOCLCRSFG(string $serviceBaseUrl, OCLCRSFGRequest $newRequest): array { + require_once ROOT_DIR . '/sys/CurlWrapper.php'; + $url = $serviceBaseUrl . "/requests"; + $curl = new CurlWrapper(); + $customHeaders = [ + "Content-type" => "Content-type: application/json", + "Authorization" => "Authorization: Bearer " . $this->accessToken->getToken(), + ]; + $curl->addCustomHeaders($customHeaders, false); + $curl->curl_connect($url); + $response = $curl->curlPostBodyData($url, $this->formatRequestBody($newRequest)); + try { + $data = json_decode(json_encode(simplexml_load_string($response)), true); + } catch (Exception $e) { + throw new Exception($e->getMessage()); + } + return $data; + } + + private function setAccessToken(OCLCRSFGSetting $setting): void { + require_once 'oauth2_client_php_league/autoload.php'; + $basicAuth_provider = new HttpBasicAuthOptionProvider(); + $setup_options = [ + 'clientId' => $setting->clientKey, + 'clientSecret' => $setting->clientSecret, + 'urlAuthorize' => $setting->authBaseUrl . "auth", // not used for this grant type yet field still required - could set to '' + 'urlAccessToken' => $setting->authBaseUrl . "token", + 'urlResourceOwnerDetails' => '', + 'redirectUri' => '', + ]; + $provider = new GenericProvider($setup_options, ['optionProvider' => $basicAuth_provider]); + try { + $this->accessToken = $provider->getAccessToken('client_credentials', ['scope' => $setting->scopes . " context:" . $this->_registryId]); + return; + } catch (IdentityProviderException $e) { + throw new Exception($e->getMessage()); + }; + } + + // Helpers + private function formatRequestBody(OCLCRSFGRequest $newRequest): object { + $illRequest = []; + $illRequest["requestStatus"] = "PROFILING"; + $illRequest["requester"] = [ + "institution" => [ + "institutionId" => $newRequest->oclcRequesterRegistryId + ], + "serviceType" => "LOAN", + ]; + $illRequest["item"] = [ + "verification" => "item discovered on Aspen Discovery" + ]; + if (!empty($newRequest->isbn)) { + $illRequest["item"]["isbn"] = $newRequest->isbn; + } + if (!empty($newRequest->issn)) { + $illRequest["item"]["issn"] = $newRequest->issn; + } + if (!empty($newRequest->oclcNumber)) { + $illRequest["item"]["oclcNumber"] = $newRequest->oclcNumber; + } + $illRequest["patron"] = [ + "patronApproved" => true, + "userId" => "{$newRequest->userId}" + ]; + return (object)["illRequest" => $illRequest]; + } + + private function populateNewRequest(OCLCRSFGRequest $requestInAspenDb, &$requestFormData, User $patron): void { + $requestInAspenDb->title = isset($requestFormData["title"]) ? strip_tags($requestFormData["title"]) : ""; + $requestInAspenDb->author = isset($requestFormData["author"]) ? strip_tags($requestFormData["author"]): ""; + $requestInAspenDb->publisher = isset($requestFormData["publisher"]) ? strip_tags($requestFormData["publisher"]) : ""; + $requestInAspenDb->isbn = isset($requestFormData["isbn"]) ? strip_tags($requestFormData["isbn"]) : ""; + $requestInAspenDb->issn = isset($requestFormData["issn"]) ? strip_tags($requestFormData["issn"]) : ""; + $requestInAspenDb->oclcNumber = isset($requestFormData["oclcNumber"]) ? strip_tags($requestFormData["oclcNumber"]) : ""; + if (isset($requestFormData["uniqueIdentifierKey"]) && isset($requestFormData["uniqueIdentifierValue"])) { + $requestInAspenDb->{$requestFormData["uniqueIdentifierKey"]} = $requestFormData["uniqueIdentifierValue"]; + } + $requestInAspenDb->feeAccepted = (isset($requestFormData['acceptFee']) && $requestFormData['acceptFee'] == 'true') ? 1 : 0; + $requestInAspenDb->maximumFeeAmount = isset($requestFormData["maximumFeeAmount"]) ? strip_tags($requestFormData["maximumFeeAmount"]) : ""; + $requestInAspenDb->catalogKey = isset($requestFormData["catalogKey"]) ? strip_tags($requestFormData["catalogKey"]) : ""; + $requestInAspenDb->requestStatus = "NEW"; + $requestInAspenDb->note = isset($requestFormData["note"]) ? strip_tags($requestFormData["note"]) : ""; + $requestInAspenDb->oclcRequesterRegistryId = $this->_registryId; + $requestInAspenDb->userId = $patron->id; + $patronHomeLocation = $patron->getHomeLocation(); + $requestInAspenDb->pickupLocation = empty($patronHomeLocation->oclcRSFGLocation) ? $patronHomeLocation->code : $patronHomeLocation->oclcRSFGLocation; + } +} diff --git a/code/web/interface/themes/responsive/js/aspen.js b/code/web/interface/themes/responsive/js/aspen.js index 31a8613a98..98f675521a 100644 --- a/code/web/interface/themes/responsive/js/aspen.js +++ b/code/web/interface/themes/responsive/js/aspen.js @@ -14353,6 +14353,42 @@ AspenDiscovery.Record = (function () { return false; }, + submitOCLCRSFGRequest: function(module, id) { + if (Globals.loggedIn){ + document.body.style.cursor = "wait"; + var params = { + 'method': 'submitOCLCRSFGRequest', + title: $('#title').val(), + author: $('#author').val(), + publisher: $('#publisher').val(), + isbn: $('#isbn').val(), + issn: $('#issn').val(), + oclcNumber: $('#oclcNumber').val(), + uniqueIdentifierKey: $('#uniqueIdentifierKeySelect').val(), + uniqueIdentifierValue: $('#uniqueIdentifierValue').val(), + maximumFeeAmount: $('#maximumFeeAmount').val(), + acceptFee: $('#acceptFee').prop('checked'), + pickupLocation: $('#pickupLocationSelect').val(), + catalogKey: $('#catalogKey').val(), + note: $('#note').val() + }; + var url = Globals.path + "/" + module + "/AJAX"; + $.getJSON(url, params, function(data){ + document.body.style.cursor = "default"; + if (data.success) { + AspenDiscovery.showMessage(data.title, data.message, false, false); + } else { + AspenDiscovery.showMessage(data.title, data.message, false, false); + } + }).fail(AspenDiscovery.ajaxFail); + }else{ + AspenDiscovery.Account.ajaxLogin(null, function(){ + AspenDiscovery.Record.showOCLCRSFGRequest(module, source, id); + }, false); + } + return false; + }, + showPlaceHoldEditions: function (module, source, id, volume, variationId) { if (Globals.loggedIn) { var url = Globals.path + "/" + module + "/" + id + "/AJAX?method=getPlaceHoldEditionsForm&recordSource=" + source; diff --git a/code/web/interface/themes/responsive/js/aspen/record.js b/code/web/interface/themes/responsive/js/aspen/record.js index 9b53ebf122..aa7006dc05 100644 --- a/code/web/interface/themes/responsive/js/aspen/record.js +++ b/code/web/interface/themes/responsive/js/aspen/record.js @@ -205,6 +205,42 @@ AspenDiscovery.Record = (function () { return false; }, + submitOCLCRSFGRequest: function(module, id) { + if (Globals.loggedIn){ + document.body.style.cursor = "wait"; + var params = { + 'method': 'submitOCLCRSFGRequest', + title: $('#title').val(), + author: $('#author').val(), + publisher: $('#publisher').val(), + isbn: $('#isbn').val(), + issn: $('#issn').val(), + oclcNumber: $('#oclcNumber').val(), + uniqueIdentifierKey: $('#uniqueIdentifierKeySelect').val(), + uniqueIdentifierValue: $('#uniqueIdentifierValue').val(), + maximumFeeAmount: $('#maximumFeeAmount').val(), + acceptFee: $('#acceptFee').prop('checked'), + pickupLocation: $('#pickupLocationSelect').val(), + catalogKey: $('#catalogKey').val(), + note: $('#note').val() + }; + var url = Globals.path + "/" + module + "/AJAX"; + $.getJSON(url, params, function(data){ + document.body.style.cursor = "default"; + if (data.success) { + AspenDiscovery.showMessage(data.title, data.message, false, false); + } else { + AspenDiscovery.showMessage(data.title, data.message, false, false); + } + }).fail(AspenDiscovery.ajaxFail); + }else{ + AspenDiscovery.Account.ajaxLogin(null, function(){ + AspenDiscovery.Record.showOCLCRSFGRequest(module, source, id); + }, false); + } + return false; + }, + showPlaceHoldEditions: function (module, source, id, volume, variationId) { if (Globals.loggedIn) { var url = Globals.path + "/" + module + "/" + id + "/AJAX?method=getPlaceHoldEditionsForm&recordSource=" + source; diff --git a/code/web/services/Record/AJAX.php b/code/web/services/Record/AJAX.php index d8f5ad2335..a0dd1f2553 100644 --- a/code/web/services/Record/AJAX.php +++ b/code/web/services/Record/AJAX.php @@ -500,6 +500,47 @@ function getOCLCRSFGRequestForm() { return $results; } + + /** @noinspection PhpUnused */ + function submitOCLCRSFGRequest(): array { + if (UserAccount::isLoggedIn()) { + require_once ROOT_DIR . '/Drivers/OCLCRSFGDriver.php'; + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGForm.php'; + $OCLCRSFGSettings = new OCLCRSFGSetting(); + $OCLCRSFGSettings->whereAdd("id=" . Library::getActiveLibrary()->oclcRSFGSettingsId); + if ($OCLCRSFGSettings->find(true)) { + $OCLCRSFGDriver = new OCLCRSFGDriver(); + $results = $OCLCRSFGDriver->submitRequest($OCLCRSFGSettings, UserAccount::getActiveUserObj(), $_REQUEST, false); + } else { + $results = [ + 'title' => translate([ + 'text' => 'Invalid Configuration', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "OCLC Resource Sharing For Groups Settings do not exist, please contact the library to make a request.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + } else { + $results = [ + 'title' => translate([ + 'text' => 'Please login', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "You must be logged in. Please close this dialog and login before placing your request.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + return $results; + } + /** @noinspection PhpUnused */ function getPlaceHoldForm() { global $interface; diff --git a/code/web/sys/OCLCRSFG/OCLCRSFGRequest.php b/code/web/sys/OCLCRSFG/OCLCRSFGRequest.php new file mode 100644 index 0000000000..385915fca8 --- /dev/null +++ b/code/web/sys/OCLCRSFG/OCLCRSFGRequest.php @@ -0,0 +1,31 @@ + Date: Fri, 20 Dec 2024 14:23:39 +0000 Subject: [PATCH 08/12] DIS-65 feat: Set Materials Requests to use RSFG Allow administrators to set Materials Requests to be sent through the OCLC integration, so that records that are not found anywhere within a given Aspen system can also be requested through the OCLC RS API. Test plan: - navigate to 'Aspen Administration' > 'Library Systems' and select a library to edit - navigate to Materials Request and open the Materials Request System dropdown - notice that 'OCLC Resource Sharing For Groups' is now an option - set it to this, save, reload the page, and notice that the new value is saved and displayed --- code/web/sys/LibraryLocation/Library.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code/web/sys/LibraryLocation/Library.php b/code/web/sys/LibraryLocation/Library.php index 0b488a4a56..743b05cc7a 100644 --- a/code/web/sys/LibraryLocation/Library.php +++ b/code/web/sys/LibraryLocation/Library.php @@ -590,6 +590,7 @@ static function getObjectStructure($context = ''): array { 1 => 'Aspen Request System', 2 => 'ILS Request System', 3 => 'External Request Link', + 4 => 'OCLC Resource Sharing For Groups' ]; $catalog = CatalogFactory::getCatalogConnectionInstance(); if ($catalog == null || !$catalog->hasMaterialsRequestSupport()) { From e80aaed8cac6a33a1ebea7aafaf668529982b0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 14:27:26 +0000 Subject: [PATCH 09/12] DIS-65 feat: Submit RS4G Out-Of-System ILL Requests Allow a patron meeting the requirements (see the previous commit for details) to place a request for a record not found anywhere with the Aspen system through the Resource Sharing API. This assumes that: - the OCLC RSFG integration in Aspen has been set up - Materials Request are set to use the OCLC RSFG integration - the tester is logged in / masquerading as a patron of a library with an OCLC RSFG Setting assigned to it, and has a home location with an OCLC registryId assigned to it Test plan: - run a search - at the bottom of the search result page, notice the 'Submit Request' button - select 'Submit Request' and notice that the Materials Request page that opens displays the OCLC ILL request form - fill in the required fields (use a valid ISSN, ISBN or OCLC number) - submit your request - notice that you are redirected to Your Account > Titles on Hold - wait 2-3 minutes before selecting 'Refresh' to reload your ILL requests - notice that your new request is now displayed, that there is no cover image (due to this not being tied to an existing Aspen record), and that the numbers next to the 'all' and 'Interlibrary Loan Requests' have been increase by 1 --- .../MaterialsRequest/oclc-rsfg-request.tpl | 19 +++++ .../themes/responsive/Search/list-none.tpl | 7 ++ .../themes/responsive/Search/list.tpl | 7 ++ .../MaterialsRequest/NewRequestOCLCRSFG.php | 80 +++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 code/web/interface/themes/responsive/MaterialsRequest/oclc-rsfg-request.tpl create mode 100644 code/web/services/MaterialsRequest/NewRequestOCLCRSFG.php diff --git a/code/web/interface/themes/responsive/MaterialsRequest/oclc-rsfg-request.tpl b/code/web/interface/themes/responsive/MaterialsRequest/oclc-rsfg-request.tpl new file mode 100644 index 0000000000..4ae2ea005c --- /dev/null +++ b/code/web/interface/themes/responsive/MaterialsRequest/oclc-rsfg-request.tpl @@ -0,0 +1,19 @@ +
+
+

{translate text='Materials Request' isPublicFacing=true}

+
+ {if !empty($error)} +
{$error}
+ {else} +
+ {if empty($newMaterialsRequestSummary)} + {translate text='If you cannot find a title in our catalog, you can request the title via this form. Please enter as much information as possible so we can find the exact title you are looking for. For example, if you are looking for a specific season of a TV show, please include that information.' isPublicFacing=true} + {else} + {translate text=$newMaterialsRequestSummary isPublicFacing=true isAdminEnteredData=true} + {/if} +
+ {$oclcRSFGForm} + {/if} +
+
+
\ No newline at end of file diff --git a/code/web/interface/themes/responsive/Search/list-none.tpl b/code/web/interface/themes/responsive/Search/list-none.tpl index 4cf5afe492..f793793a7e 100644 --- a/code/web/interface/themes/responsive/Search/list-none.tpl +++ b/code/web/interface/themes/responsive/Search/list-none.tpl @@ -130,6 +130,13 @@

{translate text="Didn't find it?" isPublicFacing=true}

{translate text="Can't find what you are looking for?" isPublicFacing=true} {translate text='Suggest a purchase' isPublicFacing=true}

+ {elseif $materialRequestType == 4} + {/if} {/if} diff --git a/code/web/interface/themes/responsive/Search/list.tpl b/code/web/interface/themes/responsive/Search/list.tpl index 40ee9d114a..93655ac7fe 100644 --- a/code/web/interface/themes/responsive/Search/list.tpl +++ b/code/web/interface/themes/responsive/Search/list.tpl @@ -126,6 +126,13 @@ {translate text="Can't find what you are looking for? Try our Materials Request Service." isPublicFacing=true} {translate text='Submit Request' isPublicFacing=true}

+ {elseif $materialRequestType == 4} + {/if} {/if} diff --git a/code/web/services/MaterialsRequest/NewRequestOCLCRSFG.php b/code/web/services/MaterialsRequest/NewRequestOCLCRSFG.php new file mode 100644 index 0000000000..8b1b13d26f --- /dev/null +++ b/code/web/services/MaterialsRequest/NewRequestOCLCRSFG.php @@ -0,0 +1,80 @@ + "Unable to determine home library to place request from.", + 'isPublicFacing' => true, + ]); + $interface->assign('error', $error); + $this->display('oclc-rsfg-request.tpl', 'Materials Request'); + return; + } + + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + $settings = new OCLCRSFGSetting(); + $settings->whereAdd("id={$activeLibrary->oclcRSFGSettingsId}"); + if (!$settings->find(true)) { + $error = translate([ + 'text' => "OCLC Resource Sharing For Groups Settings do not exist, please contact the library to make a request.", + 'isPublicFacing' => true, + ]); + $interface->assign('error', $error); + $this->display('oclc-rsfg-request.tpl', 'Materials Request'); + return; + } + + if (isset($_REQUEST['submit'])) { + require_once ROOT_DIR . '/Drivers/OCLCRSFGDriver.php'; + $driver = new OCLCRSFGDriver(); + $results = $driver->submitRequest($settings, UserAccount::getActiveUserObj(), $_REQUEST, true); + if ($results['success']) { + header('Location: /MyAccount/Holds#interlibrary_loan'); + exit; + } else { + $error = $results['message']; + $interface->assign('error', $error); + $this->display('oclc-rsfg-request.tpl', 'Materials Request'); + return; + } + } + + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGForm.php'; + $form = new OCLCRSFGForm(); + $form->id = $activeLibrary->OCLCRSFGFormId; + if ($form->find(true)) { + $interface->assign('OCLCRSFGForm', $form); + $formFields = $form->getFormFields(null); + $interface->assign('structure', $formFields); + $interface->assign('saveButtonText', 'Submit Request'); + $fieldsForm = $interface->fetch('DataObjectUtil/objectEditForm.tpl'); + $interface->assign('oclcRSFGForm', $fieldsForm); + } else { + $error = translate([ + 'text' => "Unable to find the specified form.", + 'isPublicFacing' => true, + ]); + $interface->assign('error', $error); + } + + $this->display('oclc-rsfg-request.tpl', 'Materials Request'); + } + + function getBreadcrumbs(): array { + $breadcrumbs = []; + $breadcrumbs[] = new Breadcrumb('/MyAccount/Home', 'Your Account'); + $breadcrumbs[] = new Breadcrumb('', 'New Materials Request'); + return $breadcrumbs; + } +} \ No newline at end of file From fbd026f7446eee3d8e21c86356617f8ae46c2c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 14:40:21 +0000 Subject: [PATCH 10/12] DIS-65 feat: Display RS4G ILL Requests list to patron --- code/web/Drivers/OCLCRSFGDriver.php | 119 ++++++++++++++++++ .../responsive/MyAccount/account-sidebar.tpl | 2 +- .../themes/responsive/MyAccount/holds.tpl | 4 +- .../themes/responsive/MyAccount/holdsList.tpl | 2 + .../MyAccount/oclc-rsfg-request.tpl | 95 ++++++++++++++ code/web/services/MyAccount/AJAX.php | 18 ++- code/web/sys/Account/User.php | 37 +++++- 7 files changed, 270 insertions(+), 7 deletions(-) create mode 100644 code/web/interface/themes/responsive/MyAccount/oclc-rsfg-request.tpl diff --git a/code/web/Drivers/OCLCRSFGDriver.php b/code/web/Drivers/OCLCRSFGDriver.php index 4723f362f3..d3f43df4cf 100644 --- a/code/web/Drivers/OCLCRSFGDriver.php +++ b/code/web/Drivers/OCLCRSFGDriver.php @@ -17,6 +17,87 @@ public function __construct() { } // Controllers + + public function getAccountSummary(User $user): AccountSummary { + [ + $existingId, + $summary, + ] = $user->getCachedAccountSummary('oclcRSFG'); + + if ($summary === null || isset($_REQUEST['reload'])) { + //Get account information from api + require_once ROOT_DIR . '/sys/User/AccountSummary.php'; + $summary = new AccountSummary(); + $summary->userId = $user->id; + $summary->source = 'oclcRSFG'; + $summary->resetCounters(); + + $settings = new OCLCRSFGSetting(); + $homeLibrary = Library::getPatronHomeLibrary(); + $settings->whereAdd("id={$homeLibrary->oclcRSFGSettingsId}"); + if($settings->find()) { + $settings->fetch(); + } + $requests = $this->getRequests($user, $settings); + $summary->numUnavailableHolds = count($requests['unavailable']); + $summary->numAvailableHolds = count($requests['available']); + } + + return $summary; + } + + public function getRequests(User $patron, $setting): array { + if (empty($this->_registryId)) { + return []; + } + try { + if (empty($this->accessToken)) { + $this->setAccessToken($setting); + } + } catch (Exception $e) { + global $logger; + $logger->log("Exception conducting pre-submission checks for an ILL request to the Resource Sharing Requests API: $e", Logger::LOG_ERROR); + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Could not send request to the Resource Sharing For Groups system.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + $requestsSent = $this->getAllRequestsFromAspenDbForPatron($patron->id); + $openRequests = []; + $processedRequests = []; + foreach ($requestsSent as $requestInAspenDb) { + if ($requestInAspenDb->oclcRequestId) { + $requestInOCLCRSFG = $this->getRequestFromOCLCRSFGWithId($setting, $requestInAspenDb->oclcRequestId); + } + if (!empty($requestInOCLCRSFG)) { + $requestInAspenDb->requestStatus = $requestInOCLCRSFG['illRequest']['requestStatus']; + $requestInAspenDb->update(); + if( + $requestInAspenDb->requestStatus == "REVIEW" || + $requestInAspenDb->requestStatus == "REVIEWING" + ){ + $openRequests[] = $this->createTemporaryHold($patron->id, $requestInAspenDb); + } + if( + $requestInAspenDb->requestStatus == "RECEIVED" + ){ + $processedRequests[] = $this->createTemporaryHold($patron->id, $requestInAspenDb); + } + } + } + return [ + 'unavailable' => $openRequests, + 'available' => $processedRequests + ]; + } + public function submitRequest(OCLCRSFGSetting $setting, User $patron, $requestFormData): array { global $logger; if (empty($this->_registryId)) { @@ -269,6 +350,22 @@ private function getAllRequestsFromOCLCRSFGForPatron(OCLCRSFGSetting $setting, I return json_decode(json_encode(simplexml_load_string($response)), true)['responses']; } + private function getRequestFromOCLCRSFGWithId(OCLCRSFGSetting $setting, string $oclcRequestId): array|null { + require_once ROOT_DIR . '/sys/CurlWrapper.php'; + $url = $setting->serviceBaseUrl . "/requests" . "/" . $oclcRequestId; + $curl = new CurlWrapper(); + $customHeaders = [ + "Authorization" => "Authorization: Bearer " . $this->accessToken->getToken(), + ]; + $curl->addCustomHeaders($customHeaders, false); + $curl->curl_connect($url); + $response = $curl->curlGetPage($url); + if (!$response) { + throw new Exception("No requests found with id $oclcRequestId"); + } + return json_decode(json_encode(simplexml_load_string($response)), true)['responses']; + } + private function postToOCLCRSFG(string $serviceBaseUrl, OCLCRSFGRequest $newRequest): array { require_once ROOT_DIR . '/sys/CurlWrapper.php'; $url = $serviceBaseUrl . "/requests"; @@ -309,6 +406,28 @@ private function setAccessToken(OCLCRSFGSetting $setting): void { } // Helpers + + private function createTemporaryHold($patronId, $request): Hold { + require_once ROOT_DIR . '/sys/User/Hold.php'; + $curRequest = new Hold(); + $curRequest->userId = $patronId; + $curRequest->type = 'interlibrary_loan'; + $curRequest->isIll = true; + $curRequest->source = 'oclcRSFG'; + $curRequest->sourceId = $request->catalogKey; + $curRequest->recordId = $request->catalogKey; + $curRequest->title = $request->title; + $curRequest->author = $request->author; + $curRequest->status = $request->requestStatus; + $curRequest->pickupLocationName = $request->pickupLocation; + $curRequest->cancelId = $request->oclcRequestId; + $curRequest->cancelable = false; + if ($request->requestStatus == 'REVIEW' || $request->requestStatus == 'REVIEWING') { + $curRequest->cancelable = true; + } + return $curRequest; + } + private function formatRequestBody(OCLCRSFGRequest $newRequest): object { $illRequest = []; $illRequest["requestStatus"] = "PROFILING"; diff --git a/code/web/interface/themes/responsive/MyAccount/account-sidebar.tpl b/code/web/interface/themes/responsive/MyAccount/account-sidebar.tpl index 06f4c7b6fc..97ecf795b2 100644 --- a/code/web/interface/themes/responsive/MyAccount/account-sidebar.tpl +++ b/code/web/interface/themes/responsive/MyAccount/account-sidebar.tpl @@ -95,7 +95,7 @@ {/if} - {if $user->getInterlibraryLoanType() == 'vdx'} + {if $user->getInterlibraryLoanType() == 'vdx' || $user->getInterlibraryLoanType() == 'oclc_resource_sharing_for_groups'} {/if} - {if $user->getInterlibraryLoanType() == 'vdx'} + {if $user->getInterlibraryLoanType() == 'vdx' || $user->getInterlibraryLoanType() == 'oclc_resource_sharing_for_groups'} {/if} {if $user->isValidForEContentSource('overdrive')} @@ -52,7 +52,7 @@
{translate text="Loading holds from all sources" isPublicFacing=true}
{translate text="Loading holds of physical materials" isPublicFacing=true}
{/if} - {if $user->getInterlibraryLoanType() == 'vdx'} + {if $user->getInterlibraryLoanType() == 'vdx' || $user->getInterlibraryLoanType() == 'oclc_resource_sharing_for_groups'}
{translate text="Loading Interlibrary Loan Requests" isPublicFacing=true}
{/if} {if $user->isValidForEContentSource('overdrive')} diff --git a/code/web/interface/themes/responsive/MyAccount/holdsList.tpl b/code/web/interface/themes/responsive/MyAccount/holdsList.tpl index 5228a79ae5..f558358da8 100644 --- a/code/web/interface/themes/responsive/MyAccount/holdsList.tpl +++ b/code/web/interface/themes/responsive/MyAccount/holdsList.tpl @@ -52,6 +52,8 @@ {include file="MyAccount/palaceProjectHold.tpl" record=$record section=$sectionKey resultIndex=$smarty.foreach.recordLoop.iteration} {elseif $record->type == 'interlibrary_loan' && $record->source == 'vdx'} {include file="MyAccount/vdxRequest.tpl" record=$record section=$sectionKey resultIndex=$smarty.foreach.recordLoop.iteration} + {elseif $record->type == 'interlibrary_loan' && $record->source == 'oclcRSFG'} + {include file="MyAccount/oclc-rsfg-request.tpl" record=$record section=$sectionKey resultIndex=$smarty.foreach.recordLoop.iteration} {else}
Unknown record type {$record->type} diff --git a/code/web/interface/themes/responsive/MyAccount/oclc-rsfg-request.tpl b/code/web/interface/themes/responsive/MyAccount/oclc-rsfg-request.tpl new file mode 100644 index 0000000000..2836e753f8 --- /dev/null +++ b/code/web/interface/themes/responsive/MyAccount/oclc-rsfg-request.tpl @@ -0,0 +1,95 @@ +{strip} +
+ {if !empty($showCovers)} +
+
+ {if !empty($record->getCoverUrl())} + {if !empty($record->getLinkUrl())} + + {else} + + {/if} + {/if} + +
+
+ {/if} +
+ +
+
+ {if !empty($record->getAuthor())} +
+
{translate text='Author' isPublicFacing=true}
+
+ {if is_array($record->getAuthor())} + {foreach from=$record->getAuthor() item=author} + {$author|highlight} + {/foreach} + {else} + {$record->getAuthor()|highlight} + {/if} +
+
+ {/if} + {if !empty($hasLinkedUsers)} +
+
{translate text='On Hold For' isPublicFacing=true}
+
+ {$record->getUserName()|escape} +
+
+ {/if} +
+
{translate text='Pickup Location' isPublicFacing=true}
+
+ {$record->pickupLocationName|escape} +
+
+ {if !empty($showPlacedColumn) && $record->createDate} +
+
{translate text='Date Placed' isPublicFacing=true}
+
+ {$record->createDate|date_format:"%b %d, %Y"} +
+
+ {/if} +
+
{translate text='Status' isPublicFacing=true}
+
+ {if $record->frozen} + + {/if} + {translate text=$record->status isPublicFacing=true} +
+
+
+
+ + {translate text='This is an interlibrary loan request' isPublicFacing=true} + +
+
+
+
+ {if !empty($showWhileYouWait)} +
+ {if !empty($record->getGroupedWorkId())} + + {/if} +
+ {/if} +
+
+
+
+{/strip} \ No newline at end of file diff --git a/code/web/services/MyAccount/AJAX.php b/code/web/services/MyAccount/AJAX.php index 2bf8f7127f..8b74e8a4db 100644 --- a/code/web/services/MyAccount/AJAX.php +++ b/code/web/services/MyAccount/AJAX.php @@ -2845,7 +2845,7 @@ function getMenuDataInterlibraryLoan() { ]; if (UserAccount::isLoggedIn()) { $user = UserAccount::getActiveUserObj(); - if ($user->hasInterlibraryLoan()) { + if ($user->hasVDXInterlibraryLoan()) { require_once ROOT_DIR . '/Drivers/VdxDriver.php'; $driver = new VdxDriver(); $vdxSummary = $driver->getAccountSummary($user); @@ -2861,6 +2861,22 @@ function getMenuDataInterlibraryLoan() { 'success' => true, 'summary' => $vdxSummary->toArray(), ]; + } elseif ($user->hasOCLCRSFGInterlibraryLoan()) { + require_once ROOT_DIR . '/Drivers/OCLCRSFGDriver.php'; + $driver = new OCLCRSFGDriver(); + $oclcRSFGSummary = $driver->getAccountSummary($user); + if ($user->getLinkedUsers() != null) { + /** @var User $user */ + foreach ($user->getLinkedUsers() as $linkedUser) { + $linkedUserSummary = $driver->getAccountSummary($linkedUser); + $oclcRSFGSummary->numUnavailableHolds += $linkedUserSummary->numUnavailableHolds; + } + } + $result = [ + 'success' => true, + 'summary' => $oclcRSFGSummary->toArray(), + ]; + } else { $result['message'] = 'Invalid for VDX'; } diff --git a/code/web/sys/Account/User.php b/code/web/sys/Account/User.php index 6a4e44fed2..a372f69c25 100644 --- a/code/web/sys/Account/User.php +++ b/code/web/sys/Account/User.php @@ -890,6 +890,10 @@ function getAvailableOverDriveSettings(string $readerName): array { } function hasInterlibraryLoan(): bool { + return $this->hasVDXInterlibraryLoan() || $this->hasOCLCRSFGInterlibraryLoan(); + } + + function hasVDXInterlibraryLoan(): bool { try { $homeLocation = Location::getDefaultLocationForUser(); if ($homeLocation != null) { @@ -919,6 +923,22 @@ function hasInterlibraryLoan(): bool { return false; } + function hasOCLCRSFGInterlibraryLoan(): bool { + try { + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGForm.php'; + $OCLCRSFGSettings = new OCLCRSFGSetting(); + $homeLibrary = Library::getPatronHomeLibrary(); + $OCLCRSFGSettings->whereAdd("id={$homeLibrary->oclcRSFGSettingsId}"); + if ($OCLCRSFGSettings->find(true)) { + return true; + } + } catch (Exception $e) { + //This happens if the tables are not installed yet + } + return false; + } + function getInterlibraryLoanType(): string { $homeLocation = Location::getDefaultLocationForUser(); if ($homeLocation != null) { @@ -1896,14 +1916,25 @@ public function getHolds($includeLinkedUsers = true, $unavailableSort = 'sortTit } if ($source == 'all' || $source == 'interlibrary_loan') { - if ($this->hasInterlibraryLoan()) { - //For now, this is just VDX + if ($this->hasVDXInterlibraryLoan()) { require_once ROOT_DIR . '/Drivers/VdxDriver.php'; $driver = new VdxDriver(); $vdxRequests = $driver->getRequests($this); $allHolds = array_merge_recursive($allHolds, $vdxRequests); $holdsToReturn = array_merge_recursive($holdsToReturn, $vdxRequests); } + if ($this->hasOCLCRSFGInterlibraryLoan()) { + require_once ROOT_DIR . '/Drivers/OCLCRSFGDriver.php'; + require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; + $OCLCRSFGSettings = new OCLCRSFGSetting(); + $OCLCRSFGSettings->whereAdd("id=" . Library::getActiveLibrary()->oclcRSFGSettingsId); + if ($OCLCRSFGSettings->find(true)) { + $driver = new OCLCRSFGDriver(); + $oclcRSFGRequests = $driver->getRequests($this, $OCLCRSFGSettings); + $allHolds = array_merge_recursive($allHolds, $oclcRSFGRequests); + $holdsToReturn = array_merge_recursive($holdsToReturn, $oclcRSFGRequests); + } + } } //Delete all existing holds $hold = new Hold(); @@ -2061,7 +2092,7 @@ public function getHolds($includeLinkedUsers = true, $unavailableSort = 'sortTit uasort($holdsToReturn['unavailable'], $holdSort); } - if ($source == 'interlibrary_loan') { + if ($source == 'interlibrary_loan' && !$this->hasOCLCRSFGInterlibraryLoan()) { unset($holdsToReturn['available']); } From 4ed92acf581e51fbb329c46714ddbc501a437ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 20 Dec 2024 14:41:21 +0000 Subject: [PATCH 11/12] DIS-65 feat: Display RS4G ILL Request Details Allow a patron meeting the requirements (see earlier DIS-65 commits for details) to view the details of an ILL request which they have placed through the OCLC RSFG integration in Aspen. This assumes that: - the OCLC RSFG integration in Aspen has been set up - the tester is logged in / masquerading as a patron of a library with an OCLC RSFG Setting assigned to it, and has a home location with an OCLC registryId assigned to it - this patron has one or more ILL requests placed through the OCLC integration with the OCLC RS API that are active (their status is not 'CLOSED') Test plan: - navigate to My Account > Titles On Hold - Click on the title of one of the ILL request showing under 'All' or 'Interlibrary Loan Requests' - Notice that an 'Interlibrary Loan Request' page opens which displays additional information on the ILL request Note: the information displayed on both the ILL requests list in 'Titles on Hold' and the detailed ILL request view in 'Interlibray Loan Request' is issued from the OCLC Resource Sharing For Groups Sharing, that is to say that it may not exactly match the information found on the record that the patron initially requested (as this is is issue from the library's catalogue). --- code/web/Drivers/OCLCRSFGDriver.php | 45 ++++++++ .../OCLCRSFG/oclc-rsfg-request-details.tpl | 106 ++++++++++++++++++ .../OCLCRSFG/OCLCRSFGRequestDetails.php | 32 ++++++ 3 files changed, 183 insertions(+) create mode 100644 code/web/interface/themes/responsive/OCLCRSFG/oclc-rsfg-request-details.tpl create mode 100644 code/web/services/OCLCRSFG/OCLCRSFGRequestDetails.php diff --git a/code/web/Drivers/OCLCRSFGDriver.php b/code/web/Drivers/OCLCRSFGDriver.php index d3f43df4cf..165116f62e 100644 --- a/code/web/Drivers/OCLCRSFGDriver.php +++ b/code/web/Drivers/OCLCRSFGDriver.php @@ -46,6 +46,51 @@ public function getAccountSummary(User $user): AccountSummary { return $summary; } + public function getRequestDetails(OCLCRSFGSetting $setting, string $oclcRequestId) { + if (empty($this->_registryId)) { + return []; + } + try { + if (empty($this->accessToken)) { + $this->setAccessToken($setting); + } + } catch (Exception $e) { + global $logger; + $logger->log("Exception conducting pre-submission checks for an ILL request to the Resource Sharing Requests API: $e", Logger::LOG_ERROR); + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Could not send request to the Resource Sharing For Groups system.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + } + $requestInAspenDb = new OCLCRSFGRequest(); + try { + $this->updateRequestInAspenDb($requestInAspenDb, $this->getRequestFromOCLCRSFGWithId($setting, $oclcRequestId)); + } catch (Exception $e) { + global $logger; + $logger->log("Could not fetch data from OCLC Resource Sharing For Groups: $e", Logger::LOG_ERROR); + return [ + 'title' => translate([ + 'text' => 'Request Failed', + 'isPublicFacing' => true, + ]), + 'message' => translate([ + 'text' => "Could not fetch data from OCLC Resource Sharing For Groups.", + 'isPublicFacing' => true, + ]), + 'success' => false, + ]; + + } + return $requestInAspenDb; + } + public function getRequests(User $patron, $setting): array { if (empty($this->_registryId)) { return []; diff --git a/code/web/interface/themes/responsive/OCLCRSFG/oclc-rsfg-request-details.tpl b/code/web/interface/themes/responsive/OCLCRSFG/oclc-rsfg-request-details.tpl new file mode 100644 index 0000000000..d8a05e9080 --- /dev/null +++ b/code/web/interface/themes/responsive/OCLCRSFG/oclc-rsfg-request-details.tpl @@ -0,0 +1,106 @@ +{strip} +
+

{translate text="Interlibrary Loan Request" isAdminFacing=true}

+
+
+
+

General information

+
+
{translate text='Request Id' isPublicFacing=true}
+
+ {$illRequest->oclcRequestId} +
+
+
+
{translate text='Status' isPublicFacing=true}
+
+ {$illRequest->requestStatus} +
+
+
+
{translate text='Status Description' isPublicFacing=true}
+
+ {$illRequest->requestStatusDescription} +
+
+
+
{translate text='Created On' isPublicFacing=true}
+
+ {$illRequest->createdDate|date_format:"%b %d, %Y"} +
+
+
+
{translate text='Need By Date' isPublicFacing=true}
+
+ {$illRequest->needed|date_format:"%b %d, %Y"} +
+
+
+
{translate text='Service Type' isPublicFacing=true}
+
+ {$illRequest->serviceType} +
+
+
+
+

Item information

+
+
{translate text='Title' isPublicFacing=true}
+
+ {$illRequest->title} +
+
+
+
{translate text='Author' isPublicFacing=true}
+
+ {$illRequest->author} +
+
+ {if ({$illRequest->edition})} +
+
{translate text='Edition' isPublicFacing=true}
+
+ {$illRequest->edition} +
+
+ {/if} + {if ({$illRequest->isbn})} +
+
{translate text='ISBN' isPublicFacing=true}
+
+ {$illRequest->isbn} +
+
+ {/if} + {if ({$illRequest->issn})} +
+
{translate text='ISSN' isPublicFacing=true}
+
+ {$illRequest->issn} +
+
+ {/if} + {if ({$illRequest->oclcNumber})} +
+
{translate text='OCLC Number' isPublicFacing=true}
+
+ {$illRequest->oclcNumber} +
+
+ {/if} +
+
{translate text='Media Type' isPublicFacing=true}
+
+ {$illRequest->mediaType} +
+
+
+
{translate text='Language' isPublicFacing=true}
+
+ {$illRequest->language} +
+
+ {* TODO: if possible, fetch and display permitted actions *} +
+
+{/strip} diff --git a/code/web/services/OCLCRSFG/OCLCRSFGRequestDetails.php b/code/web/services/OCLCRSFG/OCLCRSFGRequestDetails.php new file mode 100644 index 0000000000..e534f4a66d --- /dev/null +++ b/code/web/services/OCLCRSFG/OCLCRSFGRequestDetails.php @@ -0,0 +1,32 @@ +whereAdd("id={$activeLibrary->oclcRSFGSettingsId}"); + if (!$OCLCRSFGSettings->find(true)) { + return false; + } + $interface->assign('illRequest', $driver->getRequestDetails($OCLCRSFGSettings, $requestId)); + + global $logger; + $logger->log($requestId, Logger::LOG_ERROR); + $this->display('oclc-rsfg-request-details.tpl', 'Interlibrary Loan Request'); + } + + function getBreadcrumbs(): array { + $breadcrumbs = []; + $breadcrumbs[] = new Breadcrumb('/MyAccount/Holds', 'Holds'); + $breadcrumbs[] = new Breadcrumb('/OCLCRSFG/OCLCRSFGRequestDetails', 'OCLCRSFGRequestDetails'); + return $breadcrumbs; + } +} \ No newline at end of file From 2334d936f60316a43793d3dd918b6256f5077fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Thu, 2 Jan 2025 18:58:44 +0000 Subject: [PATCH 12/12] DIS-65 chore: set up cron jobs These aim to ensure that the aspen database contains up-to-date active ILL requests placed through the OCLC Resource Sharing For Groups integration by periodically fetching from the RS API and updating the user_oclc_resource_sharing_for_groups table in Aspen db. --- code/web/Drivers/OCLCRSFGDriver.php | 6 +++- code/web/cron/updateOCLCILLRequests.php | 39 +++++++++++++++++++++++++ install/updateCron_25.02.php | 28 ++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 code/web/cron/updateOCLCILLRequests.php create mode 100644 install/updateCron_25.02.php diff --git a/code/web/Drivers/OCLCRSFGDriver.php b/code/web/Drivers/OCLCRSFGDriver.php index 165116f62e..41da5e1f81 100644 --- a/code/web/Drivers/OCLCRSFGDriver.php +++ b/code/web/Drivers/OCLCRSFGDriver.php @@ -11,7 +11,11 @@ class OCLCRSFGDriver { private $accessToken; private $_registryId; - public function __construct() { + public function __construct($registryId = null) { + if ($registryId) { + $this->_registryId = $registryId; + return; + } $homeLocation = Location::getUserHomeLocation(); $this->_registryId = $homeLocation ? $homeLocation->oclcRegistryId : "" ; } diff --git a/code/web/cron/updateOCLCILLRequests.php b/code/web/cron/updateOCLCILLRequests.php new file mode 100644 index 0000000000..271bba0014 --- /dev/null +++ b/code/web/cron/updateOCLCILLRequests.php @@ -0,0 +1,39 @@ +selectAdd(); +$patron->selectAdd('DISTINCT user.id, user.homeLocationId'); +$patron->joinAdd($oclcRSFGIllRequest, 'INNER', 'patronWithIllRequests', 'id', 'userId'); +$patronWithIllRequestsList = $patron->fetchAll(); + +if (empty($patronWithIllRequestsList)) { + die(); +} + +require_once ROOT_DIR . '/sys/OCLCRSFG/OCLCRSFGSetting.php'; +require_once ROOT_DIR . '/Drivers/OCLCRSFGDriver.php'; + +foreach ($patronWithIllRequestsList as $patronWithIllRequests) { + $oclcRegistryId = $patronWithIllRequests->getHomeLocation()->oclcRegistryId; + if ($oclcRegistryId == -1) { + continue; + } + $driver = new OCLCRSFGDriver($oclcRegistryId); + $settings = new OCLCRSFGSetting(); + + $settings->id = $patronWithIllRequests->getHomeLibrary()->oclcRSFGSettingsId; + if(!$settings->find(true)) { + continue; + }; + $driver->updateRequestsInAspenDbForPatron($settings, $patronWithIllRequests->id); +} + +die(); \ No newline at end of file diff --git a/install/updateCron_25.02.php b/install/updateCron_25.02.php new file mode 100644 index 0000000000..5c584151f7 --- /dev/null +++ b/install/updateCron_25.02.php @@ -0,0 +1,28 @@ + 1) { + $serverName = $_SERVER['argv'][1]; + $fhnd = fopen("/usr/local/aspen-discovery/sites/$serverName/conf/crontab_settings.txt", 'a+'); + + if (!$fhnd) { + echo("- Could not find cron settings file\n"); + exit(); + } + + while (($line = fgets($fhnd)) !== false) { + if (strpos($line, 'updateOCLCILLRequests') > 0) { + echo("- No cron expression added: is already found in /sites/$serverName/conf/crontab_settings.txt \n"); + exit(); + } + } + + fwrite($fhnd, "\n#########################\n"); + fwrite($fhnd, "# fetch active OCLC ILL Requests and update them in Aspen DB #\n"); + fwrite($fhnd, "#########################\n"); + fwrite($fhnd, "0 0 * * * aspen php /usr/local/aspen-discovery/code/web/cron/updateOCLCILLRequests.php $serverName\n"); + exit(); + +} else { + echo 'Must provide servername as first argument'; + exit(); +}