-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Make CachingHttpClient
compatible with RFC 9111
#59576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lctrs
wants to merge
53
commits into
symfony:7.4
Choose a base branch
from
Lctrs:rfc9111-http-client
base: 7.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,788
−99
Open
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
867ee2a
[HttpClient] Add an RFC 9111 compliant client
Lctrs d8b4992
rename and doc
Lctrs 492b4ab
remove configurable status codes and methods + doc constructor
Lctrs 4dc0157
phpdoc
Lctrs 5462d60
into cachinghttpclient with bc layer
Lctrs ea6004f
cs
Lctrs 6a2ee73
encode vary field value to avoid collision
Lctrs dc8069f
require-dev symfony/cache
Lctrs c06169d
fixing legacy tests
Lctrs 5339c8f
fix legacy tests 2
Lctrs 033f9d8
throw exception when chunk cache item not found
Lctrs ffedf61
fix check if response is cacheable
Lctrs c5b0404
more fixes and tests
Lctrs 71f2e3f
cs fixes
Lctrs 54e9fb2
replace ttl by maxTtl (should be clearer) + add missing docs + fix tests
Lctrs 4079e2e
fix lowest tests
Lctrs 22d5691
add changelogs
Lctrs fb273c9
own cache pool
Lctrs 061118e
added -> add
Lctrs 9c7fe49
$store -> $cache
Lctrs 59cbd40
private legacy
Lctrs 288a2a2
cleanup phpdocs
Lctrs 04439cd
freshness enum
Lctrs aeddd21
fix stream issues
Lctrs ea96bf2
more phpdoc fix
Lctrs a2969ba
cs fix
Lctrs a52a36b
fix cache definition
Lctrs 47d5422
put caching client between retry and throttling and invalidate cache …
Lctrs 03b782a
also clock mock symfony cache namespace
Lctrs c949f8a
bcb: also return async response
Lctrs 7f888ac
fix stream and add tests
Lctrs e6b3756
extend TransportException
Lctrs e5260d3
tests: in memory cache adapter
Lctrs 454339a
order UPGRADE-7.3.md
Lctrs df72186
ensure positive integer for max_ttl option
Lctrs 1ab157d
reword CHANGELOG.md
Lctrs 6d4f0d6
remove empty() usage
Lctrs 1b0a30a
evaluateCachedFreshness -> evaluateCacheFreshness
Lctrs 73311bc
remove dev deps on symfony/filesystem
Lctrs 6b1dfda
add more tests
Lctrs 463b71b
vary asterisk prevents caching
Lctrs 0ebc780
exclude non cacheable headers from cache
Lctrs d1886eb
remove wrongly cacheable status codes
Lctrs e15142c
implement heuristic caching
Lctrs bb9b0ba
Update src/Symfony/Component/HttpClient/CachingHttpClient.php
Lctrs 342fedc
Update src/Symfony/Component/HttpClient/CachingHttpClient.php
Lctrs e16d16f
Update src/Symfony/Component/HttpClient/CachingHttpClient.php
Lctrs bf285c0
Update src/Symfony/Component/HttpClient/CachingHttpClient.php
Lctrs 8c9871d
switch to a sha256 based hash
Lctrs 54b9fde
turn some vars by ref to static ones
Lctrs 4c1a097
cs
Lctrs df3f803
more static methods
Lctrs 7c66ffd
switch to TagAwareCacheInterface
Lctrs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_caching.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
$container->loadFromExtension('framework', [ | ||
'annotations' => false, | ||
'http_method_override' => false, | ||
'handle_all_throwables' => true, | ||
'php_errors' => ['log' => true], | ||
'http_client' => [ | ||
'default_options' => [ | ||
'headers' => ['X-powered' => 'PHP'], | ||
'caching' => [ | ||
'cache_pool' => 'foo', | ||
'shared' => false, | ||
'max_ttl' => 2, | ||
], | ||
], | ||
'scoped_clients' => [ | ||
'bar' => [ | ||
'base_uri' => 'http://example.com', | ||
'caching' => ['cache_pool' => 'baz'], | ||
], | ||
], | ||
], | ||
]); |
21 changes: 21 additions & 0 deletions
21
...ony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_caching.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:framework="http://symfony.com/schema/dic/symfony" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd | ||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> | ||
|
||
<framework:config http-method-override="false" handle-all-throwables="true"> | ||
<framework:annotations enabled="false" /> | ||
<framework:php-errors log="true" /> | ||
<framework:http-client> | ||
<framework:default-options> | ||
<framework:header name="X-powered">PHP</framework:header> | ||
<framework:caching enabled="true" cache-pool="foo" shared="false" max-ttl="2"/> | ||
</framework:default-options> | ||
<framework:scoped-client name="bar" base-uri="http://example.com"> | ||
<framework:caching cache-pool="baz"/> | ||
</framework:scoped-client> | ||
</framework:http-client> | ||
</framework:config> | ||
</container> |
19 changes: 19 additions & 0 deletions
19
...ony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_caching.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
framework: | ||
annotations: false | ||
http_method_override: false | ||
handle_all_throwables: true | ||
php_errors: | ||
log: true | ||
http_client: | ||
default_options: | ||
headers: | ||
X-powered: PHP | ||
caching: | ||
cache_pool: foo | ||
shared: false | ||
max_ttl: 2 | ||
scoped_clients: | ||
bar: | ||
base_uri: http://example.com | ||
caching: | ||
cache_pool: baz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\HttpClient\Caching; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
enum Freshness | ||
{ | ||
/** | ||
* The cached response is fresh and can be used without revalidation. | ||
*/ | ||
case Fresh; | ||
/** | ||
* The cached response is stale and must be revalidated before use. | ||
*/ | ||
case MustRevalidate; | ||
/** | ||
* The cached response is stale and should not be used. | ||
*/ | ||
case Stale; | ||
/** | ||
* The cached response is stale but may be used as a fallback in case of errors. | ||
*/ | ||
case StaleButUsable; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.