-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpFoundation] Adds support for the immutable directive in the cache-control header #22932
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
Conversation
cba133a to
eb37144
Compare
eb37144 to
4b03f1b
Compare
|
4b03f1b to
cbf1dcc
Compare
abcdae4 to
f9bbae7
Compare
cf6bc1f to
fba0d33
Compare
| * @param bool $immutable Enables or disabled the immutable directive. | ||
| * | ||
| * @return $this | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a default value doesn't make much sense here IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I understand. My idea was calling the setImmutable method without argument like setPublic/setPrivate method.
return (new Response('SOME RESPONSE DATA'))
->setPublic()
->setImmutable();return (new Response('SOME RESPONSE DATA'))
->setPublic()
->setImmutable(true);I like the first example of code (calling setImmutable without boolean value). Maybe it will be better to implement opposite method setMutable (which remove the flag immutable from the Cache-Control header) and to remove the argument from setImmutable method completely. What is your opinion about it?
|
|
||
| /** | ||
| * Marks the response as "immutable". | ||
| * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"disables"
| } | ||
|
|
||
| if (isset($options['immutable'])) { | ||
| $this->setImmutable($options['immutable'] ? true : false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a cast to book?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*bool lol
fba0d33 to
2143eff
Compare
60ca02e to
7f603b7
Compare
| * @return bool Returns true if the response is marked as "immutable"; otherwise false. | ||
| */ | ||
| public function isImmutable() | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just return $this->headers->hasCacheControlDirective('immutable');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks for hint
695fd9a to
4cf01a1
Compare
4cf01a1 to
33573c6
Compare
|
Thank you @twoleds. |
…ive in the cache-control header (twoleds) This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Adds support for the immutable directive in the cache-control header | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21425 | License | MIT | Doc PR | Added support for the immutable directive in the cache-control header, tries to resolve #21425. Commits ------- 33573c6 Added support for the immutable directive in the cache-control header
Added support for the immutable directive in the cache-control header, tries to resolve #21425.