| Age | Commit message (Collapse) | Author |
|
vary on Cookie.
`UpdateCacheMiddleware` skipped caching `Set-Cookie` responses that vary
on `Cookie` only when the request had no cookies at all. A request
carrying an unrelated cookie bypassed the guard, allowing a newly-issued
session cookie to be stored in Django's shared cache.
The guard now applies whenever a response both sets a cookie and varies
on Cookie, regardless of what cookies the incoming request carried.
Thanks Chris Whyland for the report, Jake Howard for initial triage, and
Jacob Walls for reviews.
|
|
|
|
cached template fragments.
This algorithm used a delimiter, but because it didn't use a length,
argument values containing the delimiter could still cause collisions.
|
|
pages.
This prevents collisions between header values that concatenate to the same thing.
|
|
The switch from substring matching to exact token membership in
142b881cecaddc334cabec139e701c0e4b9798da caused qualified directive
forms permitted by RFC 9111 (e.g. `Cache-Control: private="Set-Cookie"`)
to be missed, allowing such responses to be stored in a shared cache.
This work added a new `split_directive_names()` helper that yields the
lowercased directive name from each token, dropping any qualified value
and stripping whitespace around "=", so qualified forms reduce to their
directive name. `UpdateCacheMiddleware` now uses it so `private`,
`no-cache`, and `no-store` (and the `public` exception for
`Authorization`) match regardless of qualified form.
Aligned `ConditionalGetMiddleware.needs_etag()` to use the same helper,
since it relied on the same brittle exact-token check. Sharing one
helper keeps the two directive lookups consistent and means malformed
input (e.g. `no-store="x"`) now correctly suppresses the `ETag` instead
of being silently ignored.
Also stripped whitespace around `=` in `patch_cache_control`'s directive
parsing so a qualified directive with stray whitespace is still recognized.
Thanks to Jacob Walls for reviews.
|
|
|
|
directives in UpdateCacheMiddleware.
Avoid false positives from hypothetical extension directives
that could be superstrings of the ones we are checking.
|
|
Extracted the repeated `split(",")` + per-token `.strip()` pattern into
a `split_header_value()` generator in django/utils/http.py. The previous
`cc_delim_re` regex only stripped whitespace adjacent to the comma
delimiter, leaving leading or trailing whitespace on the first and last
tokens. Now, `split_header_value()` strips every token fully, matching
RFC 9110's optional-whitespace rules.
Thanks to Shai Berger, Jacob Walls, and Sarah Boyce for reviews.
|
|
|
|
values.
Thanks to Navid Rezazadeh for the report and Jacob Walls for review.
|
|
responses.
Thanks Shai Berger for the report, and Natalia Bidart and Sarah Boyce for reviews.
|
|
UpdateCacheMiddleware.
Thanks Ahmed Badawe for the report, and Jacob Walls for reviews.
|
|
contains an asterisk.
Thank you Ahmad Sadeddin for the report and Jacob Walls for the review.
|
|
|
|
|
|
available.
Thanks Simon Charette, Sarah Boyce, and Jacob Walls for reviews.
|
|
Cache-Control 'no-cache' or 'no-store'.
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
|
|
Co-Authored-By: Author: Alexander Lazarević <laza@e11bits.com>
|
|
|
|
to slow file system access.
|
|
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.
https://github.com/psf/black/releases/tag/23.1.0
|
|
and tests.
|
|
Co-authored-by: Sin-Woo Bang <sinwoobang@gmail.com>
|
|
condition.
|
|
empty list.
|
|
Thanks Ben Picolo for the report.
|
|
Most QuerySet methods are mapped onto the Manager and, in general,
it isn't necessary to call .all() on the manager.
|
|
|
|
|
|
In these cases Black produces unexpected results, e.g.
def make_random_password(
self,
length=10,
allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):
or
cursor.execute("""
SELECT ...
""",
[table name],
)
|
|
|
|
|
|
|
|
|
|
BaseCacheTests.test_cache_write_unpicklable_object()
|
|
|
|
Thanks Carlton Gibson, Chris Jerdonek, David Smith, Keryn Knight,
Mariusz Felisiak, and Nick Pope for reviews and mentoring this
Google Summer of Code 2021 project.
|
|
The validate_key() function should be called after make_key() to ensure
that the validation is performed on the key that will actually be
stored in the cache.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
|
|
|
|
incr()/decr() in memcached backends.
Thanks Chris Jerdonek for the review.
|
|
with negative deltas.
|
|
|
|
Thanks Alexander Ebral for the report.
Regression in 98e05ccde440cc9b768952cc10bc8285f4924e1f.
|
|
closed cursor.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
Many of the cache operations make use of the default argument to the
.get() operation to determine whether the key was found in the cache.
The default value of the default argument is None, so this results in
these operations assuming that None is not stored in the cache when it
actually is. Adding a sentinel object solves this issue.
Unfortunately the unmaintained python-memcached library does not support
a default argument to .get(), so the previous behavior is preserved for
the deprecated MemcachedCache backend.
|
|
|
|
|