-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Don't overwrite Vary header when setting for cookie access #2322
Conversation
flask/sessions.py
Outdated
vary_headers.append('Cookie') | ||
|
||
updated_header = ', '.join(header for header in vary_headers if header) | ||
response.headers.set('Vary', updated_header) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
flask/sessions.py
Outdated
@@ -348,6 +349,8 @@ class SecureCookieSessionInterface(SessionInterface): | |||
"""The default session interface that stores sessions in signed cookies | |||
through the :mod:`itsdangerous` module. | |||
""" | |||
#: the regular expression used to split the value of the 'Vary' header | |||
comma_delim_header_re = re.compile(r'\s*,\s*') |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
flask/sessions.py
Outdated
|
||
The header should retain it's original ordering. | ||
""" | ||
vary_headers = self.comma_delim_header_re.split(response.headers.get('Vary', '')) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
flask/sessions.py
Outdated
The header should retain it's original ordering. | ||
""" | ||
vary_headers = self.comma_delim_header_re.split(response.headers.get('Vary', '')) | ||
if 'Cookie' not in vary_headers: |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
18e2106
to
e7cd68b
Compare
Codecov Report
@@ Coverage Diff @@
## master #2322 +/- ##
==========================================
+ Coverage 92.79% 92.82% +0.02%
==========================================
Files 45 45
Lines 6333 6355 +22
Branches 496 498 +2
==========================================
+ Hits 5877 5899 +22
Misses 335 335
Partials 121 121
Continue to review full report at Codecov.
|
Requested changes submitted, ready for re-review. |
I extracted and renamed the method to |
😞 turns out there's already support for this in Werkzeug. #2345 response.vary.add('Cookie') |
Closes #2317