Skip to content
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

304 (Not Modified) does not update the Client cache properly #142

Closed
Reyhn3 opened this issue Oct 2, 2015 · 2 comments
Closed

304 (Not Modified) does not update the Client cache properly #142

Reyhn3 opened this issue Oct 2, 2015 · 2 comments
Labels

Comments

@Reyhn3
Copy link

Reyhn3 commented Oct 2, 2015

Hi!

Consider the following scenario:

  1. The client requests an entity for the first time, and receives 200 (OK).
  2. The client requests the same entity within the valid cache time, and receives the entity from the client cache.
  3. The client requests the same entity a third time, but the max-age has expired the client-side cached entity, and a request is sent to the server. The server responds with 304 (Not Modified) and the client-side cached entity is returned.
  4. From now on, requesting the entity will always invoke a call to the server.

The bug is that the client-side CachingHandler never updates the Date header on the cached entity response. The client-side CachingHandler always believes that the entity must be revalidated.

According to #123, the server-side CachingHandler always returns a null cache-control header. The CacheCow.Client.CachingHandler.UpdateCachedResponse-method ignores all 304-responses with null-headers and subsequently never updates the date-header. Thus the ResponseValidator returns MustRevalidate forever.

@aliostad
Copy link
Owner

aliostad commented Oct 2, 2015

Thanks @Reyhn3
I feel you are right and it is a bug. Let me double check and if that is the case, I would need to fix and release.

Reyhn3 added a commit to Reyhn3/CacheCow that referenced this issue Oct 29, 2015
Reyhn3 added a commit to Reyhn3/CacheCow that referenced this issue Oct 29, 2015
aliostad added a commit that referenced this issue Oct 31, 2015
Fix for #142: Updating Date-header on NotModified stale client cache items
@aliostad
Copy link
Owner

FIx provided by @Reyhn3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants