Commit ba0cd9a
committed
bug #48880 [Response]
This PR was squashed before being merged into the 5.4 branch.
Discussion
----------
[Response] `getMaxAge()` returns non-negative integer
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Refs symfony/symfony#48651 (comment)
| License | MIT
| Doc PR |
The `max-age` directive should be a non-negative integer, see [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control):
> The max-age=N request directive indicates that the client allows a stored response that is generated on the origin server within N seconds — where N may be any non-negative integer (including 0).
In case the value is negative, it's encouraged to be treated as 0:
> In other words, for any max-age value that isn't an integer or isn't non-negative, the caching behavior that's encouraged is to treat the value as if it were 0.
In my case, it lead to a response that was `private,no-cache` but with an `Expires` header set in the future. Not every browser handled this inconsistency the same, which eventually led to authentication issues (see linked comment for a more elaborate explanation).
Commits
-------
2639c4353a [Response] `getMaxAge()` returns non-negative integergetMaxAge() returns non-negative integer (pkruithof, fabpot)2 files changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
777 | | - | |
778 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
779 | 781 | | |
780 | 782 | | |
781 | 783 | | |
| |||
819 | 821 | | |
820 | 822 | | |
821 | 823 | | |
822 | | - | |
| 824 | + | |
823 | 825 | | |
824 | 826 | | |
825 | 827 | | |
| |||
828 | 830 | | |
829 | 831 | | |
830 | 832 | | |
831 | | - | |
| 833 | + | |
832 | 834 | | |
833 | 835 | | |
834 | 836 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
357 | 356 | | |
358 | | - | |
| 357 | + | |
359 | 358 | | |
360 | 359 | | |
361 | 360 | | |
| |||
436 | 435 | | |
437 | 436 | | |
438 | 437 | | |
439 | | - | |
| 438 | + | |
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
| |||
0 commit comments