Merge branch '4.4' into 5.2
* 4.4: [#41846] Revert change in closing tag Closing tag typo * validators.lt.xlf - added missing 100 message [Validator] Add missing translations for Russian [Validator] Add missing Czech translations [Validator] Missing translations for Brazilian Portuguese (pt_BR) Add missing translation for Polish (#41826) missing translations for portuguese Public responses without lifetime should not remove lifetime for the resulting response [Security]Added missing translations for Armenian (hy)
This commit is contained in:
commit
ab2aabdf3b
@ -81,14 +81,15 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$isHeuristicallyCacheable = $response->headers->hasCacheControlDirective('public');
|
||||
$maxAge = $response->headers->hasCacheControlDirective('max-age') ? (int) $response->headers->getCacheControlDirective('max-age') : null;
|
||||
$this->storeRelativeAgeDirective('max-age', $maxAge, $age);
|
||||
$this->storeRelativeAgeDirective('max-age', $maxAge, $age, $isHeuristicallyCacheable);
|
||||
$sharedMaxAge = $response->headers->hasCacheControlDirective('s-maxage') ? (int) $response->headers->getCacheControlDirective('s-maxage') : $maxAge;
|
||||
$this->storeRelativeAgeDirective('s-maxage', $sharedMaxAge, $age);
|
||||
$this->storeRelativeAgeDirective('s-maxage', $sharedMaxAge, $age, $isHeuristicallyCacheable);
|
||||
|
||||
$expires = $response->getExpires();
|
||||
$expires = null !== $expires ? (int) $expires->format('U') - (int) $response->getDate()->format('U') : null;
|
||||
$this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0);
|
||||
$this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0, $isHeuristicallyCacheable);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -199,11 +200,29 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||
* we have to subtract the age so that the value is normalized for an age of 0.
|
||||
*
|
||||
* If the value is lower than the currently stored value, we update the value, to keep a rolling
|
||||
* minimal value of each instruction. If the value is NULL, the directive will not be set on the final response.
|
||||
* minimal value of each instruction.
|
||||
*
|
||||
* If the value is NULL and the isHeuristicallyCacheable parameter is false, the directive will
|
||||
* not be set on the final response. In this case, not all responses had the directive set and no
|
||||
* value can be found that satisfies the requirements of all responses. The directive will be dropped
|
||||
* from the final response.
|
||||
*
|
||||
* If the isHeuristicallyCacheable parameter is true, however, the current response has been marked
|
||||
* as cacheable in a public (shared) cache, but did not provide an explicit lifetime that would serve
|
||||
* as an upper bound. In this case, we can proceed and possibly keep the directive on the final response.
|
||||
*/
|
||||
private function storeRelativeAgeDirective(string $directive, ?int $value, int $age)
|
||||
private function storeRelativeAgeDirective(string $directive, ?int $value, int $age, bool $isHeuristicallyCacheable)
|
||||
{
|
||||
if (null === $value) {
|
||||
if ($isHeuristicallyCacheable) {
|
||||
/*
|
||||
* See https://datatracker.ietf.org/doc/html/rfc7234#section-4.2.2
|
||||
* This particular response does not require maximum lifetime; heuristics might be applied.
|
||||
* Other responses, however, might have more stringent requirements on maximum lifetime.
|
||||
* So, return early here so that the final response can have the more limiting value set.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
$this->ageDirectives[$directive] = false;
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ class ResponseCacheStrategyTest extends TestCase
|
||||
];
|
||||
|
||||
yield 'merge max-age and s-maxage' => [
|
||||
['public' => true, 's-maxage' => '60', 'max-age' => null],
|
||||
['public' => true, 'max-age' => '60'],
|
||||
['public' => true, 's-maxage' => 3600],
|
||||
[
|
||||
['public' => true, 'max-age' => 60],
|
||||
@ -393,6 +393,30 @@ class ResponseCacheStrategyTest extends TestCase
|
||||
],
|
||||
];
|
||||
|
||||
yield 'public subresponse without lifetime does not remove lifetime for main response' => [
|
||||
['public' => true, 's-maxage' => '30', 'max-age' => null],
|
||||
['public' => true, 's-maxage' => '30'],
|
||||
[
|
||||
['public' => true],
|
||||
],
|
||||
];
|
||||
|
||||
yield 'lifetime for subresponse is kept when main response has no lifetime' => [
|
||||
['public' => true, 'max-age' => '30'],
|
||||
['public' => true],
|
||||
[
|
||||
['public' => true, 'max-age' => '30'],
|
||||
],
|
||||
];
|
||||
|
||||
yield 's-maxage on the subresponse implies public, so the result is public as well' => [
|
||||
['public' => true, 'max-age' => '10', 's-maxage' => null],
|
||||
['public' => true, 'max-age' => '10'],
|
||||
[
|
||||
['max-age' => '30', 's-maxage' => '20'],
|
||||
],
|
||||
];
|
||||
|
||||
yield 'result is private when combining private responses' => [
|
||||
['no-cache' => false, 'must-revalidate' => false, 'private' => true],
|
||||
['s-maxage' => 60, 'private' => true],
|
||||
|
@ -36,7 +36,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>No session available, it either timed out or cookies are not enabled.</source>
|
||||
<target>No session available, it either timed out or cookies are not enabled.</target>
|
||||
<target>Հասանելի սեսիա չկա, կամ այն սպառվել է կամ cookie-ները անջատված են:</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>No token could be found.</source>
|
||||
|
@ -386,6 +386,10 @@
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Tato hodnota není platné mezinárodní identifikační číslo cenného papíru (ISIN).</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>This value should be a valid expression.</source>
|
||||
<target>Tato hodnota musí být platný výraz.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -386,6 +386,10 @@
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Ši reišmė neatitinka tarptautinio vertybinių popierių identifikavimo numerio formato (ISIN).</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>This value should be a valid expression.</source>
|
||||
<target>Ši vertė turėtų būti teisinga išraiška.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -386,6 +386,10 @@
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Ta wartość nie jest prawidłowym Międzynarodowym Numerem Identyfikacyjnym Papierów Wartościowych (ISIN).</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>This value should be a valid expression.</source>
|
||||
<target>Ta wartość powinna być prawidłowym wyrażeniem.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -386,6 +386,10 @@
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Este valor não é um Número Internacional de Identificação de Segurança (ISIN) válido.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>This value should be a valid expression.</source>
|
||||
<target>Este valor deve ser uma expressão válida.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -386,6 +386,10 @@
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Este valor não é um Número de Identificação de Títulos Internacionais (ISIN) válido.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>This value should be a valid expression.</source>
|
||||
<target>Este valor deve ser uma expressão válida.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -386,6 +386,10 @@
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Значение не является корректным международным идентификационным номером ценных бумаг (ISIN).</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>This value should be a valid expression.</source>
|
||||
<target>Это значение должно быть корректным выражением.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
Reference in New Issue
Block a user