Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix two edge cases in ResponseCacheStrategy #23129

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

Closed
wants to merge 2 commits into from
Closed

Fix two edge cases in ResponseCacheStrategy #23129

wants to merge 2 commits into from

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Jun 10, 2017

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

While reviewing how ResponseCacheStrategy calculates the caching-related headers for responses that embed subrequests, I came across two cases that I think are currently implemented incorrectly.

a) When the main response is public and cacheable with an expiration time, but it embeds (via ESI) a controller that does not set any caching-related headers, this embedded response is more constrained. So, the resulting (combined) response must not be cacheable, especially it may not keep the s-maxage.

b) When the main response is public and cacheable with an expiration time, but it embeds (via ESI) a controller that explicitly creates a "private" response, the resulting (combined) response must be private as well.

@mpdude
Copy link
Contributor Author

mpdude commented Jun 14, 2017

Rebased to resolve conflicts after #23123 merged into 2.7

@fabpot
Copy link
Member

fabpot commented Jun 14, 2017

Thank you @mpdude.

fabpot added a commit that referenced this pull request Jun 14, 2017
This PR was squashed before being merged into the 2.7 branch (closes #23129).

Discussion
----------

Fix two edge cases in ResponseCacheStrategy

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While reviewing how `ResponseCacheStrategy` calculates the caching-related headers for responses that embed subrequests, I came across two cases that I think are currently implemented incorrectly.

a) When the main response is public and cacheable with an expiration time, but it embeds (via ESI) a controller that does not set any caching-related headers, this embedded response is more constrained. So, the resulting (combined) response must not be cacheable, especially it may not keep the s-maxage.

b) When the main response is public and cacheable with an expiration time, but it embeds (via ESI) a controller that explicitly creates a "private" response, the resulting (combined) response must be private as well.

Commits
-------

c6e8c07 Fix two edge cases in ResponseCacheStrategy
@fabpot fabpot closed this Jun 14, 2017
@mpdude mpdude deleted the fix-handling-noncacheable-embedded-response branch June 14, 2017 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants