psf / psf/cachecontrol

Cached records are cleared without regard to Vary header

Open
#173 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
505
Forks
149
Avg merge
2d 13h
Merged PRs (30d)
7

Description

I'm accessing a REST API that returns different data structures based on the Accept header. Cachecontrol seems to be properly handling the Vary: Accept, Accept-Encoding that the server sends back when making requests, that's good. What becomes an issue is when one of the content type variants send back Cache-Control: no-store, Cachecontrol just blows away the other cached record without regard to the secondary key provided by Vary.

https://github.com/ionrock/cachecontrol/blob/db54c4033cbf49489a1cf54586d2f6ae6c66813f/cachecontrol/controller.py#L287-L289

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cachecontrol/controller.py at lines 287-289, where the issue reports that a no-store response clears cached records. Reproduce the case with multiple Accept variants and Vary: Accept, Accept-Encoding. Done means a no-store variant no longer removes the other cached variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.